Foreword |
|
xix | |
|
Acknowledgments |
|
xxiii | |
Introduction |
|
xxv | |
|
|
xxvi | |
|
|
xxvi | |
|
|
xxvii | |
|
|
xxvii | |
|
|
xxvii | |
|
Part IV: Exploit Development |
|
|
xxviii | |
|
|
xxviii | |
|
0 Penetration Testing Primer |
|
|
1 | (8) |
|
The Stages of the Penetration Test |
|
|
2 | (4) |
|
|
2 | (2) |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
|
|
5 | (1) |
|
|
6 | (3) |
Part I The Basics |
|
|
1 Setting Up Your Virtual Lab |
|
|
9 | (46) |
|
|
9 | (1) |
|
|
10 | (18) |
|
Configuring the Network for Your Virtual Machine |
|
|
13 | (4) |
|
|
17 | (3) |
|
Installing Additional Software |
|
|
20 | (2) |
|
Setting Up Android Emulators |
|
|
22 | (5) |
|
Smartphone Pentest Framework |
|
|
27 | (1) |
|
|
28 | (1) |
|
Creating the Windows XP Target |
|
|
29 | (19) |
|
VMware Player on Microsoft Windows |
|
|
29 | (2) |
|
|
31 | (1) |
|
Installing and Activating Windows |
|
|
32 | (3) |
|
|
35 | (2) |
|
Turning Off Windows Firewall |
|
|
37 | (1) |
|
|
37 | (1) |
|
Setting a Static IP Address |
|
|
38 | (1) |
|
Making XP Act Like It's a Member of a Windows Domain |
|
|
39 | (1) |
|
Installing Vulnerable Software |
|
|
40 | (6) |
|
Installing Immunity Debugger and Mona |
|
|
46 | (2) |
|
Setting Up the Ubuntu 8.10 Target |
|
|
48 | (1) |
|
Creating the Windows 7 Target |
|
|
48 | (6) |
|
|
48 | (2) |
|
Opting Out of Automatic Updates |
|
|
50 | (1) |
|
Setting a Static IP Address |
|
|
51 | (1) |
|
Adding a Second Network Interface |
|
|
52 | (1) |
|
Installing Additional Software |
|
|
52 | (2) |
|
|
54 | (1) |
|
|
55 | (20) |
|
|
56 | (1) |
|
|
56 | (1) |
|
|
56 | (1) |
|
Learning About Commands: The Man Pages |
|
|
57 | (1) |
|
|
58 | (3) |
|
|
58 | (1) |
|
Adding a User to the sudoers File |
|
|
59 | (1) |
|
Switching Users and Using sudo |
|
|
59 | (1) |
|
Creating a New File or Directory |
|
|
60 | (1) |
|
Copying, Moving, and Removing Files |
|
|
60 | (1) |
|
|
61 | (1) |
|
|
61 | (1) |
|
|
61 | (1) |
|
|
62 | (2) |
|
|
63 | (1) |
|
|
63 | (1) |
|
|
64 | (2) |
|
|
65 | (1) |
|
|
65 | (1) |
|
Pattern Matching with awk |
|
|
66 | (1) |
|
Managing Installed Packages |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
67 | (2) |
|
Setting a Static IP Address |
|
|
68 | (1) |
|
Viewing Network Connections |
|
|
69 | (1) |
|
Netcat: The Swiss Army Knife of TCP/IP Connections |
|
|
69 | (3) |
|
Check to See If a Port Is Listening |
|
|
70 | (1) |
|
Opening a Command Shell Listener |
|
|
70 | (1) |
|
Pushing a Command Shell Back to a Listener |
|
|
71 | (1) |
|
Automating Tasks with cron Jobs |
|
|
72 | (1) |
|
|
73 | (2) |
|
|
75 | (12) |
|
|
75 | (6) |
|
|
76 | (1) |
|
|
76 | (1) |
|
|
77 | (1) |
|
Adding Functionality with if Statements |
|
|
77 | (1) |
|
|
78 | (1) |
|
|
79 | (2) |
|
|
81 | (3) |
|
|
83 | (1) |
|
|
83 | (1) |
|
Writing and Compiling C Programs |
|
|
84 | (1) |
|
|
85 | (2) |
|
4 Using The Metasploit Framework |
|
|
87 | (26) |
|
|
88 | (2) |
|
Finding Metasploit Modules |
|
|
90 | (4) |
|
|
90 | (1) |
|
|
91 | (3) |
|
|
94 | (2) |
|
|
94 | (1) |
|
|
95 | (1) |
|
|
95 | (1) |
|
|
95 | (1) |
|
|
96 | (2) |
|
Finding Compatible Payloads |
|
|
96 | (1) |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
Setting a Payload Manually |
|
|
99 | (2) |
|
|
101 | (2) |
|
|
101 | (1) |
|
|
101 | (1) |
|
|
102 | (1) |
|
Creating Standalone Payloads with Msfvenom |
|
|
103 | (4) |
|
|
104 | (1) |
|
|
104 | (1) |
|
Choosing an Output Format |
|
|
104 | (1) |
|
|
105 | (1) |
|
Using the Multi/Handler Module |
|
|
105 | (2) |
|
Using an Auxiliary Module |
|
|
107 | (2) |
|
|
109 | (4) |
Part II Assessments |
|
|
|
113 | (20) |
|
Open Source Intelligence Gathering |
|
|
114 | (9) |
|
|
114 | (1) |
|
|
115 | (1) |
|
|
116 | (2) |
|
Searching for Email Addresses |
|
|
118 | (1) |
|
|
119 | (4) |
|
|
123 | (9) |
|
|
124 | (1) |
|
|
125 | (7) |
|
|
132 | (1) |
|
6 Finding Vulnerabilities |
|
|
133 | (22) |
|
From Nmap Version Scan to Potential Vulnerability |
|
|
133 | (1) |
|
|
134 | (8) |
|
|
134 | (4) |
|
|
138 | (2) |
|
A Note About Nessus Rankings |
|
|
140 | (1) |
|
Why Use Vulnerability Scanners? |
|
|
141 | (1) |
|
|
141 | (1) |
|
Researching Vulnerabilities |
|
|
142 | (1) |
|
The Nmap Scripting Engine |
|
|
142 | (2) |
|
Running a Single NSE Script |
|
|
144 | (2) |
|
Metasploit Scanner Modules |
|
|
146 | (1) |
|
Metasploit Exploit Check Functions |
|
|
147 | (1) |
|
|
148 | (3) |
|
|
149 | (1) |
|
|
149 | (1) |
|
|
150 | (1) |
|
|
151 | (2) |
|
|
151 | (2) |
|
|
153 | (1) |
|
|
153 | (2) |
|
|
155 | (24) |
|
Networking for Capturing Traffic |
|
|
156 | (1) |
|
|
156 | (4) |
|
|
156 | (2) |
|
|
158 | (1) |
|
|
159 | (1) |
|
|
160 | (1) |
|
|
160 | (7) |
|
|
161 | (2) |
|
|
163 | (1) |
|
ARP Cache Poisoning with Arpspoof |
|
|
164 | (1) |
|
Using ARP Cache Poisoning to Impersonate the Default Gateway |
|
|
165 | (2) |
|
|
167 | (3) |
|
|
168 | (1) |
|
|
169 | (1) |
|
|
170 | (3) |
|
|
170 | (1) |
|
Using Ettercap for SSL Man-in-the-Middle Attacks |
|
|
171 | (2) |
|
|
173 | (2) |
|
|
174 | (1) |
|
|
175 | (4) |
Part III Attacks |
|
|
|
179 | (18) |
|
|
180 | (2) |
|
|
180 | (1) |
|
|
181 | (1) |
|
Exploiting WebDAV Default Credentials |
|
|
182 | (4) |
|
Running a Script on the Target Web Server |
|
|
183 | (1) |
|
Uploading a Msfvenom Payload |
|
|
183 | (3) |
|
Exploiting Open phpMyAdmin |
|
|
186 | (2) |
|
Downloading a File with TFTP |
|
|
187 | (1) |
|
Downloading Sensitive Files |
|
|
188 | (2) |
|
Downloading a Configuration File |
|
|
188 | (1) |
|
Downloading the Windows SAM |
|
|
189 | (1) |
|
Exploiting a Buffer Overflow in Third-Party Software |
|
|
190 | (1) |
|
Exploiting Third-Party Web Applications |
|
|
191 | (2) |
|
Exploiting a Compromised Service |
|
|
193 | (1) |
|
Exploiting Open NFS Shares |
|
|
194 | (2) |
|
|
196 | (1) |
|
|
197 | (18) |
|
|
197 | (1) |
|
|
198 | (5) |
|
|
199 | (3) |
|
Guessing Usernames and Passwords with Hydra |
|
|
202 | (1) |
|
|
203 | (10) |
|
Recovering Password Hashes from a Windows SAM File |
|
|
204 | (2) |
|
Dumping Password Hashes with Physical Access |
|
|
206 | (2) |
|
LM vs. NTLM Hashing Algorithms |
|
|
208 | (1) |
|
The Trouble with LM Password Hashes |
|
|
209 | (1) |
|
|
210 | (2) |
|
|
212 | (1) |
|
Cracking Configuration File Passwords |
|
|
212 | (1) |
|
|
213 | (1) |
|
Online Password-Cracking Services |
|
|
213 | (1) |
|
Dumping Plaintext Passwords from Memory with Windows Credential Editor |
|
|
213 | (1) |
|
|
214 | (1) |
|
10 Client-Side Exploitation |
|
|
215 | (28) |
|
Bypassing Filters with Metasploit Payloads |
|
|
216 | (2) |
|
|
216 | (1) |
|
|
217 | (1) |
|
|
218 | (22) |
|
|
219 | (6) |
|
|
225 | (5) |
|
|
230 | (5) |
|
|
235 | (2) |
|
|
237 | (3) |
|
|
240 | (3) |
|
|
243 | (14) |
|
The Social-Engineer Toolkit |
|
|
244 | (1) |
|
|
245 | (5) |
|
|
246 | (1) |
|
|
247 | (1) |
|
|
247 | (1) |
|
|
247 | (1) |
|
|
248 | (1) |
|
|
248 | (1) |
|
|
249 | (1) |
|
|
250 | (3) |
|
|
253 | (2) |
|
|
255 | (1) |
|
|
255 | (2) |
|
12 Bypassing Antivirus Applications |
|
|
257 | (20) |
|
|
258 | (2) |
|
|
258 | (2) |
|
How Antivirus Applications Work |
|
|
260 | (1) |
|
Microsoft Security Essentials |
|
|
261 | (1) |
|
|
262 | (1) |
|
Getting Past an Antivirus Program |
|
|
263 | (11) |
|
|
263 | (3) |
|
|
266 | (3) |
|
Encrypting Executables with Hyperion |
|
|
269 | (1) |
|
Evading Antivirus with Veil-Evasion |
|
|
270 | (4) |
|
|
274 | (1) |
|
|
274 | (3) |
|
|
277 | (36) |
|
|
278 | (2) |
|
|
279 | (1) |
|
|
279 | (1) |
|
Other Meterpreter Commands |
|
|
280 | (1) |
|
|
280 | (1) |
|
Metasploit Post-Exploitation Modules |
|
|
281 | (2) |
|
|
283 | (1) |
|
Local Privilege Escalation |
|
|
283 | (8) |
|
|
283 | (1) |
|
Local Escalation Module for Windows |
|
|
284 | (1) |
|
|
285 | (2) |
|
Udev Privilege Escalation on Linux |
|
|
287 | (4) |
|
Local Information Gathering |
|
|
291 | (5) |
|
|
291 | (1) |
|
|
292 | (1) |
|
|
292 | (2) |
|
|
294 | (1) |
|
|
295 | (1) |
|
|
295 | (1) |
|
|
296 | (8) |
|
|
296 | (2) |
|
|
298 | (1) |
|
|
299 | (1) |
|
|
300 | (1) |
|
|
301 | (1) |
|
|
302 | (2) |
|
|
304 | (5) |
|
Adding a Route in Metasploit |
|
|
305 | (1) |
|
|
306 | (1) |
|
Running an Exploit through a Pivot |
|
|
306 | (1) |
|
|
307 | (2) |
|
|
309 | (2) |
|
|
309 | (1) |
|
|
310 | (1) |
|
Creating a Linux cron Job |
|
|
311 | (1) |
|
|
311 | (2) |
|
14 Web Application Testing |
|
|
313 | (26) |
|
|
314 | (5) |
|
|
319 | (4) |
|
Testing for SQL Injection Vulnerabilities |
|
|
320 | (1) |
|
Exploiting SQL Injection Vulnerabilities |
|
|
321 | (1) |
|
|
321 | (2) |
|
|
323 | (1) |
|
|
324 | (3) |
|
|
327 | (1) |
|
|
327 | (2) |
|
|
329 | (6) |
|
Checking for a Reflected XSS Vulnerability |
|
|
330 | (1) |
|
Leveraging XSS with the Browser Exploitation Framework |
|
|
331 | (4) |
|
Cross-Site Request Forgery |
|
|
335 | (1) |
|
Web Application Scanning with w3af |
|
|
335 | (2) |
|
|
337 | (2) |
|
|
339 | (22) |
|
|
339 | (2) |
|
Viewing Available Wireless Interfaces |
|
|
340 | (1) |
|
|
341 | (1) |
|
|
341 | (1) |
|
|
342 | (1) |
|
|
343 | (1) |
|
|
343 | (7) |
|
|
346 | (1) |
|
Cracking WEP Keys with Aircrack-ng |
|
|
347 | (3) |
|
|
350 | (1) |
|
|
351 | (5) |
|
The Enterprise Connection Process |
|
|
351 | (1) |
|
The Personal Connection Process |
|
|
351 | (1) |
|
|
352 | (1) |
|
|
353 | (3) |
|
|
356 | (1) |
|
|
356 | (1) |
|
|
357 | (1) |
|
|
357 | (4) |
Part IV Exploit Development |
|
|
16 A Stack-Based Buffer Overflow In Linux |
|
|
361 | (18) |
|
|
362 | (2) |
|
|
364 | (14) |
|
|
365 | (1) |
|
|
366 | (1) |
|
|
367 | (5) |
|
Crashing the Program in GDB |
|
|
372 | (1) |
|
|
373 | (2) |
|
|
375 | (1) |
|
|
376 | (2) |
|
|
378 | (1) |
|
17 A Stack-Based Buffer Overflow In Windows |
|
|
379 | (22) |
|
Searching For a Known Vulnerability in War-FTP |
|
|
380 | (2) |
|
|
382 | (2) |
|
|
384 | (6) |
|
Generating a Cyclical Pattern to Determine Offset |
|
|
385 | (3) |
|
|
388 | (2) |
|
|
390 | (5) |
|
|
395 | (5) |
|
|
400 | (1) |
|
18 Structured Exception Handler Overwrites |
|
|
401 | (20) |
|
|
403 | (4) |
|
|
407 | (1) |
|
Finding the Attack String in Memory |
|
|
408 | (3) |
|
|
411 | (1) |
|
|
412 | (4) |
|
|
416 | (2) |
|
|
418 | (1) |
|
|
419 | (2) |
|
19 Fuzzing, Porting Exploits, And Metasploit Modules |
|
|
421 | (24) |
|
|
421 | (6) |
|
Finding Bugs with Code Review |
|
|
422 | (1) |
|
Fuzzing a Trivial FTP Server |
|
|
422 | (2) |
|
|
424 | (3) |
|
Porting Public Exploits to Meet Your Needs |
|
|
427 | (5) |
|
|
429 | (1) |
|
|
430 | (1) |
|
|
430 | (2) |
|
Writing Metasploit Modules |
|
|
432 | (7) |
|
A Similar Exploit String Module |
|
|
435 | (1) |
|
|
435 | (4) |
|
Exploitation Mitigation Techniques |
|
|
439 | (3) |
|
|
440 | (1) |
|
Address Space Layout Randomization |
|
|
440 | (1) |
|
Data Execution Prevention |
|
|
441 | (1) |
|
|
441 | (1) |
|
|
442 | (3) |
Part V Mobile Hacking |
|
|
20 Using The Smartphone Pentest Framework |
|
|
445 | (28) |
|
|
446 | (1) |
|
|
446 | (1) |
|
|
446 | (1) |
|
|
447 | (1) |
|
The Smartphone Pentest Framework |
|
|
447 | (6) |
|
|
447 | (2) |
|
|
449 | (1) |
|
|
449 | (1) |
|
|
449 | (1) |
|
|
450 | (2) |
|
Attaching the SPF Server and App |
|
|
452 | (1) |
|
|
453 | (1) |
|
|
453 | (1) |
|
|
454 | (4) |
|
|
454 | (2) |
|
|
456 | (2) |
|
|
458 | (6) |
|
Creating Malicious SPF Agents |
|
|
459 | (5) |
|
|
464 | (8) |
|
|
464 | (1) |
|
|
465 | (1) |
|
Pivoting Through Mobile Devices |
|
|
466 | (5) |
|
|
471 | (1) |
|
|
472 | (1) |
Resources |
|
473 | (4) |
Index |
|
477 | |