Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Insecure Deserialization

Direct answer

Insecure deserialization turns untrusted serialized data back into objects in a way that lets attackers run code or change logic. Avoid native deserialization of user input; use JSON with strict schemas.

When to use this

Use this when applications deserialize untrusted data.

First 30 seconds

1. Insecure deserialization can lead to remote code execution.

2. Never deserialize untrusted data with native formats.

3. Use JSON + schemas.

4. Sign data if needed.

5. Patch libraries.

Operational verification

untrusted data → safe parser/validation → objects

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Deserialising cookies, ViewState or cache data without signing (ASP.NET ViewState MAC disabled).
  • Allow-listing classes too broadly.
  • Gadget chains in common libraries (Commons Collections) present on the classpath.
  • Assuming JSON is always safe — polymorphic type handling (Jackson enableDefaultTyping) brings the same risk.
Platform / version applicability
Security architecture and operations
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformSecurity architecture and operations
Scope / prerequisiteUse this when applications deserialize untrusted data.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Insecure deserialization can lead to code execution.
  • Avoid native deserialization of untrusted input.
  • Use JSON with strict schemas.
Key checks
  • Code review: pickle/ObjectInputStream/unserialize on untrusted data — unsafe deserialization
  • Use JSON with schema validation — safe formats
  • Dependency scan for gadget libraries — known issues
ReferenceWhy it matters1 section · depth on demand

Defences

  • Do not deserialize untrusted data with native formats (Java serialization, Python pickle, PHP unserialize, .NET BinaryFormatter).
  • Use simple data formats (JSON) with schema validation.
  • If unavoidable: sign the data (HMAC) and verify before deserializing, and restrict allowed classes.

Many remote code execution vulnerabilities in Java applications came from deserialization gadget chains.

ReferenceHow it works1 section · depth on demand

In depth

Insecure deserialisation occurs when an application converts untrusted serialised data back into objects using formats that can instantiate arbitrary types — Java serialisation, .NET BinaryFormatter, Python pickle, PHP unserialize, unsafe YAML loaders. Attackers can trigger code execution through gadget chains in available libraries.

Prevention:

PracticeDetail
Do not deserialise untrusted data with native object formatsUse JSON with explicit schemas
Use safe loadersyaml.safe_load, not yaml.load
Allow-list classesJava serialisation filters (JEP 290)
Sign/verify serialised dataIf it must round-trip through clients
Remove dangerous APIsBinaryFormatter is obsolete in .NET
Keep libraries patchedGadget chains often live in common libraries
ReferenceImportant terms & boundaries1 section · depth on demand
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docSecurity architecture and operations current

Authoritative/upstream documentation reviewed for bounded claims in Web Security → Insecure Deserialization. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://owasp.org/www-project-application-security-verification-standard/ · confidence 94%
Confirmation

Confirm action

Continue?