Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Insecure deserialisation occurs when an application rebuilds objects from untrusted data, allowing an attacker to control which classes are instantiated and what code runs as a result.

What Is Insecure Deserialisation?
Serialisation converts an in-memory object into bytes that can be stored or transmitted; deserialisation reverses it. The security problem is that native deserialisation does not simply copy values, it reconstructs objects, which means it calls constructors, setters, and lifecycle methods chosen by whoever wrote the byte stream. If that stream came from a user, the user is deciding which code runs inside your process.
An attacker rarely has a convenient class that executes commands. Instead they build a gadget chain: a sequence of ordinary classes already present on the application’s classpath, each with a method invoked automatically during deserialisation, arranged so the combination produces execution. No single class in the chain is vulnerable, and none was written with this use in mind. That is what makes the problem structural rather than a bug in any one library.
The canonical example is Apache Commons Collections. CVE-2015-7501 described how its transformer classes could be assembled into a chain that ran an arbitrary command the moment a crafted object was deserialised, and the ysoserial tool shipped ready-made payloads for dozens of such chains. Equivalent toolkits exist for other ecosystems: phpggc for PHP gadget chains and a well-documented set of patterns for .NET formatters.
ObjectInputStream, and anything built on it, including RMI, JMX, and some message queue clients. Java 9 and Java 8u121 introduced serialisation filters under JEP 290, which allow a class allow-list to be applied before any object is constructed.unserialize(), where property-oriented programming chains abuse magic methods such as __wakeup and __destruct. Passing an allowed_classes option is the minimum mitigation.BinaryFormatter, SoapFormatter, NetDataContractSerializer, and LosFormatter. Microsoft marked BinaryFormatter obsolete and removed it from the .NET 9 runtime, which is the clearest statement a platform owner can make about an API.pickle, which documents plainly that it is not secure against erroneous or maliciously constructed data, and yaml.load without the safe loader.Marshal.load, with chains through Rails components.The data itself turns up in cookies, hidden form fields, view state, authentication tokens, cache entries, and message queues, often base64-encoded. Java streams begin with the bytes AC ED 00 05, which appear as rO0 once base64-encoded, and that four-character prefix is one of the most productive things to search for in traffic captures and log files.
Remote code execution is the headline, and it is not the only outcome. Deserialisation can be used to escalate privilege by tampering with a serialised role or user object, to cause denial of service through objects that consume enormous memory or CPU during reconstruction, and to trigger server-side request forgery by instantiating a class that opens a connection. Because the damage happens during reconstruction, it occurs before any application-level validation runs.
allowed_classes option in PHP.Static analysis locates the dangerous sinks reliably, because the function names are a short list. Dynamic testing is harder: most cases are blind, confirmed through a timing delay or an out-of-band callback rather than a visible response, with Burp Suite’s Java Deserialization Scanner and collaborator-style interaction servers doing the work. Reviewing where serialised data crosses a trust boundary is a standard part of our web application security testing, and a worthwhile question to ask during secure code review before anything reaches production.
By default, mostly yes, because JSON describes data rather than types and a parser maps it onto a structure you define. The exception is polymorphic type handling, where a library is configured to read the target class name from the document itself. Jackson’s default typing and similar features in other libraries turn a data format into an object format and reintroduce the vulnerability.
It prevents tampering by an outsider, which closes the common attack path, and it depends on two things holding. The signature must be verified before deserialisation begins, not after, and the key must be genuinely secret rather than committed to the repository or shared across environments. It also offers nothing against data that was already malicious when legitimately produced.
Look for recognisable prefixes. Java object streams start with the hexadecimal bytes AC ED 00 05, which become rO0 when base64-encoded. PHP serialised strings begin with a type letter and a colon, such as O:8. .NET view state and Python pickles have their own signatures. Searching cookies, hidden fields, and tokens for these markers finds most instances quickly.
No, only unexploited for now. Gadget chains are discovered continuously, and adding a dependency, or upgrading one, can introduce a chain into an application that had none. Relying on the absence of a published chain means your security posture changes whenever someone else publishes research. Remove the untrusted deserialisation instead.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.