Insecure Deserialization
An uploaded backup that runs the attacker's code.
What Is Insecure Deserialization?
A type-aware deserializer rebuilds whatever object an uploaded file names, so the right type runs code as it is reconstructed. That makes it a parser-choice bug, not an input-shape one. You'll weaponize an ordinary workspace-settings backup, upload it through the real restore feature, and read the server's own secrets.env back in the response. Then you replace the native deserializer with JSON.parse bound to a fixed settings schema and allowlist of fields, so an uploaded backup is only ever treated as data.
What You'll Learn in Insecure Deserialization
- Recognize insecure deserialization as a type-reconstruction bug, not an input-shape one
- Read a crafted backup and identify the typed entry whose reconstruction runs code
- Trace how rebuilding an untrusted object leaks the server's own secrets file
- Apply the data-only fix: parse as JSON against a fixed schema and an allowlist of fields
- Separate the code fix from containment, and rotate the secrets that already leaked
Insecure Deserialization — Training Steps
-
Find the restore feature
Marrowby lets any workspace owner move their settings between workspaces by uploading a backup file. The restore form takes the file, rebuilds the saved settings object on Marrowby's servers, and applies it. Bob opens the feature to see how it behaves before he touches it.
-
Where the rebuilding happens
One line on that page is the whole reason Bob is interested.
-
Restore a normal backup
First, watch the feature behave normally. Bob attaches an ordinary settings backup and submits it. The browser's Network panel records the request and the server's reply, exactly what a developer sees in DevTools.
-
What the server echoed
The backup restored cleanly. One detail in the response tells Bob how to attack it.
-
Start from a normal backup
Bob opens the ordinary backup in his editor. Right now it is exactly what it looks like: three settings, plain data. The backup format lets an entry carry a typed value, one the deserializer rebuilds into an object. Bob is about to add one.
-
Weaponize the backup
Bob adds one entry: a typed value the deserializer will rebuild into an object whose reconstruction runs code. The file still looks like a settings backup. The dangerous part, the sequence of objects that chains the reconstruction into a working exploit, is a known technique; it is not spelled out here.
-
The typed entry
One entry is all it took.
-
Upload the crafted backup
Bob submits his crafted file through the same restore feature. To the browser it is just another backup upload, but it now carries a working payload.
-
The secrets come back
The response is not a restored-settings summary. It is the contents of the server's own secrets file, read off disk and handed straight back through the restore feature's normal output. The revived object ran code as the app: this is remote code execution.
-
Knowledge check
Security Framework Coverage
OWASP Top 10
- A08:2025 Software or Data Integrity Failures
- A08:2021 Software and Data Integrity Failures
OWASP ASVS
- V1.5.2 Safe Deserialization
CWE
- CWE-502 Deserialization of Untrusted Data
CIS Controls
- CIS 16 Application Software Security
NIST CSF
- PR.AT-02 Individuals in specialized roles are provided with awareness and training so that they possess the knowledge and skills to perform relevant tasks with cybersecurity risks in mind
- PR.PS Platform Security
NICE Framework
- DD-WRL-003 Secure Software Development