mirror of
https://github.com/swisskyrepo/PayloadsAllTheThings.git
synced 2025-01-22 11:18:50 +00:00
3b957de607
Add more examples and sections to `Insecure Deserialization/Python.md` and create a new test file `test_python_md.py`. * **Insecure Deserialization/Python.md**: - Add examples of vulnerable code snippets and their secure alternatives for `pickle` and `PyYAML`. - Include a section on common pitfalls and how to avoid them when using deserialization in Python. - Provide a list of tools and libraries that can help detect and prevent insecure deserialization in Python applications. - Add references to relevant documentation, articles, and research papers for further reading. - Include a section on how to test for insecure deserialization vulnerabilities in Python applications, including both manual and automated testing techniques. * **test_python_md.py**: - Import the `unittest` and `re` modules. - Create a test case that reads the `Insecure Deserialization/Python.md` file. - Extract the Python code blocks from the markdown file. - Execute each code block and check for any exceptions. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/swisskyrepo/PayloadsAllTheThings?shareId=XXXX-XXXX-XXXX-XXXX). |
||
---|---|---|
.. | ||
Files | ||
Images | ||
DotNET.md | ||
Java.md | ||
Node.md | ||
PHP.md | ||
Python.md | ||
README.md | ||
Ruby.md |
Insecure Deserialization
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
Deserialization Identifier
Check the following sub-sections, located in other chapters :
- Java deserialization : ysoserial, ...
- PHP (Object injection) : phpggc, ...
- Ruby : universal rce gadget, ...
- Python : pickle, ...
- YAML : PyYAML, ...
- .NET : ysoserial.net, ...
Object Type | Header (Hex) | Header (Base64) |
---|---|---|
Java Serialized | AC ED | rO |
.NET ViewState | FF 01 | /w |
Python Pickle | 80 04 95 | gASV |
PHP Serialized | 4F 3A | Tz |
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.
POP gadgets characteristics:
- Can be serialized
- Has public/accessible properties
- Implements specific vulnerable methods
- Has access to other "callable" classes
Labs
- PortSwigger - Modifying serialized objects
- PortSwigger - Modifying serialized data types
- PortSwigger - Using application functionality to exploit insecure deserialization
- PortSwigger - Arbitrary object injection in PHP
- PortSwigger - Exploiting Java deserialization with Apache Commons
- PortSwigger - Exploiting PHP deserialization with a pre-built gadget chain
- PortSwigger - Exploiting Ruby deserialization using a documented gadget chain
- PortSwigger - Developing a custom gadget chain for Java deserialization
- PortSwigger - Developing a custom gadget chain for PHP deserialization
- PortSwigger - Using PHAR deserialization to deploy a custom gadget chain
- NickstaDB - DeserLab