Object graph deserialization is the process of rebuilding an interconnected set of objects from a serialised representation. In security terms, unsafe deserialisation can let attacker-controlled data instantiate unexpected objects or trigger code paths during object construction, which can lead to execution or logic abuse.
What object graph deserialization is
Object graph deserialization rebuilds interconnected objects from a serialized payload, restoring references, nesting and state. In security work, the concern is not the reconstruction itself, but what happens if the loader trusts attacker-controlled input enough to create unexpected objects or invoke unsafe construction paths.
Why unsafe deserialization is dangerous
Unsafe deserialization becomes dangerous when the parser accepts untrusted data as if it were a benign application state snapshot. That can let an attacker influence which classes are instantiated, which setters or callbacks run, and which validation or business logic is reached during object creation.
The practical security issue is that object graphs often contain more behaviour than defenders expect. A payload can exploit gadget chains, polymorphic type handling, or weak allowlists to move from “data parsing” into code execution, logic abuse, or application state manipulation.
Common exposure patterns
Exposure usually appears where applications deserialize data from users, APIs, queues, caches, cookies, file uploads, or cross-service messages without strict type control. Risk increases when the format supports embedded type metadata, reflective loading, or complex framework objects that were never intended to be reconstructed from untrusted sources.
Different ecosystems fail in different ways, but the pattern is consistent: the application assumes serialized input is merely data, while the runtime can interpret it as instructions for object creation. That gap is why deserialization flaws are often severe even when the original feature was designed for convenience or performance.
What secure handling should preserve
Secure handling should preserve a narrow contract for what may be rebuilt, how type information is interpreted, and which classes or fields are allowed to participate in deserialization. Where possible, the safer design is to avoid general-purpose object reconstruction for untrusted input and use fixed schemas or explicit decoding paths instead.
When object graphs must be restored, defenders should treat the deserializer as a security boundary, not a neutral library call. Controls such as strict allowlists, safe defaults, reduced gadget surface, and language-specific hardening reduce the chance that reconstruction becomes code execution or integrity loss.
Risk and Threat Considerations
Unsafe object graph deserialization is risky because a single crafted payload can trigger unexpected object construction, bypass intended business rules, or activate library behaviour that was never meant to run on untrusted input. The danger is highest when the deserializer can reach rich framework objects, legacy serialization formats, or code paths with side effects.
Failure mechanism: Attackers supply a serialized payload that steers the runtime into instantiating dangerous objects or chaining benign components into harmful behaviour, such as remote code execution, state corruption, or logic abuse.
Impact: Successful exploitation can lead to full application compromise, unauthorized actions under the application’s privileges, data exposure, or persistent integrity damage that remains difficult to distinguish from normal program behaviour.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V1 — Encoding and Sanitization | Covers safe handling of untrusted input before object reconstruction. |
| Recommendation — Validate and constrain serialized input before it reaches object construction logic. | ||
| NIST SP 800-53 Rev 5 | SI-10 — Information Input Validation | Requires validating untrusted inputs that can drive unsafe deserialization paths. |
| SI-7 — Software, Firmware, and Information Integrity | Supports integrity checks and safe handling for code paths that may be reached during deserialization. | |
| Recommendation — Apply input validation to reject serialized data that does not match expected structure. Protect deserialization-related code paths with integrity controls and trusted loading rules. | ||
| ISO/IEC 27001:2022 | A.8.25 — Secure development life cycle | Requires secure design choices that reduce deserialization attack surface during development. |
| Recommendation — Design serializers and loaders to avoid unsafe object reconstruction from untrusted data. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Addresses secure software design and prevention of unsafe parser and deserializer behaviour. |
| Recommendation — Harden application components that deserialize untrusted data. | ||
Practitioner Guidance
Why practitioners should care: Treat deserialization as a trust decision, not a convenience feature. The most reliable security improvement is to minimise or eliminate untrusted object reconstruction, especially where the runtime supports polymorphism, reflection, or framework-managed callbacks.
What to watch for: Review any path that accepts serialized objects from users, services, brokers, or stored state, and check whether the format can express types, class names, or embedded object behaviour. If the answer is yes, validate that the loader is constrained by an explicit contract rather than runtime inference.
Practitioner takeaway: The safest design is usually to deserialize only known shapes and keep the object graph as simple as possible, because complexity expands the attack surface long before an exploit becomes visible.
Related resources from NHI Mgmt Group
- What breaks when AI output is allowed to drive object deserialization?
- How should organisations compare raw JSON handling and eager object deserialization in workflow systems?
- What is the difference between safe data serialization and object deserialization in AI service design?
- How should organisations reduce risk if PHP object deserialization cannot be removed immediately?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 29, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org