Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 38 ยท Integrity, Logging and SSRF

Software and Data Integrity Failures

OWASP A08 explained: how unsigned updates, tampered build pipelines and untrusted data break integrity, and how hashes, pinning and review protect your supply chain.

Integrity means that software and data are exactly what their owner intended: not altered on the way, not swapped for a lookalike, not changed by someone with no right to change them. Software and Data Integrity Failures (A08) happen when an application or pipeline trusts code or data without verifying where it came from or whether it was modified.

This category grew in importance because of supply chain attacks: instead of attacking your server, an attacker alters something you pull in, such as a library, a build script, an update package or a CDN-hosted file, and your own process delivers the damage.

This lesson is defensive and uses only toy data in memory. It shows how verification works so you can apply it to your own software.

Where integrity breaks

  • Unsigned or unverified updates: an auto-updater downloads and runs a package without checking a signature.
  • Dependency confusion and typosquatting: a malicious package with a similar or internal-looking name is installed instead of the real one.
  • Compromised build pipeline: attackers change CI configuration, a build plugin or a release artifact.
  • Untrusted CDN scripts: a page loads a third-party script that is later changed.
  • Insecure deserialization: accepting serialized objects from users and rebuilding them without validation (see Signatures and Safe Deserialization).
  • Tamperable client data: a hidden form field, cookie or token that the server trusts without a signature.

A software supply chain

Source code Written and reviewed.
Dependencies Pulled from registries.
Build and CI Compiled and packaged.
Deploy Delivered to users.

Every arrow can be attacked.

1 / 2

Hashes detect change

A cryptographic hash such as SHA-256 maps any data to a fixed-size fingerprint. Change one byte and the fingerprint changes completely. If the publisher posts the expected hash through a trusted channel, you can verify what you downloaded.

Python Verify a download against a published hash

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A hash alone only helps if the hash itself comes from a place the attacker cannot change. If both the file and the hash sit on the same compromised server, the attacker updates both. That gap is why digital signatures exist (next lesson).

Lock files with integrity hashes

Package managers store a hash for each dependency in the lock file (for example the integrity field in package-lock.json, or content-hash in composer.lock). When you install, the tool rejects a package whose bytes differ. Commit the lock file and install from it in CI (npm ci, composer install).

The stand-in below pretends to be that check.

Python A lock file that rejects altered packages

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Dependency confusion and typosquatting

If your company has an internal package called acme-billing and a public registry also lets anyone publish acme-billing, a misconfigured resolver might prefer the public (attacker-controlled) version with a higher version number. Typosquatting uses names such as reqeusts instead of requests.

Defenses:

  • Scope or namespace internal packages and reserve the names on public registries.
  • Configure the resolver so internal names only come from the internal registry.
  • Review new dependencies: age, downloads, maintainers, repository link.
  • Use a private proxy registry that allows only approved packages.

Protect the pipeline

  • Require code review and branch protection on the default branch and on pipeline definitions.
  • Run CI with least privilege; secrets are available only to jobs that need them, never to pull requests from forks.
  • Pin third-party CI actions and plugins to a full commit hash, not a movable tag.
  • Sign build artifacts and container images, and verify the signature at deploy time.
  • Produce provenance (a record of how and where an artifact was built) and keep an SBOM.
  • Subresource Integrity for third-party scripts you cannot avoid:
HTML
<script src="https://cdn.example.test/lib.js"
        integrity="sha384-BASE64HASHOFTHEEXPECTEDFILE"
        crossorigin="anonymous"></script>

If the CDN file changes, the browser refuses to run it.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the main idea of a software supply chain attack?

    By tampering with something the victim already trusts and installs, the attacker gets their code delivered by the victim's own process.
  2. 2. Why is a published hash not enough if it sits next to the file on the same server?

    The hash must come from a trusted, separate channel, or you need a signature tied to a key the attacker does not hold.
  3. 3. What does pinning a CI action to a full commit hash protect against?

    Tags can be moved; a commit hash identifies one exact version of the code.
  4. 4. What does the integrity attribute on a script tag do?

    Subresource Integrity compares the fetched bytes with the expected hash before running them.

Summary

  • A08 is about trusting code or data without verifying origin or changes.
  • Hashes detect modification; signatures also prove who published it.
  • Commit lock files with hashes, scope internal packages and pin CI actions to commit hashes.
  • Protect the build pipeline like production, sign artifacts and keep provenance.

Next: Signatures and Safe Deserialization