Introduction |
|
xxv | |
Assessment Test |
|
lvi | |
Chapter 1 Penetration Testing |
|
1 | (30) |
|
What Is Penetration Testing? |
|
|
2 | (3) |
|
|
2 | (2) |
|
Adopting the Hacker Mind-Set |
|
|
4 | (1) |
|
Reasons for Penetration Testing |
|
|
5 | (3) |
|
Benefits of Penetration Testing |
|
|
5 | (1) |
|
Regulatory Requirements for Penetration Testing |
|
|
6 | (2) |
|
Who Performs Penetration Tests? |
|
|
8 | (2) |
|
Internal Penetration Testing Teams |
|
|
8 | (1) |
|
External Penetration Testing Teams |
|
|
9 | (1) |
|
Selecting Penetration Testing Teams |
|
|
9 | (1) |
|
The CompTIA Penetration Testing Process |
|
|
10 | (3) |
|
|
11 | (1) |
|
Information Gathering and Vulnerability Identification |
|
|
11 | (1) |
|
|
12 | (1) |
|
Reporting and Communicating Results |
|
|
13 | (1) |
|
|
13 | (4) |
|
|
15 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
16 | (1) |
|
|
16 | (1) |
|
|
16 | (1) |
|
|
17 | (1) |
|
|
17 | (6) |
|
|
19 | (1) |
|
|
20 | (1) |
|
|
21 | (1) |
|
|
21 | (1) |
|
|
21 | (1) |
|
|
22 | (1) |
|
|
22 | (1) |
|
|
23 | (1) |
|
|
23 | (1) |
|
|
23 | (1) |
|
|
24 | (1) |
|
|
25 | (1) |
|
Activity 1.1: Adopting the Hacker Mind-Set |
|
|
25 | (1) |
|
Activity 1.2: Using the Cyber Kill Chain |
|
|
25 | (1) |
|
|
26 | (5) |
Chapter 2 Planning and Scoping Penetration Tests |
|
31 | (26) |
|
Scoping and Planning Engagements |
|
|
35 | (10) |
|
|
36 | (1) |
|
White Box, Black Box, or Gray Box? |
|
|
36 | (2) |
|
|
38 | (2) |
|
Scoping Considerations: A Deeper Dive |
|
|
40 | (2) |
|
Support Resources for Penetration Tests |
|
|
42 | (3) |
|
Key Legal Concepts for Penetration Tests |
|
|
45 | (3) |
|
|
45 | (1) |
|
Data Ownership and Retention |
|
|
46 | (1) |
|
|
46 | (1) |
|
Environmental Differences |
|
|
46 | (2) |
|
Understanding Compliance-Based Assessments |
|
|
48 | (2) |
|
|
50 | (1) |
|
|
51 | (1) |
|
|
52 | (1) |
|
|
53 | (4) |
Chapter 3 Information Gathering |
|
57 | (42) |
|
Footprinting and Enumeration |
|
|
60 | (14) |
|
|
61 | (3) |
|
Location and Organizational Data |
|
|
64 | (3) |
|
Infrastructure and Networks |
|
|
67 | (5) |
|
|
72 | (2) |
|
Active Reconnaissance and Enumeration |
|
|
74 | (15) |
|
|
75 | (1) |
|
|
75 | (6) |
|
Networks, Topologies, and Network Traffic |
|
|
81 | (2) |
|
Packet Crafting and Inspection |
|
|
83 | (1) |
|
|
84 | (4) |
|
Information Gathering and Code |
|
|
88 | (1) |
|
Information Gathering and Defenses |
|
|
89 | (1) |
|
Defenses Against Active Reconnaissance |
|
|
90 | (1) |
|
Preventing Passive Information Gathering |
|
|
90 | (1) |
|
|
90 | (1) |
|
|
91 | (1) |
|
|
92 | (2) |
|
Activity 3.1: Manual OSINT Gathering |
|
|
92 | (1) |
|
Activity 3.2: Exploring Shodan |
|
|
93 | (1) |
|
Activity 3.3: Running a Nessus Scan |
|
|
93 | (1) |
|
|
94 | (5) |
Chapter 4 Vulnerability Scanning |
|
99 | (38) |
|
Identifying Vulnerability Management Requirements |
|
|
102 | (7) |
|
|
102 | (4) |
|
|
106 | (1) |
|
Support for Penetration Testing |
|
|
106 | (1) |
|
|
106 | (1) |
|
Determining Scan Frequency |
|
|
107 | (2) |
|
Configuring and Executing Vulnerability Scans |
|
|
109 | (10) |
|
Scoping Vulnerability Scans |
|
|
110 | (1) |
|
Configuring Vulnerability Scans |
|
|
111 | (6) |
|
|
117 | (2) |
|
Software Security Testing |
|
|
119 | (6) |
|
Analyzing and Testing Code |
|
|
120 | (1) |
|
Web Application Vulnerability Scanning |
|
|
121 | (4) |
|
Developing a Remediation Workflow |
|
|
125 | (2) |
|
|
126 | (1) |
|
Testing and Implementing Fixes |
|
|
127 | (1) |
|
Overcoming Barriers to Vulnerability Scanning |
|
|
127 | (2) |
|
|
129 | (1) |
|
|
129 | (1) |
|
|
130 | (2) |
|
Activity 4.1: Installing a Vulnerability Scanner |
|
|
130 | (1) |
|
Activity 4.2: Running a Vulnerability Scan |
|
|
130 | (1) |
|
Activity 4.3: Developing a Penetration Test Vulnerability Scanning Plan |
|
|
131 | (1) |
|
|
132 | (5) |
Chapter 5 Analyzing Vulnerability Scans |
|
137 | (44) |
|
Reviewing and Interpreting Scan Reports |
|
|
138 | (9) |
|
|
142 | (5) |
|
|
147 | (3) |
|
|
147 | (1) |
|
|
147 | (1) |
|
Understanding Informational Results |
|
|
148 | (1) |
|
Reconciling Scan Results with Other Data Sources |
|
|
149 | (1) |
|
|
149 | (1) |
|
|
150 | (22) |
|
Server and Endpoint Vulnerabilities |
|
|
151 | (10) |
|
|
161 | (6) |
|
Virtualization Vulnerabilities |
|
|
167 | (2) |
|
|
169 | (1) |
|
Web Application Vulnerabilities |
|
|
170 | (2) |
|
|
172 | (1) |
|
|
173 | (1) |
|
|
174 | (2) |
|
Activity 5.1: Interpreting a Vulnerability Scan |
|
|
174 | (1) |
|
Activity 5.2: Analyzing a CVSS Vector |
|
|
174 | (1) |
|
Activity 5.3: Developing a Penetration Testing Plan |
|
|
175 | (1) |
|
|
176 | (5) |
Chapter 6 Exploit and Pivot |
|
181 | (42) |
|
|
184 | (7) |
|
|
184 | (1) |
|
Identifying the Right Exploit |
|
|
185 | (3) |
|
|
188 | (1) |
|
|
189 | (2) |
|
|
191 | (8) |
|
|
192 | (6) |
|
|
198 | (1) |
|
|
199 | (5) |
|
|
199 | (1) |
|
|
199 | (1) |
|
|
199 | (1) |
|
|
200 | (1) |
|
Scheduled Tasks and cron Jobs |
|
|
200 | (1) |
|
|
201 | (1) |
|
|
202 | (1) |
|
|
203 | (1) |
|
|
203 | (1) |
|
|
203 | (1) |
|
|
203 | (1) |
|
|
204 | (1) |
|
|
204 | (5) |
|
Common Post-Exploit Attacks |
|
|
204 | (3) |
|
|
207 | (1) |
|
|
208 | (1) |
|
|
209 | (2) |
|
Scheduled Jobs and Scheduled Tasks |
|
|
209 | (1) |
|
|
210 | (1) |
|
|
210 | (1) |
|
|
210 | (1) |
|
|
211 | (1) |
|
|
211 | (1) |
|
|
212 | (1) |
|
|
213 | (1) |
|
|
214 | (1) |
|
|
215 | (2) |
|
|
215 | (1) |
|
|
215 | (1) |
|
|
216 | (1) |
|
|
217 | (6) |
Chapter 7 Exploiting Network Vulnerabilities |
|
223 | (36) |
|
Conducting Network Exploits |
|
|
226 | (10) |
|
|
226 | (2) |
|
|
228 | (1) |
|
|
228 | (1) |
|
|
229 | (4) |
|
|
233 | (1) |
|
DoS Attacks and Stress Testing |
|
|
234 | (2) |
|
Exploiting Windows Services |
|
|
236 | (4) |
|
NetBIOS Name Resolution Exploits |
|
|
236 | (4) |
|
|
240 | (1) |
|
Exploiting Common Services |
|
|
240 | (5) |
|
|
241 | (1) |
|
|
242 | (1) |
|
|
243 | (1) |
|
|
244 | (1) |
|
|
245 | (5) |
|
Evil Twins and Wireless MITM |
|
|
245 | (2) |
|
Other Wireless Protocols and Systems |
|
|
247 | (1) |
|
|
248 | (1) |
|
|
249 | (1) |
|
|
249 | (1) |
|
|
250 | (1) |
|
|
251 | (1) |
|
|
251 | (3) |
|
Activity 7.1: Capturing Hashes |
|
|
251 | (1) |
|
Activity 7.2: Brute-Forcing Services |
|
|
252 | (1) |
|
Activity 7.3: Wireless Testing |
|
|
253 | (1) |
|
|
254 | (5) |
Chapter 8 Exploiting Physical and Social Vulnerabilities |
|
259 | (24) |
|
Physical Facility Penetration Testing |
|
|
262 | (4) |
|
|
262 | (4) |
|
|
266 | (1) |
|
|
266 | (7) |
|
In-Person Social Engineering |
|
|
267 | (2) |
|
|
269 | (1) |
|
|
270 | (1) |
|
Using Social Engineering Tools |
|
|
270 | (3) |
|
|
273 | (1) |
|
|
274 | (1) |
|
|
275 | (3) |
|
Activity 8.1: Designing a Physical Penetration Test |
|
|
275 | (1) |
|
Activity 8.2: Brute-Forcing Services |
|
|
276 | (1) |
|
|
276 | (2) |
|
|
278 | (5) |
Chapter 9 Exploiting Application Vulnerabilities |
|
283 | (38) |
|
Exploiting Injection Vulnerabilities |
|
|
287 | (6) |
|
|
287 | (1) |
|
Web Application Firewalls |
|
|
288 | (1) |
|
|
289 | (3) |
|
|
292 | (1) |
|
Command Injection Attacks |
|
|
293 | (1) |
|
Exploiting Authentication Vulnerabilities |
|
|
293 | (6) |
|
|
294 | (1) |
|
|
295 | (3) |
|
|
298 | (1) |
|
Exploiting Authorization Vulnerabilities |
|
|
299 | (3) |
|
Insecure Direct Object References |
|
|
299 | (1) |
|
|
300 | (1) |
|
|
301 | (1) |
|
Exploiting Web Application Vulnerabilities |
|
|
302 | (4) |
|
Cross-Site Scripting (XSS) |
|
|
302 | (3) |
|
Cross-Site Request Forgery (CSRF/XSRF) |
|
|
305 | (1) |
|
|
305 | (1) |
|
Unsecure Coding Practices |
|
|
306 | (2) |
|
|
306 | (1) |
|
|
306 | (1) |
|
|
307 | (1) |
|
|
308 | (1) |
|
|
308 | (1) |
|
|
308 | (1) |
|
Application Testing Tools |
|
|
308 | (5) |
|
Static Application Security Testing (SAST) |
|
|
309 | (1) |
|
Dynamic Application Security Testing (DAST) |
|
|
310 | (3) |
|
|
313 | (1) |
|
|
313 | (1) |
|
|
313 | (1) |
|
|
314 | (2) |
|
Activity 9.1: Application Security Testing Techniques |
|
|
314 | (1) |
|
Activity 9.2: Using the ZAP Proxy |
|
|
314 | (1) |
|
Activity 9.3: Creating a Cross-Site Scripting Vulnerability |
|
|
315 | (1) |
|
|
316 | (5) |
Chapter 10 Exploiting Host Vulnerabilities |
|
321 | (42) |
|
|
325 | (15) |
|
|
325 | (6) |
|
|
331 | (7) |
|
|
338 | (2) |
|
|
340 | (2) |
|
|
340 | (1) |
|
|
341 | (1) |
|
|
341 | (1) |
|
Metasploit and Remote Access |
|
|
342 | (1) |
|
Attacking Virtual Machines and Containers |
|
|
342 | (3) |
|
|
343 | (1) |
|
|
344 | (1) |
|
|
345 | (2) |
|
|
345 | (1) |
|
|
345 | (1) |
|
JTAG Debug Pins and Ports |
|
|
346 | (1) |
|
|
347 | (1) |
|
|
348 | (4) |
|
|
348 | (1) |
|
Offline Password Cracking |
|
|
349 | (1) |
|
Credential Testing and Brute-Forcing Tools |
|
|
350 | (1) |
|
Wordlists and Dictionaries |
|
|
351 | (1) |
|
|
352 | (1) |
|
|
353 | (1) |
|
|
354 | (4) |
|
Activity 10.1: Dumping and Cracking the Windows SAM and Other Credentials |
|
|
354 | (1) |
|
Activity 10.2: Cracking Passwords Using Hashcat |
|
|
355 | (1) |
|
Activity 10.3: Setting Up a Reverse Shell and a Bind Shell |
|
|
356 | (2) |
|
|
358 | (5) |
Chapter 11 Scripting for Penetration Testing |
|
363 | (42) |
|
Scripting and Penetration Testing |
|
|
364 | (4) |
|
|
365 | (1) |
|
|
366 | (1) |
|
|
367 | (1) |
|
|
368 | (1) |
|
Variables, Arrays, and Substitutions |
|
|
368 | (4) |
|
|
370 | (1) |
|
|
371 | (1) |
|
|
371 | (1) |
|
|
372 | (1) |
|
|
372 | (1) |
|
|
373 | (5) |
|
|
375 | (1) |
|
|
376 | (1) |
|
|
377 | (1) |
|
|
378 | (1) |
|
|
378 | (16) |
|
|
379 | (5) |
|
|
384 | (5) |
|
|
389 | (5) |
|
|
394 | (1) |
|
Redirecting Standard Input and Output |
|
|
394 | (1) |
|
|
395 | (2) |
|
|
395 | (1) |
|
|
396 | (1) |
|
|
396 | (1) |
|
|
396 | (1) |
|
|
397 | (1) |
|
|
397 | (1) |
|
|
398 | (1) |
|
Activity 11.1: Reverse DNS Lookups |
|
|
398 | (1) |
|
|
398 | (1) |
|
|
399 | (6) |
Chapter 12 Reporting and Communication |
|
405 | (20) |
|
The Importance of Communication |
|
|
408 | (1) |
|
Defining a Communication Path |
|
|
408 | (1) |
|
|
408 | (1) |
|
|
409 | (1) |
|
Recommending Mitigation Strategies |
|
|
409 | (6) |
|
Finding: Shared Local Administrator Credentials |
|
|
411 | (1) |
|
Finding: Weak Password Complexity |
|
|
411 | (2) |
|
Finding: Plain Text Passwords |
|
|
413 | (1) |
|
Finding: No Multifactor Authentication |
|
|
413 | (1) |
|
|
414 | (1) |
|
Finding: Unnecessary Open Services |
|
|
415 | (1) |
|
Writing a Penetration Testing Report |
|
|
415 | (3) |
|
Structuring the Written Report |
|
|
415 | (2) |
|
Secure Handling and Disposition of Reports |
|
|
417 | (1) |
|
Wrapping Up the Engagement |
|
|
418 | (2) |
|
|
418 | (1) |
|
|
419 | (1) |
|
|
419 | (1) |
|
Follow-Up Actions/Retesting |
|
|
419 | (1) |
|
|
419 | (1) |
|
|
420 | (1) |
|
|
420 | (1) |
|
|
421 | (1) |
|
Activity 12.1: Remediation Strategies |
|
|
421 | (1) |
|
Activity 12.2: Report Writing |
|
|
421 | (1) |
|
|
422 | (3) |
Appendix Answers to Review Questions |
|
425 | (22) |
|
Chapter 1: Penetration Testing |
|
|
426 | (1) |
|
Chapter 2: Planning and Scoping Penetration Tests |
|
|
427 | (2) |
|
Chapter 3: Information Gathering |
|
|
429 | (2) |
|
Chapter 4: Vulnerability Scanning |
|
|
431 | (2) |
|
Chapter 5: Analyzing Vulnerability Scans |
|
|
433 | (1) |
|
Chapter 6: Exploit and Pivot |
|
|
434 | (2) |
|
Chapter 7: Exploiting Network Vulnerabilities |
|
|
436 | (2) |
|
Chapter 8: Exploiting Physical and Social Vulnerabilities |
|
|
438 | (2) |
|
Chapter 9: Exploiting Application Vulnerabilities |
|
|
440 | (2) |
|
Chapter 10: Exploiting Host Vulnerabilities |
|
|
442 | (2) |
|
Chapter 11: Script for Penetration Testing |
|
|
444 | (1) |
|
Chapter 12: Reporting and Communication |
|
|
445 | (2) |
Index |
|
447 | |