Foreword |
|
xix | |
Introduction |
|
xxi | |
Who This Book Is For |
|
xxiii | |
What Is In This Book |
|
xxii | |
Happy Hacking! |
|
xxiv | |
|
|
1 | (30) |
|
1 Picking A Bug Bounty Program |
|
|
3 | (12) |
|
The State of the Industry |
|
|
4 | (1) |
|
|
4 | (1) |
|
Social Sites and Applications |
|
|
5 | (1) |
|
|
5 | (1) |
|
Mobile Applications (Android, iOS, and Windows) |
|
|
6 | (1) |
|
|
6 | (1) |
|
Source Code and Executables |
|
|
7 | (1) |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
8 | (1) |
|
|
9 | (1) |
|
Scope, Payouts, and Response Times |
|
|
9 | (1) |
|
|
9 | (1) |
|
|
10 | (1) |
|
|
11 | (1) |
|
|
11 | (1) |
|
Choosing the Right Program |
|
|
12 | (1) |
|
A Quick Comparison of Popular Programs |
|
|
13 | (2) |
|
2 Sustaining Your Success |
|
|
15 | (16) |
|
|
16 | (1) |
|
Step 1 Craft a Descriptive Title |
|
|
16 | (1) |
|
Step 2 Provide a Clear Summary |
|
|
16 | (1) |
|
Step 3 Include a Severity Assessment |
|
|
16 | (2) |
|
Step 4 Give Clear Steps to Reproduce |
|
|
18 | (1) |
|
Step 5 Provide a Proof of Concept |
|
|
18 | (1) |
|
Step 6 Describe the Impact and Attack Scenarios |
|
|
19 | (1) |
|
Step 7 Recommend Possible Mitigations |
|
|
19 | (1) |
|
Step 8 Validate the Report |
|
|
20 | (1) |
|
Additional Tips for Writing Better Reports |
|
|
20 | (1) |
|
Building a Relationship with the Development Team |
|
|
21 | (1) |
|
Understanding Report States |
|
|
21 | (2) |
|
|
23 | (1) |
|
|
23 | (1) |
|
Understanding Why You're Failing |
|
|
24 | (1) |
|
Why You're Not Finding Bugs |
|
|
24 | (2) |
|
Why Your Reports Get Dismissed |
|
|
26 | (1) |
|
What to Do When You're Stuck |
|
|
27 | (1) |
|
|
28 | (1) |
|
Step 2 Build Your Skill Set |
|
|
28 | (1) |
|
Step 3 Gain a Fresh Perspective |
|
|
28 | (1) |
|
Lastly, a Few Words of Experience |
|
|
29 | (2) |
|
|
31 | (78) |
|
|
33 | (12) |
|
|
34 | (1) |
|
|
34 | (1) |
|
|
35 | (1) |
|
HTTP Requests and Responses |
|
|
36 | (2) |
|
Internet Security Controls |
|
|
38 | (1) |
|
|
38 | (1) |
|
Session Management and HTTP Cookies |
|
|
39 | (1) |
|
Token-Based Authentication |
|
|
40 | (1) |
|
|
41 | (2) |
|
|
43 | (1) |
|
|
44 | (1) |
|
4 Environmental Setup and Traffic Interception |
|
|
45 | (16) |
|
Choosing an Operating System |
|
|
46 | (1) |
|
Setting Up the Essentials: A Browser and a Proxy |
|
|
46 | (1) |
|
Opening the Embedded Browser |
|
|
47 | (1) |
|
|
47 | (2) |
|
|
49 | (2) |
|
|
51 | (1) |
|
|
52 | (2) |
|
|
54 | (2) |
|
|
56 | (1) |
|
|
57 | (1) |
|
|
58 | (1) |
|
|
58 | (1) |
|
A Final Note on Taking Notes |
|
|
58 | (3) |
|
5 Web Hacking Reconnaissance |
|
|
61 | (48) |
|
Manually Walking Through the Target |
|
|
62 | (1) |
|
|
62 | (3) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
70 | (1) |
|
|
71 | (3) |
|
|
74 | (1) |
|
|
75 | (2) |
|
Other Sneaky OSINT Techniques |
|
|
77 | (1) |
|
Tech Stack Fingerprinting |
|
|
78 | (2) |
|
Writing Your Own Recon Scripts |
|
|
80 | (1) |
|
Understanding Bash Scripting Basics |
|
|
80 | (3) |
|
Saving Tool Output to a File |
|
|
83 | (1) |
|
Adding the Date of the Scan to the Output |
|
|
84 | (1) |
|
Adding Options to Choose the Tools to Run |
|
|
84 | (1) |
|
|
85 | (3) |
|
|
88 | (2) |
|
|
90 | (2) |
|
Scanning Multiple Domains |
|
|
92 | (4) |
|
Writing a Function Library |
|
|
96 | (1) |
|
Building Interactive Programs |
|
|
97 | (3) |
|
Using Special Variables and Characters |
|
|
100 | (2) |
|
Scheduling Automatic Scans |
|
|
102 | (2) |
|
|
104 | (1) |
|
|
104 | (1) |
|
Tools Mentioned in This Chapter |
|
|
105 | (1) |
|
|
105 | (1) |
|
|
106 | (1) |
|
Tech Stack Fingerprinting |
|
|
106 | (1) |
|
|
107 | (2) |
|
PART III WEB VULNERABILITIES |
|
|
109 | (224) |
|
|
111 | (20) |
|
|
112 | (3) |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
116 | (1) |
|
|
117 | (1) |
|
|
117 | (2) |
|
|
119 | (1) |
|
|
119 | (1) |
|
|
120 | (1) |
|
Step 1 Look for Input Opportunities |
|
|
120 | (2) |
|
|
122 | (3) |
|
Step 3 Confirm the Impact |
|
|
125 | (1) |
|
|
126 | (1) |
|
Alternative JavaScript Syntax |
|
|
126 | (1) |
|
Capitalization and Encoding |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
128 | (1) |
|
|
129 | (1) |
|
|
129 | (2) |
|
|
131 | (12) |
|
|
131 | (2) |
|
|
133 | (1) |
|
Hunting for Open Redirects |
|
|
133 | (1) |
|
Step 1 Look for Redirect Parameters |
|
|
133 | (1) |
|
Step 2 Use Google Dorks to Find Additional Redirect Parameters |
|
|
134 | (1) |
|
Step 3 Test for Parameter-Based Open Redirects |
|
|
135 | (1) |
|
Step 4 Test for Referer-Based Open Redirects |
|
|
135 | (1) |
|
Bypassing Open-Redirect Protection |
|
|
136 | (1) |
|
Using Browser Autocorrect |
|
|
136 | (1) |
|
Exploiting Flawed Validator Logic |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
138 | (2) |
|
Combining Exploit Techniques |
|
|
140 | (1) |
|
|
140 | (1) |
|
Finding Your First Open Redirect! |
|
|
141 | (2) |
|
|
143 | (12) |
|
|
144 | (5) |
|
|
149 | (1) |
|
|
150 | (1) |
|
Step 1 Look for State-Changing Actions |
|
|
150 | (1) |
|
Step 2 Check the Response Headers |
|
|
151 | (1) |
|
Step 3 Confirm the Vulnerability |
|
|
151 | (1) |
|
|
151 | (2) |
|
|
153 | (1) |
|
A Note on Delivering the Clickjacking Payload |
|
|
154 | (1) |
|
Finding Your First Clickjacking Vulnerability! |
|
|
154 | (1) |
|
9 Cross-Site Request Forgery |
|
|
155 | (20) |
|
|
156 | (3) |
|
|
159 | (2) |
|
|
161 | (1) |
|
Step 1 Spot State-Changing Actions |
|
|
161 | (1) |
|
Step 2 Look for a Lack of CSRF Protections |
|
|
161 | (1) |
|
Step 3 Confirm the Vulnerability |
|
|
162 | (1) |
|
Bypassing CSRF Protection |
|
|
163 | (1) |
|
|
163 | (1) |
|
Change the Request Method |
|
|
164 | (1) |
|
Bypass CSRF Tokens Stored on the Server |
|
|
165 | (2) |
|
Bypass Double-Submit CSRF Tokens |
|
|
167 | (1) |
|
Bypass CSRF Referer Header Check |
|
|
168 | (2) |
|
Bypass CSRF Protection by Using XSS |
|
|
170 | (1) |
|
|
170 | (1) |
|
Leak User Information by Using CSRF |
|
|
170 | (1) |
|
Create Stored Self-XSS by Using CSRF |
|
|
171 | (1) |
|
Take Over User Accounts by Using CSRF |
|
|
172 | (1) |
|
Delivering the CSRF Payload |
|
|
173 | (1) |
|
|
174 | (1) |
|
10 Insecure Direct Object References |
|
|
175 | (12) |
|
|
175 | (2) |
|
|
177 | (1) |
|
|
178 | (1) |
|
Step 1 Create Two Accounts |
|
|
178 | (1) |
|
|
178 | (1) |
|
|
179 | (1) |
|
|
180 | (1) |
|
Bypassing IDOR Protection |
|
|
181 | (1) |
|
Encoded IDs and Hashed IDs |
|
|
181 | (1) |
|
|
182 | (1) |
|
Offer the Application an ID, Even If It Doesn't Ask for One |
|
|
182 | (1) |
|
Keep an Eye Out for Blind IDORs |
|
|
183 | (1) |
|
Change the Request Method |
|
|
183 | (1) |
|
Change the Requested File Type |
|
|
184 | (1) |
|
|
184 | (1) |
|
|
185 | (1) |
|
|
185 | (2) |
|
|
187 | (18) |
|
|
188 | (1) |
|
Injecting Code into SQL Queries |
|
|
189 | (2) |
|
Using Second-Order SQL Injections |
|
|
191 | (1) |
|
|
192 | (3) |
|
Hunting for SQL Injections |
|
|
195 | (1) |
|
Step 1 Look for Classic SQL Injections |
|
|
195 | (1) |
|
Step 2 Look for Blind SQL Injections |
|
|
196 | (2) |
|
Step 3 Exfiltrate Information by Using SQL Injections |
|
|
198 | (1) |
|
Step 4 Look for NoSQL Injections |
|
|
199 | (2) |
|
|
201 | (1) |
|
|
201 | (1) |
|
|
202 | (1) |
|
Automating SQL Injections |
|
|
202 | (1) |
|
Finding Your First SQL Injection! |
|
|
203 | (2) |
|
|
205 | (8) |
|
|
206 | (1) |
|
When a Race Condition Becomes a Vulnerability |
|
|
207 | (3) |
|
|
210 | (1) |
|
Hunting for Race Conditions |
|
|
210 | (1) |
|
Step 1 Find Features Prone to Race Conditions |
|
|
210 | (1) |
|
Step 2 Send Simultaneous Requests |
|
|
210 | (1) |
|
|
211 | (1) |
|
Step 4 Create a Proof of Concept |
|
|
211 | (1) |
|
Escalating Race Conditions |
|
|
212 | (1) |
|
Finding Your First Race Condition! |
|
|
212 | (1) |
|
13 Server-Side Request Forgery |
|
|
213 | (18) |
|
|
213 | (2) |
|
|
215 | (1) |
|
|
216 | (1) |
|
Step 1 Spot Features Prone to SSRFs |
|
|
216 | (2) |
|
Step 2 Provide Potentially Vulnerable Endpoints with Internal URLs |
|
|
218 | (1) |
|
|
218 | (2) |
|
Bypassing SSRF Protection |
|
|
220 | (1) |
|
|
220 | (1) |
|
|
221 | (3) |
|
|
224 | (1) |
|
|
224 | (2) |
|
|
226 | (1) |
|
|
227 | (1) |
|
|
228 | (1) |
|
|
229 | (2) |
|
14 Insecure Deserialization |
|
|
231 | (16) |
|
|
232 | (1) |
|
|
232 | (9) |
|
|
241 | (3) |
|
|
244 | (1) |
|
Hunting for Insecure Deserialization |
|
|
244 | (1) |
|
|
245 | (1) |
|
Finding Your First Insecure Deserialization! |
|
|
246 | (1) |
|
|
247 | (14) |
|
|
247 | (2) |
|
|
249 | (1) |
|
|
250 | (1) |
|
Step 1 Find XML Data Entry Points |
|
|
250 | (1) |
|
Step 2 Test for Classic XXE |
|
|
251 | (1) |
|
Step 3 Test for Blind XXE |
|
|
252 | (1) |
|
Step 4 Embed XXE Payloads in Different File Types |
|
|
253 | (1) |
|
Step 5 Test for Xlnclude Attacks |
|
|
254 | (1) |
|
|
254 | (1) |
|
|
255 | (1) |
|
|
255 | (1) |
|
|
256 | (2) |
|
Performing Denial-of-Service Attacks |
|
|
258 | (1) |
|
More About Data Exfiltration Using XXEs |
|
|
259 | (1) |
|
|
260 | (1) |
|
|
261 | (14) |
|
|
262 | (1) |
|
|
262 | (1) |
|
|
263 | (2) |
|
|
265 | (1) |
|
Hunting for Template Injection |
|
|
266 | (1) |
|
Step 1 Look for User-Input Locations |
|
|
266 | (1) |
|
Step 2 Detect Template Injection by Submitting Test Payloads |
|
|
266 | (2) |
|
Step 3 Determine the Template Engine in Use |
|
|
268 | (1) |
|
|
268 | (1) |
|
Searching for System Access via Python Code |
|
|
269 | (1) |
|
Escaping the Sandbox by Using Python Built-in Functions |
|
|
270 | (3) |
|
Submitting Payloads for Testing |
|
|
273 | (1) |
|
Automating Template Injection |
|
|
273 | (1) |
|
Finding Your First Template Injection! |
|
|
274 | (1) |
|
17 Application Logic Errors And Broken Access Control |
|
|
275 | (8) |
|
|
276 | (2) |
|
|
278 | (1) |
|
|
278 | (1) |
|
Directory Traversal Vulnerabilities |
|
|
279 | (1) |
|
|
279 | (1) |
|
Hunting for Application Logic Errors and Broken Access Control |
|
|
280 | (1) |
|
Step 1 Learn About Your Target |
|
|
280 | (1) |
|
Step 2 Intercept Requests While Browsing |
|
|
280 | (1) |
|
Step 3 Think Outside the Box |
|
|
280 | (1) |
|
|
281 | (1) |
|
Finding Your First Application Logic Error or Broken Access Control! |
|
|
281 | (2) |
|
|
283 | (12) |
|
|
284 | (1) |
|
|
284 | (2) |
|
|
286 | (1) |
|
|
287 | (1) |
|
|
288 | (1) |
|
Step 1 Gather Information About the Target |
|
|
289 | (1) |
|
Step 2 Identify Suspicious User Input Locations |
|
|
289 | (1) |
|
Step 3 Submit Test Payloads |
|
|
289 | (1) |
|
Step 4 Confirm the Vulnerability |
|
|
290 | (1) |
|
|
291 | (1) |
|
|
291 | (2) |
|
|
293 | (2) |
|
19 Same-Origin Policy Vulnerabilities |
|
|
295 | (12) |
|
|
296 | (1) |
|
Exploiting Cross-Origin Resource Sharing |
|
|
297 | (1) |
|
|
298 | (2) |
|
Exploiting JSON with Padding |
|
|
300 | (2) |
|
Bypassing SOP by Using XSS |
|
|
302 | (1) |
|
|
302 | (1) |
|
Step 1 Determine If SOP Relaxation Techniques Are Used |
|
|
302 | (1) |
|
Step 2 Find CORS Misconfiguration |
|
|
303 | (1) |
|
Step 3 Find postMessage Bugs |
|
|
304 | (1) |
|
|
305 | (1) |
|
Step 5 Consider Mitigating Factors |
|
|
305 | (1) |
|
|
305 | (1) |
|
Finding Your First SOP Bypass Vulnerability! |
|
|
306 | (1) |
|
20 Single-Sign-On Security Issues |
|
|
307 | (16) |
|
|
308 | (1) |
|
|
308 | (1) |
|
Security Assertion Markup Language |
|
|
309 | (3) |
|
|
312 | (4) |
|
Hunting for Subdomain Takeovers |
|
|
316 | (1) |
|
Step 1 List the Target's Subdomains |
|
|
316 | (1) |
|
Step 2 Find Unregistered Pages |
|
|
316 | (1) |
|
|
317 | (1) |
|
Monitoring for Subdomain Takeovers |
|
|
318 | (1) |
|
Hunting for SAML Vulnerabilities |
|
|
319 | (1) |
|
Step 1 Locate the SAML Response |
|
|
319 | (1) |
|
Step 2 Analyze the Response Fields |
|
|
319 | (1) |
|
Step 3 Bypass the Signature |
|
|
319 | (1) |
|
Step 4 Re-encode the Message |
|
|
320 | (1) |
|
Hunting for OAuth Token Theft |
|
|
320 | (1) |
|
|
321 | (1) |
|
Finding Your First SSO Bypass! |
|
|
321 | (2) |
|
21 Information Disclosure |
|
|
323 | (10) |
|
|
324 | (1) |
|
|
324 | (1) |
|
Hunting for Information Disclosure |
|
|
325 | (1) |
|
Step 1 Attempt a Path Traversal Attack |
|
|
325 | (1) |
|
Step 2 Search the Wayback Machine |
|
|
326 | (1) |
|
Step 3 Search Paste Dump Sites |
|
|
327 | (1) |
|
Step 4 Reconstruct Source Code from an Exposed .git Directory |
|
|
328 | (3) |
|
Step 5 Find Information in Public Files |
|
|
331 | (1) |
|
|
332 | (1) |
|
Finding Your First Information Disclosure! |
|
|
332 | (1) |
|
PART IV EXPERT TECHNIQUES |
|
|
333 | (48) |
|
22 Conducting Code Reviews |
|
|
335 | (12) |
|
White-Box vs. Black-Box Testing |
|
|
336 | (1) |
|
The Fast Approach: grep Is Your Best Friend |
|
|
336 | (1) |
|
|
336 | (2) |
|
Leaked Secrets and Weak Encryption |
|
|
338 | (2) |
|
New Patches and Outdated Dependencies |
|
|
340 | (1) |
|
|
340 | (1) |
|
Debug Functionalities, Configuration Files, and Endpoints |
|
|
340 | (1) |
|
|
341 | (1) |
|
|
341 | (1) |
|
|
342 | (2) |
|
Exercise: Spot the Vulnerabilities |
|
|
344 | (3) |
|
|
347 | (8) |
|
Setting Up Your Mobile Proxy |
|
|
348 | (1) |
|
Bypassing Certificate Pinning |
|
|
349 | (1) |
|
|
350 | (1) |
|
|
351 | (1) |
|
|
351 | (1) |
|
|
352 | (1) |
|
|
352 | (1) |
|
|
353 | (1) |
|
Mobile Security Framework |
|
|
353 | (1) |
|
Hunting for Vulnerabilities |
|
|
353 | (2) |
|
|
355 | (14) |
|
|
355 | (2) |
|
|
357 | (1) |
|
|
358 | (1) |
|
|
358 | (3) |
|
|
361 | (1) |
|
Hunting for API Vulnerabilities |
|
|
362 | (1) |
|
|
362 | (2) |
|
Testing for Broken Access Control and Info Leaks |
|
|
364 | (1) |
|
Testing for Rate-Limiting Issues |
|
|
365 | (1) |
|
Testing for Technical Bugs |
|
|
366 | (3) |
|
25 Automatic Vulnerability Discovery Using Fuzzers |
|
|
369 | (12) |
|
|
370 | (1) |
|
|
370 | (1) |
|
|
371 | (1) |
|
Step 1 Determine the Data Injection Points |
|
|
371 | (1) |
|
Step 2 Decide on the Payload List |
|
|
372 | (1) |
|
|
372 | (2) |
|
Step 4 Monitor the Results |
|
|
374 | (1) |
|
|
374 | (1) |
|
|
374 | (2) |
|
Brute-Forcing Authentication |
|
|
376 | (1) |
|
Testing for Common Web Vulnerabilities |
|
|
377 | (1) |
|
|
378 | (1) |
|
Fuzzing vs. Static Analysis |
|
|
378 | (1) |
|
|
378 | (1) |
|
Adding to Your Automated Testing Toolkit |
|
|
379 | (2) |
Index |
|
381 | |