Insecure Deserialization: How to Find RCE-Class Bugs
Insecure deserialization happens when an application rebuilds objects from untrusted bytes without validating them. Because deserialization can invoke code paths during object construction, a crafted blob can escalate to logic tampering, authentication bypass, or full remote code execution.
It is a high-value class: when it lands, it often lands hard.
Recognize serialized data
Learn the fingerprints so you can spot serialized blobs in traffic:
- Java: base64 that decodes to bytes starting with
AC ED 00 05(rO0in base64) - PHP: strings like
O:4:"User":2:{...}in cookies or parameters - .NET:
ViewState,BinaryFormatter, or__VIEWSTATEblobs - Python: pickle streams (often base64), sometimes in caches or tokens
- Generic: unusually long opaque tokens in cookies, hidden fields, or headers
Any place an app stores “an object” client-side is a candidate.
Safe testing mindset
Deserialization exploits can be destructive, so tread carefully:
- First prove the app deserializes your input at all — tamper a byte and watch for a parse error versus normal handling.
- Prefer non-destructive proofs: trigger a detectable, harmless side effect (a controlled out-of-band DNS/HTTP callback to infrastructure you own) rather than running system commands blindly.
- Never run destructive commands, drop tables, or spawn shells on production. A single callback that proves code paths execute is enough for triage.
Always follow program rules; some forbid RCE PoCs beyond a benign marker.
From tampering to impact
Impact ladder, lowest to highest:
- The app errors differently on tampered objects (confirms deserialization)
- You alter object fields to change logic (privilege, price, role)
- A gadget chain in the app's libraries triggers an out-of-band callback
- Full RCE via a known gadget (demonstrate minimally, with permission)
Match your proof to the program's appetite. Many teams accept a benign callback as sufficient evidence.
Where it hides
- Session cookies that store objects instead of opaque IDs
- “Remember me” tokens and view state
- Message queues, caches, and inter-service payloads exposed to users
- File import features that accept serialized formats
Report structure
Show the serialized input, the tampering that proves deserialization, the callback or logic change, and the affected library/format. Recommend replacing native serialization with signed, schema-validated JSON, and enforcing allowlists on types.
Defensive checklist
- Never deserialize untrusted data with native formatters.
- Use plain data formats (JSON) with strict schema validation.
- Sign and verify any object the client holds, or store only opaque IDs server-side.
- Keep libraries patched to remove known gadget chains.
- Add integrity checks and type allowlists at the boundary.
Insecure deserialization rewards hunters who read raw tokens instead of ignoring them. Learn the byte signatures, prove execution safely, and you will find some of the highest-impact bugs on any program.
Original Bugflare guide informed by OWASP guidance on deserialization of untrusted data.