Hessian2 is a compact binary serialisation format used to encode Java objects and remote procedure call messages. It supports typed values and object graphs, which makes it efficient for network transport but also means deserialising untrusted data can create security risk if classes and inputs are not tightly controlled.
What Hessian2 Is and Why It Matters
Hessian2 is a compact binary serialisation format for Java objects and remote procedure call messages. Its main value is efficiency over the wire, but that same flexibility means the data being decoded can carry type information and nested object structures that must be treated as untrusted until proven safe.
How Hessian2 Encodes Data
Unlike text formats such as JSON, Hessian2 is designed for dense machine-to-machine transport. It can represent primitive values, strings, lists, maps, typed objects and object graphs in a form that is smaller and often faster to parse, especially in Java-centric systems.
That efficiency is useful in RPC middleware and service integrations, but it also means the decoder has to interpret more than raw bytes. Type markers, class references and object links all influence how the receiving application reconstructs the message.
Security Implications of Deserialisation
The security issue is not the format itself, but what happens when an application deserialises data from an untrusted source. If the receiver accepts attacker-controlled payloads without strict class whitelisting, input validation or safe deserialisation controls, the payload may trigger unexpected object construction, logic abuse or gadget-based exploitation.
For Java ecosystems, this class of weakness is especially sensitive because deserialisation can become a code-execution or privilege-abuse path when unsafe classes are available on the classpath. The practical rule is simple: any endpoint that consumes Hessian2 should be treated as a potentially dangerous trust boundary until its decoder behaviour is tightly constrained.
Where Hessian2 Appears in Practice
Hessian2 is most often encountered in internal service calls, middleware, legacy Java RPC stacks and performance-sensitive integration paths. Those environments frequently assume the peer is trusted, which can make the format attractive to attackers if an internal service is exposed beyond its intended boundary.
The risk rises when services are network-accessible, when message sources are not strongly authenticated, or when multiple components share the same deserialisation library and classpath. In those cases, one weak consumer can create a reusable attack path across the environment.
Risk and Threat Considerations
Hessian2 becomes risky when organisations treat binary RPC traffic as inherently safe. If an attacker can reach a decoder that accepts crafted messages, the threat is often unsafe object reconstruction, gadget chaining, denial of service, or abuse of application logic that was never meant to process hostile input.
Failure mechanism: A vulnerable consumer deserialises attacker-supplied bytes into application objects without sufficient type controls, enabling unintended code paths or object graph behaviour.
Impact: The outcome can include remote code execution, service compromise, data exposure, or lateral movement through a trusted service boundary.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | SI-10 — Input Validation | Hessian2 consumers must validate untrusted serialized input before object reconstruction. |
| AC-6 — Least Privilege | Limiting service privileges reduces the blast radius if unsafe deserialisation is exploited. | |
| Recommendation — Enforce SI-10 to reject unexpected serialized input before deserialisation. Apply AC-6 to limit the permissions available to any compromised deserialising service. | ||
| OWASP ASVS | V15 — Secure Coding and Architecture | Unsafe deserialisation is an application architecture issue that ASVS addresses through secure design. |
| V4 — API and Web Service | Hessian2 commonly travels over service interfaces that need strong request handling and trust boundaries. | |
| Recommendation — Use V15 to design away unsafe deserialisation and restrict object creation paths. Apply V4 to secure service endpoints that accept Hessian2 messages. | ||
| OWASP API Security Top 10 | API2 — Broken Authentication | If RPC endpoints are weakly authenticated, hostile Hessian2 payloads can reach trusted decoders. |
| Recommendation — Use API2 to ensure only strongly authenticated callers can reach Hessian2 endpoints. | ||
Practitioner Guidance
Why practitioners should care: Hessian2 is often deployed for convenience and performance, so it can persist in older service stacks long after its trust assumptions have aged out. Review every ingestion point as an attack surface, not just public APIs, because internal RPC channels are frequently the easiest place for unsafe deserialisation to hide.
What to watch for: Pay attention to decoders that accept arbitrary classes, broad reflection-based binding, or shared libraries used by multiple services. Where possible, constrain message schemas, reduce the set of permitted types, and treat any deserialisation failure or malformed object graph as a security signal rather than just a parsing error.
Practitioner takeaway: The safest Hessian2 deployment is the one that assumes the payload is hostile and narrows what the decoder is allowed to instantiate.
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 November 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org