Skip to main content

A08:2025 — Software or Data Integrity Failures

OWASP · Top 10:2025 · Reading time: ~11 min

At a Glance​

Rank#8 in 2025 (also #8 in 2021)
HistoryIntroduced in 2021, absorbing A8:2017 "Insecure Deserialization"
Example CWEsCWE-502 Deserialization of Untrusted Data, CWE-345 Insufficient Verification of Data Authenticity, CWE-353 Missing Support for Integrity Check, CWE-494 Download of Code Without Integrity Check, CWE-565 Reliance on Cookies without Validation and Integrity Checking, CWE-829 Inclusion of Functionality from Untrusted Control Sphere
Relationship to A03A03 is about the supply chain as a whole; A08 is about the specific failure to verify that code or data hasn't been altered — inside your own application as well as at its boundaries

In Plain English​

Integrity means "this is exactly what it's supposed to be, and nobody has changed it." An integrity failure is trusting something — code, an update, a data blob, a cookie — without checking that it hasn't been tampered with.

Data / code arrives
│
▼
Did we verify it? ──No──► Trusted anyway ──► A08
│
Yes (signature, hash, MAC)
│
▼
Safe to use

Three common forms:

  1. Insecure deserialization — turning attacker-supplied bytes back into live objects.
  2. Unverified code — auto-updates, plugins or CDN scripts loaded without a signature or hash check.
  3. Tamperable data — trusting values the client holds (cookies, hidden fields, local storage) as if the server wrote them.

How It Happens​

FailureExample
Native deserialization of untrusted dataJava ObjectInputStream, Python pickle, PHP unserialize, .NET BinaryFormatter on data from cookies, requests or queues. Can lead to remote code execution.
Unsigned auto-updatesAn app or device downloads updates over HTTP, or without checking a signature.
Third-party scripts without SRIA page loads a library from a CDN; if the CDN is compromised, so is every page using it.
Client-held state without integrity checksA cookie like role=user or a base64 JSON blob the server trusts without a signature.
Unsafe YAML/XML object loadingParsers that can create arbitrary objects from type tags.
CI/CD pulling unverified artifactsPipelines that download and run scripts (for example curl … | bash) without verification.
Plugin and extension ecosystemsInstalling plugins from untrusted sources into a CMS or IDE.
Freshers' takeaway

Look for opaque blobs while testing: a long base64 string in a cookie, a hidden form field full of random-looking text, a ViewState parameter. Decode them. If you can read or change what's inside, and the server accepts your changed version, you've found an integrity failure — and possibly something much worse if it's a serialized object.


Vulnerable vs. Fixed Code​

Vulnerable — unpickling data from a cookie:

import pickle, base64
prefs = pickle.loads(base64.b64decode(request.cookies["prefs"]))
# A crafted pickle can execute arbitrary code during loading.

Fixed — plain data format plus validation:

import json
from pydantic import BaseModel

class Prefs(BaseModel):
theme: str = "dark"
language: str = "en"

prefs = Prefs.model_validate(json.loads(request.cookies.get("prefs", "{}")))

Real-World Incidents​

  • Polyfill.io (2024) — A widely embedded JavaScript CDN domain changed ownership and was then reported to serve malicious, redirecting code to some visitors of the many sites that loaded scripts from it. Sites that self-hosted or used integrity checks weren't affected in the same way.
  • Codecov (2021) — A modified uploader script, downloaded and executed in CI pipelines without verification, exfiltrated secrets from customers' build environments.
  • Java deserialization (2015 onwards) — Research showing exploitable "gadget chains" in common Java libraries such as Apache Commons Collections led to a long series of remote code execution vulnerabilities in enterprise products that deserialized untrusted input.

How to Test for It​

  • Decode every cookie, hidden field and token. Look for serialized formats (Java serialization often starts with bytes AC ED, base64 rO0; PHP serialized data looks like a:2:{...} or O:4:"User"; .NET ViewState).
  • Modify decoded values and resend — does the server accept them without complaint?
  • Check third-party scripts for SRI attributes, and note which external domains the site trusts.
  • Check how the application, its agents or devices receive updates: HTTPS? signatures? version pinning?
  • Review CI/CD for scripts downloaded and executed without verification.
  • In code review, search for pickle.loads, yaml.load (without a safe loader), ObjectInputStream, unserialize, BinaryFormatter, Marshal.load.
  • Use specialised tools (such as ysoserial for Java) only in an authorised environment to confirm deserialization findings.

How to Prevent It​

PracticeWhy
Don't deserialize untrusted data with native formatsUse JSON or similar plain data formats with strict schema validation.
If you must deserialize, restrict typesAllowlist the classes that may be created; run in a low-privilege, isolated process.
Sign anything you hand to the client and expect backHMAC or digital signatures make tampering detectable.
Keep sensitive state server-sideA random session ID is safer than a signed blob for anything authorization-related.
Use SRI or self-host third-party scriptsPrevents a compromised CDN from compromising you.
Verify signatures on updates and artifactsCode signing plus verification at install time.
Review changes to code and configurationProtected branches and mandatory reviews make silent tampering harder.
Monitor integrityAlert when deployed files or critical configuration change unexpectedly.

Pro Notes​

  • Gadget chains are the reason deserialization is so dangerous: the attacker doesn't need a bug in your code — just classes on your classpath whose ordinary methods can be chained into something harmful during object reconstruction.
  • Signing isn't encryption. A signed cookie can still be read by the user. Don't put secrets in it.
  • Key rotation for signing secrets matters: if a cookie-signing or JWT secret leaks, every token signed with it can be forged until the key is rotated.
  • Content Security Policy complements SRI by restricting which domains scripts may load from at all.

Key Takeaways​

  • Integrity failures mean trusting code or data without verifying it hasn't been altered.
  • Insecure deserialization is the most severe form — it can lead straight to remote code execution.
  • Sign or keep server-side anything the client holds that the server later trusts.
  • Use SRI, signed updates and verified artifacts for code you don't build yourself.

Go deeper: Deserialization & Supply-Chain Attacks


Next​

A09:2025 — Security Logging & Alerting Failures