Software and Data Integrity Failures (OWASP A08)
On this page
What software and data integrity failures are
Day 4 was about what you choose to depend on. This lesson is about something narrower: when code or data reaches you, can you prove it's unchanged and came from who you expect? The 2025 list calls this category "Software or Data Integrity Failures". It covers updates, build artifacts, and data your own app sent out and later reads back, such as cookies and hidden form fields.
Insecure deserialization: why it's dangerous
Many languages can turn a whole object graph into bytes and back: Python's pickle, Java serialization, PHP unserialize, .NET BinaryFormatter. Rebuilding objects can run code, because the format lets the bytes say which class to create and which methods to call on the way.
So if a server deserializes bytes a client controls, such as a session cookie, the client decides what code runs. Python's own documentation warns that pickle should never be used on untrusted data for this reason. In 2015, researchers showed that Java apps deserializing untrusted input with Apache Commons Collections on the classpath, including Jenkins and WebLogic, could be driven to remote code execution this way. Microsoft now marks BinaryFormatter as dangerous and has removed it from modern .NET. JSON isn't automatically safe in .NET either: Newtonsoft.Json with TypeNameHandling set to anything but None reads a $type field from the input and creates that class, which brings the same remote code execution risk back. System.Text.Json doesn't support that, which is one reason to prefer it for untrusted input.
The fix is to not deserialize untrusted bytes into objects at all:
- Use plain data formats such as JSON, which parse into strings, numbers, lists and maps, never into arbitrary classes.
- Validate the parsed shape with a schema so anything unexpected is rejected:
const state = StateSchema.parse(JSON.parse(cookieValue)); // throws on any unexpected field or type- If data must make a round trip through the client, sign it (an HMAC or a signed token) and verify the signature before you use it.
Signing updates with Ed25519 and catching tampering
Auto-updaters, plugin loaders and deploy pipelines all fetch something and run it. Without a signature check, whoever controls the download path controls your code. With Node's built-in Ed25519 support:
import crypto from 'node:crypto';
const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519');
const update = Buffer.from('#!/bin/sh\necho installing v2.4.1\n');
const sig = crypto.sign(null, update, privateKey); // done by the publisher
console.log('genuine update verifies:', crypto.verify(null, update, publicKey, sig));
const tampered = Buffer.from(update.toString().replace('echo installing', 'echo HACKED; echo installing'));
console.log('tampered update verifies:', crypto.verify(null, tampered, publicKey, sig));genuine update verifies: true
tampered update verifies: falseOne added command, and verification fails. The client ships with the publisher's public key pinned, and refuses anything that doesn't verify. The private key never leaves the publisher's signing system.
Compromised builds: CCleaner and SolarWinds
Signing proves an artifact came from your signing step. It doesn't prove the signing step was clean. In 2017 attackers broke into the build environment of CCleaner's maker and inserted malware before signing. The installer carried a valid signature and reached about 2.27 million users. SolarWinds' 2020 Orion compromise followed the same pattern.
So protect the pipeline too:
- Least privilege in CI. Separate who can change pipeline config from who can deploy, and require review for both.
- Provenance. Record which source commit and which build produced an artifact. npm supports this with
npm publish --provenancefrom supported CI systems, and Sigstore tooling verifies it. - Verify at deploy time, not only at build time, so a swapped artifact in between is caught.
- Reproducible builds, where possible, let a second system rebuild and compare.
Check yourself
The client controls the bytes, and unpickling can run code, so this can lead to remote code execution. Store JSON validated by a schema, and sign it if the server must trust it.
HTTPS only protects the transfer. If the download server or CDN is compromised, it serves a malicious file over valid HTTPS. A signature from a key the server never holds catches that.
Signing only vouches for what went into the signing step. The build environment needs its own protection, plus provenance that ties an artifact to its source and build.
It proves an update came from the holder of the signing key and wasn't altered in transit or on a mirror. It doesn't help if the build system or signing key itself is compromised, as SolarWinds and CCleaner showed, so build pipelines need their own protection.
Restrict who can change pipeline definitions, pin third-party actions and dependencies to specific versions or hashes, use short-lived credentials, isolate build runners, and produce signed provenance attestations so consumers can verify how an artifact was built.