| Foreword |
|
xxii | |
| Introduction |
|
xxiii | |
|
Part I Overview of Penetration Testing |
|
|
3 | (44) |
|
Understanding Penetration Testing |
|
|
5 | (16) |
|
Defining Penetration Testing |
|
|
5 | (3) |
|
Assessing the Need for Penetration Testing |
|
|
8 | (5) |
|
Proliferation of Viruses and Worms |
|
|
9 | (1) |
|
|
|
9 | (1) |
|
Complexity of Networks Today |
|
|
10 | (1) |
|
Frequency of Software Updates |
|
|
10 | (1) |
|
Availability of Hacking Tools |
|
|
10 | (1) |
|
The Nature of Open Source |
|
|
11 | (1) |
|
|
|
11 | (1) |
|
Unmonitored Mobile Users and Telecommuters |
|
|
12 | (1) |
|
|
|
12 | (1) |
|
|
|
12 | (1) |
|
|
|
13 | (1) |
|
|
|
13 | (1) |
|
|
|
13 | (1) |
|
|
|
13 | (1) |
|
Choosing a Penetration Testing Vendor |
|
|
14 | (2) |
|
|
|
16 | (1) |
|
|
|
17 | (4) |
|
Legal and Ethical Considerations |
|
|
21 | (14) |
|
Ethics of Penetration Testing |
|
|
21 | (2) |
|
|
|
23 | (8) |
|
U.S. Laws Pertaining to Hacking |
|
|
24 | (1) |
|
1973 U.S. Code of Fair Information Practices |
|
|
25 | (1) |
|
1986 Computer Fraud and Abuse Act (CFAA) |
|
|
25 | (2) |
|
|
|
27 | (1) |
|
|
|
28 | (1) |
|
1996 U.S. Kennedy-Kasselbaum Health Insurance Portability and Accountability Act (HIPAA) |
|
|
28 | (1) |
|
Graham-Leach-Bliley (GLB) |
|
|
29 | (1) |
|
|
|
30 | (1) |
|
2002 Federal Information Security Management Act (FISMA) |
|
|
30 | (1) |
|
2003 Sarbanes-Oxley Act (SOX) |
|
|
30 | (1) |
|
Non-U.S. Laws Pertaining to Hacking |
|
|
31 | (1) |
|
|
|
31 | (1) |
|
|
|
32 | (1) |
|
|
|
32 | (3) |
|
|
|
35 | (12) |
|
|
|
35 | (2) |
|
|
|
36 | (1) |
|
|
|
36 | (1) |
|
|
|
36 | (1) |
|
|
|
37 | (1) |
|
Open-Source Security Testing Methodology Manual |
|
|
37 | (3) |
|
|
|
40 | (4) |
|
|
|
40 | (2) |
|
|
|
42 | (1) |
|
|
|
42 | (2) |
|
|
|
44 | (1) |
|
|
|
44 | (1) |
|
|
|
44 | (3) |
|
Part II Performing the Test |
|
|
47 | (486) |
|
Performing Social Engineering |
|
|
49 | (28) |
|
|
|
50 | (5) |
|
|
|
50 | (1) |
|
|
|
51 | (1) |
|
|
|
52 | (1) |
|
Authority-Based Persuasion |
|
|
53 | (1) |
|
Reciprocation-Based Social Engineering |
|
|
53 | (1) |
|
Similarity-Based Social Engineering |
|
|
54 | (1) |
|
Information-Based Social Engineering |
|
|
54 | (1) |
|
What It Takes to Be a Social Engineer |
|
|
55 | (5) |
|
Using Patience for Social Engineering |
|
|
56 | (1) |
|
Using Confidence for Social Engineering |
|
|
57 | (1) |
|
Using Trust for Social Engineering |
|
|
58 | (1) |
|
Using Inside Knowledge for Social Engineering |
|
|
59 | (1) |
|
First Impressions and the Social Engineer |
|
|
60 | (1) |
|
Tech Support Impersonation |
|
|
61 | (1) |
|
Third-Party Impersonation |
|
|
62 | (2) |
|
|
|
64 | (5) |
|
|
|
69 | (1) |
|
|
|
69 | (1) |
|
Reverse Social Engineering |
|
|
70 | (1) |
|
Protecting Against Social Engineering |
|
|
71 | (1) |
|
|
|
72 | (3) |
|
|
|
75 | (2) |
|
Performing Host Reconnaissance |
|
|
77 | (50) |
|
Passive Host Reconnaissance |
|
|
78 | (11) |
|
|
|
79 | (8) |
|
|
|
87 | (1) |
|
|
|
87 | (1) |
|
|
|
88 | (1) |
|
|
|
88 | (1) |
|
Active Host Reconnaissance |
|
|
89 | (7) |
|
|
|
89 | (3) |
|
|
|
92 | (3) |
|
|
|
95 | (1) |
|
|
|
96 | (6) |
|
|
|
98 | (1) |
|
|
|
99 | (1) |
|
|
|
99 | (1) |
|
|
|
100 | (1) |
|
|
|
100 | (1) |
|
|
|
101 | (1) |
|
|
|
101 | (1) |
|
|
|
102 | (7) |
|
NMap Switches and Techniques |
|
|
103 | (2) |
|
Compiling and Testing NMap |
|
|
105 | (1) |
|
|
|
106 | (1) |
|
|
|
107 | (2) |
|
|
|
109 | (9) |
|
|
|
109 | (1) |
|
Anomaly Detection Systems |
|
|
109 | (1) |
|
|
|
109 | (1) |
|
|
|
110 | (1) |
|
|
|
110 | (1) |
|
|
|
111 | (1) |
|
Examples of Scan Detection |
|
|
112 | (1) |
|
Detecting a TCP Connect() Scan |
|
|
113 | (1) |
|
|
|
114 | (1) |
|
Detecting FIN, NULL, and Xmas-Tree Scans |
|
|
115 | (2) |
|
|
|
117 | (1) |
|
|
|
118 | (4) |
|
|
|
122 | (5) |
|
Understanding and Attempting Session Hijacking |
|
|
127 | (50) |
|
Defining Session Hijacking |
|
|
127 | (4) |
|
|
|
128 | (1) |
|
|
|
129 | (1) |
|
TCP Sequence Prediction (Blind Hijacking) |
|
|
130 | (1) |
|
|
|
131 | (6) |
|
|
|
131 | (3) |
|
|
|
134 | (2) |
|
|
|
136 | (1) |
|
|
|
136 | (1) |
|
|
|
137 | (1) |
|
|
|
137 | (2) |
|
Kevin Mitnick's Session Hijack Attack |
|
|
139 | (4) |
|
Detecting Session Hijacking |
|
|
143 | (24) |
|
Detecting Session Hijacking with a Packet Sniffer |
|
|
145 | (1) |
|
|
|
145 | (2) |
|
Watching a Hijacking with Ethereal |
|
|
147 | (6) |
|
Detecting Session Hijacking with Cisco IDS |
|
|
153 | (3) |
|
Signature 1300: TCP Segment Overwrite |
|
|
156 | (1) |
|
Signature 3250: TCP Hijack |
|
|
157 | (5) |
|
Signature 3251: TCP Hijacking Simplex Mode |
|
|
162 | (2) |
|
Watching a Hijacking with IEV |
|
|
164 | (3) |
|
Protecting Against Session Hijacking |
|
|
167 | (1) |
|
|
|
168 | (5) |
|
|
|
173 | (1) |
|
|
|
174 | (3) |
|
Performing Web Server Attacks |
|
|
177 | (70) |
|
Understanding Web Languages |
|
|
177 | (19) |
|
|
|
179 | (2) |
|
|
|
181 | (2) |
|
|
|
183 | (1) |
|
|
|
184 | (1) |
|
|
|
185 | (1) |
|
|
|
186 | (1) |
|
|
|
186 | (1) |
|
|
|
187 | (1) |
|
|
|
188 | (3) |
|
|
|
191 | (1) |
|
PHP Hypertext Preprocessor |
|
|
192 | (1) |
|
|
|
193 | (1) |
|
|
|
193 | (1) |
|
|
|
194 | (1) |
|
|
|
194 | (2) |
|
|
|
196 | (2) |
|
|
|
198 | (5) |
|
Apache HTTP Server Vulnerabilities |
|
|
199 | (1) |
|
|
|
199 | (1) |
|
|
|
200 | (1) |
|
|
|
201 | (1) |
|
|
|
202 | (1) |
|
|
|
203 | (2) |
|
|
|
205 | (4) |
|
|
|
207 | (2) |
|
|
|
209 | (8) |
|
|
|
211 | (1) |
|
|
|
211 | (1) |
|
Detecting a Brute Force Attack |
|
|
212 | (3) |
|
Protecting Against Brute Force Attacks |
|
|
215 | (2) |
|
|
|
217 | (8) |
|
|
|
217 | (1) |
|
|
|
218 | (3) |
|
|
|
221 | (1) |
|
|
|
221 | (1) |
|
|
|
222 | (1) |
|
|
|
222 | (1) |
|
Web Server Banner Grabbing |
|
|
223 | (1) |
|
|
|
224 | (1) |
|
|
|
225 | (7) |
|
Detecting Directory Traversal |
|
|
226 | (2) |
|
|
|
228 | (4) |
|
Protecting Against Web Attacks |
|
|
232 | (6) |
|
Securing the Operating System |
|
|
232 | (2) |
|
Securing Web Server Applications |
|
|
234 | (1) |
|
|
|
234 | (2) |
|
|
|
236 | (1) |
|
|
|
236 | (1) |
|
Securing Network Architecture |
|
|
237 | (1) |
|
|
|
238 | (6) |
|
|
|
244 | (3) |
|
Performing Database Attacks |
|
|
247 | (32) |
|
|
|
249 | (4) |
|
|
|
250 | (1) |
|
|
|
250 | (1) |
|
|
|
250 | (1) |
|
|
|
251 | (1) |
|
|
|
251 | (1) |
|
|
|
251 | (1) |
|
|
|
252 | (1) |
|
|
|
252 | (1) |
|
|
|
253 | (1) |
|
Database Default Accounts |
|
|
253 | (1) |
|
Testing Database Vulnerabilities |
|
|
253 | (8) |
|
|
|
256 | (1) |
|
|
|
257 | (2) |
|
|
|
259 | (1) |
|
|
|
259 | (1) |
|
Password Cracking/Brute Force Attacks |
|
|
260 | (1) |
|
|
|
261 | (5) |
|
|
|
261 | (2) |
|
|
|
263 | (1) |
|
|
|
263 | (1) |
|
|
|
264 | (1) |
|
|
|
264 | (1) |
|
|
|
264 | (1) |
|
|
|
265 | (1) |
|
Detecting Database Attacks |
|
|
266 | (4) |
|
|
|
266 | (2) |
|
|
|
268 | (1) |
|
|
|
269 | (1) |
|
|
|
270 | (1) |
|
Protecting Against Database Attacks |
|
|
270 | (2) |
|
|
|
272 | (5) |
|
|
|
277 | (1) |
|
References and Further Reading |
|
|
277 | (2) |
|
|
|
279 | (42) |
|
|
|
280 | (4) |
|
|
|
282 | (1) |
|
Microsoft Password Hashing |
|
|
282 | (2) |
|
|
|
284 | (1) |
|
|
|
284 | (21) |
|
|
|
285 | (2) |
|
|
|
287 | (2) |
|
|
|
289 | (9) |
|
|
|
298 | (1) |
|
|
|
299 | (1) |
|
|
|
300 | (2) |
|
|
|
302 | (1) |
|
|
|
303 | (2) |
|
Detecting Password Cracking |
|
|
305 | (4) |
|
|
|
306 | (1) |
|
|
|
306 | (1) |
|
|
|
307 | (1) |
|
|
|
308 | (1) |
|
Dumpster Diving and Key Logging |
|
|
308 | (1) |
|
|
|
308 | (1) |
|
Protecting Against Password Cracking |
|
|
309 | (7) |
|
|
|
309 | (1) |
|
|
|
309 | (2) |
|
|
|
311 | (1) |
|
|
|
311 | (1) |
|
|
|
312 | (1) |
|
|
|
312 | (1) |
|
|
|
313 | (1) |
|
|
|
313 | (2) |
|
Employee Education and Policy |
|
|
315 | (1) |
|
|
|
316 | (3) |
|
|
|
319 | (2) |
|
|
|
321 | (28) |
|
|
|
321 | (2) |
|
Evading Intruder Detection Systems |
|
|
323 | (1) |
|
Testing Routers for Vulnerabilities |
|
|
324 | (9) |
|
|
|
324 | (2) |
|
|
|
326 | (2) |
|
|
|
328 | (1) |
|
|
|
329 | (4) |
|
Testing Switches for Vulnerabilities |
|
|
333 | (4) |
|
|
|
333 | (1) |
|
|
|
334 | (1) |
|
|
|
335 | (1) |
|
|
|
335 | (1) |
|
|
|
336 | (1) |
|
|
|
337 | (5) |
|
|
|
337 | (1) |
|
|
|
338 | (1) |
|
|
|
338 | (1) |
|
Disabling or Restricting the HTTP Service |
|
|
338 | (1) |
|
Securing Router Passwords |
|
|
338 | (1) |
|
Enabling Authentication for Routing Protocols |
|
|
339 | (2) |
|
|
|
341 | (1) |
|
Securing Against VLAN Hopping |
|
|
341 | (1) |
|
Securing Against Spanning Tree Attacks |
|
|
341 | (1) |
|
Securing Against MAC Table Flooding and ARP Attacks |
|
|
341 | (1) |
|
Securing Against VTP Attacks |
|
|
342 | (1) |
|
|
|
342 | (5) |
|
|
|
347 | (2) |
|
Scanning and Penetrating Wireless Networks |
|
|
349 | (18) |
|
History of Wireless Networks |
|
|
349 | (1) |
|
Antennas and Access Points |
|
|
350 | (1) |
|
Wireless Security Technologies |
|
|
351 | (2) |
|
Service Set Identifiers (SSIDs) |
|
|
351 | (1) |
|
Wired Equivalent Privacy (WEP) |
|
|
352 | (1) |
|
|
|
352 | (1) |
|
|
|
352 | (1) |
|
|
|
353 | (1) |
|
|
|
353 | (1) |
|
|
|
354 | (3) |
|
|
|
354 | (1) |
|
|
|
354 | (1) |
|
|
|
355 | (1) |
|
|
|
355 | (1) |
|
|
|
356 | (1) |
|
|
|
357 | (1) |
|
|
|
357 | (1) |
|
|
|
357 | (1) |
|
Detecting Wireless Attacks |
|
|
357 | (5) |
|
|
|
357 | (1) |
|
|
|
358 | (1) |
|
|
|
358 | (1) |
|
|
|
358 | (1) |
|
Unallocated MAC Addresses |
|
|
359 | (1) |
|
Preventing Wireless Attacks |
|
|
359 | (2) |
|
Preventing Man-in-the-Middle Attacks |
|
|
361 | (1) |
|
Establishing and Enforcing Standards for Wireless Networking |
|
|
362 | (1) |
|
|
|
362 | (3) |
|
|
|
365 | (2) |
|
Using Trojans and Backdoor Applications |
|
|
367 | (72) |
|
Trojans, Viruses, and Backdoor Applications |
|
|
367 | (1) |
|
|
|
368 | (10) |
|
|
|
369 | (1) |
|
|
|
370 | (1) |
|
|
|
371 | (1) |
|
|
|
372 | (1) |
|
|
|
373 | (1) |
|
|
|
373 | (2) |
|
|
|
375 | (1) |
|
|
|
376 | (1) |
|
|
|
377 | (1) |
|
|
|
378 | (45) |
|
|
|
378 | (11) |
|
|
|
389 | (1) |
|
|
|
390 | (5) |
|
|
|
395 | (1) |
|
|
|
395 | (3) |
|
|
|
398 | (13) |
|
|
|
411 | (1) |
|
|
|
412 | (1) |
|
|
|
412 | (5) |
|
|
|
417 | (6) |
|
Detecting Trojans and Backdoor Applications |
|
|
423 | (9) |
|
|
|
424 | (1) |
|
|
|
424 | (2) |
|
|
|
426 | (2) |
|
|
|
428 | (1) |
|
|
|
429 | (1) |
|
Monitoring Ports Remotely |
|
|
429 | (1) |
|
Anti-virus and Trojan Scanners Software |
|
|
430 | (1) |
|
Intrusion Detection Systems |
|
|
431 | (1) |
|
|
|
432 | (1) |
|
|
|
433 | (3) |
|
|
|
436 | (3) |
|
Penetrating UNIX, Microsoft, and Novell Servers |
|
|
439 | (22) |
|
|
|
440 | (5) |
|
|
|
440 | (1) |
|
|
|
441 | (1) |
|
|
|
442 | (2) |
|
|
|
444 | (1) |
|
|
|
445 | (1) |
|
UNIX Permissions and Root Access |
|
|
445 | (3) |
|
|
|
446 | (1) |
|
|
|
446 | (1) |
|
|
|
446 | (1) |
|
|
|
447 | (1) |
|
|
|
447 | (1) |
|
|
|
447 | (1) |
|
|
|
448 | (1) |
|
Microsoft Security Models and Exploits |
|
|
448 | (2) |
|
|
|
449 | (1) |
|
|
|
449 | (1) |
|
|
|
449 | (1) |
|
|
|
450 | (1) |
|
Novell Server Permissions and Vulnerabilities |
|
|
450 | (2) |
|
|
|
451 | (1) |
|
|
|
451 | (1) |
|
|
|
452 | (1) |
|
Preventing Server Attacks |
|
|
452 | (4) |
|
|
|
456 | (2) |
|
|
|
458 | (3) |
|
Understanding and Attempting Buffer Overflows |
|
|
461 | (20) |
|
|
|
461 | (4) |
|
|
|
461 | (3) |
|
|
|
464 | (1) |
|
|
|
464 | (1) |
|
|
|
465 | (8) |
|
|
|
465 | (1) |
|
Linux Privilege Escalation |
|
|
466 | (5) |
|
Windows Privilege Escalation |
|
|
471 | (2) |
|
Preventing Buffer Overflows |
|
|
473 | (3) |
|
Library Tools to Prevent Buffer Overflows |
|
|
475 | (1) |
|
Compiler-Based Solutions to Prevent Buffer Overflows |
|
|
475 | (1) |
|
Using a Non-Executable Stack to Prevent Buffer Overflows |
|
|
475 | (1) |
|
|
|
476 | (3) |
|
|
|
479 | (2) |
|
Denial-of-Service Attacks |
|
|
481 | (20) |
|
|
|
483 | (3) |
|
|
|
483 | (1) |
|
|
|
484 | (1) |
|
|
|
485 | (1) |
|
|
|
486 | (1) |
|
Tools for Executing DoS Attacks |
|
|
486 | (3) |
|
|
|
486 | (2) |
|
|
|
488 | (1) |
|
|
|
489 | (1) |
|
|
|
489 | (1) |
|
|
|
489 | (4) |
|
|
|
490 | (1) |
|
|
|
490 | (1) |
|
Signature-Based Network IDS |
|
|
490 | (3) |
|
Network Anomaly Detectors |
|
|
493 | (1) |
|
|
|
493 | (4) |
|
|
|
494 | (1) |
|
|
|
494 | (2) |
|
|
|
496 | (1) |
|
Intrusion Detection Systems |
|
|
497 | (1) |
|
|
|
497 | (2) |
|
|
|
499 | (2) |
|
Case Study: A Methodical Step-By-Step Penetration Test |
|
|
501 | (32) |
|
Case Study: LCN Gets Tested |
|
|
503 | (30) |
|
|
|
503 | (1) |
|
|
|
504 | (6) |
|
|
|
510 | (1) |
|
|
|
511 | (1) |
|
|
|
511 | (1) |
|
|
|
512 | (1) |
|
Gaining Access via the Website |
|
|
512 | (10) |
|
Gaining Access via Wireless |
|
|
522 | (2) |
|
|
|
524 | (1) |
|
|
|
524 | (1) |
|
|
|
524 | (1) |
|
|
|
525 | (1) |
|
|
|
525 | (1) |
|
|
|
525 | (1) |
|
|
|
525 | (1) |
|
|
|
526 | (1) |
|
|
|
526 | (1) |
|
|
|
526 | (1) |
|
|
|
527 | (1) |
|
|
|
527 | (3) |
|
Presenting and Planning the Follow-Up |
|
|
530 | (3) |
|
|
|
533 | (38) |
|
Appendix A Preparing a Security Policy |
|
|
535 | (12) |
|
|
|
547 | (24) |
| Glossary |
|
571 | (12) |
| Index |
|
583 | |