Erlang Term Deserialization is the process of converting a serialised Erlang external term back into an in-memory Erlang data structure. It is used in distributed systems and message passing, and it becomes a security issue when untrusted input is deserialised, because crafted terms can trigger denial of service or unsafe behaviour in code that assumes trusted data.
What Erlang term deserialization does
Erlang term deserialization reverses a serialised external term back into an in-memory Erlang structure so processes can exchange data across nodes and message boundaries. In normal use it is a core interoperability mechanism; in untrusted contexts it becomes a trust boundary because the receiving code may interpret attacker-controlled structure, types, or size in ways the sender should never be allowed to influence.
Why untrusted terms become dangerous
The main security problem is not deserialization itself, but what the runtime and application do with the reconstructed term. If code assumes the input is benign, a crafted term can force excessive allocation, deep recursion, unexpected atoms or tuples, or application logic that treats the decoded value as already validated. That can produce denial of service, state corruption, or a transition into dangerous code paths.
Erlang systems are often used for distributed messaging, supervision, and long-lived services, so a bad deserialization path can affect more than one request. The danger is amplified when the payload crosses from a less trusted node, external queue, or integration boundary into code that was written for internal traffic only.
How organisations check exposure
Exposure starts with finding every place the system accepts external terms, not just the obvious receive loop. Teams should inventory node-to-node links, brokers, RPC handlers, caches, and any library that converts external terms into native data structures, then ask which of those paths can be reached by untrusted peers or by traffic that may be replayed or relayed.
Internet-facing services and cross-tenant integrations deserve particular scrutiny because deserialization bugs are most dangerous when the attacker can deliver a payload directly into a parser or formatter. A vendor or framework advisory may describe the risky call pattern more clearly than application logs, so it is worth checking upstream guidance as part of the exposure review.
Safer handling and verification
Safer handling means reducing what the deserializer is allowed to create, and reducing how much trust downstream code places in the result. A common pattern is to use allowlists or fixed contracts for expected shapes, reject unexpected types early, limit payload size and nesting, and avoid treating the decoded term as authoritative until the application has validated the business meaning of the data.
Where the language or library offers safer loader settings, filtering, or type restrictions, they should be enabled before the term reaches the business logic layer. After a patch or configuration change, the important question is not only whether the parser still runs, but whether the application still has any reachable path where an attacker can smuggle dangerous objects, excessive complexity, or unintended behaviour through a trusted-looking term.
Detection and compromise review
Detection should look for signs that deserialization is being used as an abuse primitive, not just for generic parse failures. Sudden resource spikes, repeated malformed term errors, odd message sizes, unexpected atom growth, and crashes around conversion routines can all indicate probing or exploitation attempts. If a vulnerable path was exposed, the post-patch review should also check whether the compromise could have altered process state, job queues, session data, or any persisted objects derived from the decoded term.
Because the impact can sit inside application state rather than only at the parser, remediation often includes reviewing downstream data, not just closing the parsing flaw. That is especially important in distributed systems where one bad message can be stored, forwarded, or replayed by other components before anyone notices it.
Risk and Threat Considerations
Untrusted Erlang term deserialization creates a classic attack surface for parser abuse and object injection style failures. The risk is highest when the receiving process assumes internal-only traffic, because an attacker can turn a seemingly ordinary message into a denial of service condition or a logic break in downstream code.
Failure mechanism: A crafted term can be shaped to consume memory, trigger excessive recursion, introduce unexpected runtime values, or steer code into branches that were only safe for trusted inputs.
Impact: The result can be process crashes, service instability, state corruption, or broader application compromise if the decoded value influences authorization, orchestration, or persistent storage.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
CIS Controls v8, NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS-16 — Application Software Security | Deserialization weaknesses are application-layer flaws requiring secure coding and validation controls. |
| Recommendation — Use CIS-16 to harden deserialization paths and validate untrusted inputs before they reach application logic. | ||
| NIST SP 800-53 Rev 5 | SI-10 — Information Input Validation | Deserialization of untrusted terms hinges on validating input before parsing and use. |
| Recommendation — Apply SI-10 to validate external terms before conversion and reject unexpected structures early. | ||
| OWASP ASVS | V2 — Validation and Business Logic | Unsafe deserialization becomes dangerous when input handling and business logic trust decoded data. |
| Recommendation — Use V2 to require strict validation of decoded terms before business logic consumes them. | ||
Practitioner Guidance
What to watch for: Treat every deserialization boundary as a validation boundary, not a convenience shortcut. The safest design is to minimize the number of components that can accept raw external terms, and to make the expected shape of each message explicit at the boundary rather than inferred later in execution.
Practitioner takeaway: If a term arrives from outside the trust boundary, the question is not “can Erlang decode it?” but “should this process accept the structure, size, and downstream effects of what was decoded?”
Related resources from NHI Mgmt Group
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 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org