Lab 08: OWASP A08 — Software and Data Integrity Failures

Objective

Exploit integrity vulnerabilities on a live server from Kali Linux: forge JWT tokens with the alg:none attack, tamper with signed cookies by guessing a weak secret, craft a malicious pickle deserialization payload for Remote Code Execution, manipulate an unsigned cart object to change prices, and demonstrate why unsigned data flowing into application logic is catastrophic.

Background

Software and Data Integrity Failures is OWASP #8 (2021). This category covers situations where code or data is used without verifying its integrity. The 2020 SolarWinds attack (18,000 organizations) injected malicious code into a signed software update — the update was signed but the build pipeline was compromised. JWT alg:none attacks let attackers forge any token without knowing the secret. Insecure deserialization (pickle, Java serialization) has been used in countless RCE exploits, including the 2017 Apache Struts CVE.

Architecture

┌─────────────────────┐        Docker Network: lab-a08         ┌─────────────────────┐
│   KALI ATTACKER     │ ─────── HTTP attacks ─────────────▶   │   VICTIM SERVER     │
│  innozverse-kali    │                                         │  innozverse-cybersec│
│  curl, python3      │ ◀────── responses ───────────────────  │  Flask :5000        │
└─────────────────────┘                                         │  (JWT, pickle,      │
                                                                │   unsigned cookies) │
                                                                └─────────────────────┘

Time

40 minutes

Tools

  • Victim: zchencow/innozverse-cybersec:latest

  • Attacker: zchencow/innozverse-kali:latest


Lab Instructions

Step 1: Environment Setup

⚠️ If /tmp/victim_a08.py is unavailable, write the script to any writable location and adjust the -v mount accordingly.


Step 2: Launch Kali


Step 3: JWT Decode — Inspect Without Cracking

📸 Verified Output:


Step 4: JWT alg:none Attack — Forge Admin Token

📸 Verified Output:

💡 The alg:none attack works because some JWT libraries allow the client to choose the signature algorithm. If the server reads header.alg before verifying, an attacker can set alg=none and provide an empty signature. The server skips verification entirely. Fix: hardcode the expected algorithm server-side — never trust header.alg.


📸 Verified Output:


Step 6: Pickle RCE — Deserialization Attack

📸 Verified Output:


Step 7: Brute-Force the JWT Secret

📸 Verified Output:


Step 8: Cleanup


Remediation

Vulnerability
Root Cause
Fix

JWT alg:none

Server trusts client-supplied algorithm

Hardcode: if header.alg != "HS256": reject

Weak JWT secret

"weak" — 4 chars

secrets.token_hex(32) — 256-bit random per deployment

Unsigned cart cookie

Price in client-controllable cookie

Store cart server-side (session/DB); client sends only item IDs + quantities

Pickle deserialization

pickle.loads() on untrusted input

Use JSON; if Python objects needed, use jsonpickle with strict type allowlist

Summary

Attack
Tool
Result

JWT decode

python3

Read claims without secret

alg:none forgery

python3

Forged role=admin token accepted

Cart tampering

python3

Surface Pro 12 for $0.01

Pickle RCE

python3

Remote code execution as root

JWT secret crack

python3

Secret "weak" found in 3 tries

Further Reading

Last updated