Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Crypto Attacks?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-crypto-attacks)
---
name: crypto-attacks
description: Weak cryptography testing — ECB pattern leakage/block shuffling, padding-oracle (CBC) decryption/forgery, predictable or reused IV/nonce, weak/seedable RNG for tokens, hash length-extension, and insecure primitives (MD5/SHA1/DES). Cross-references JWT. Tier 1. Use when the app uses custom crypto, encrypted tokens/cookies, or reset/session tokens.
---
# Weak Cryptography Attacks
Applications that roll their own crypto or misuse primitives leak plaintext, let attackers forge ciphertext, or make tokens predictable. Identify the scheme, then apply the matching attack.
## Trigger phrases
`crypto, weak crypto, ecb, padding oracle, cbc, iv reuse, nonce reuse, weak rng, predictable token, hash length extension, md5, des, encryption`
## Method
1. **Find & fingerprint crypto material:** encrypted cookies/tokens, `ViewState`, reset/verify tokens, API signatures, encrypted URL params. Decode (base64/hex); measure length (block multiple of 8/16 → block cipher). Look for repeating 16/8-byte blocks (ECB tell). Note any error differences on tampering (oracle tell).
2. **ECB detection/abuse:** submit plaintext with long repeated runs; identical plaintext blocks → identical ciphertext blocks confirms ECB. Exploit: **block shuffling/splicing** (swap/duplicate blocks to change meaning, e.g. role/amount), and **byte-at-a-time ECB decryption** when you control a prefix adjacent to a secret.
3. **Padding oracle (CBC):** if tampering ciphertext yields distinguishable "padding error" vs other error/behavior (status, timing, message), run `padbuster URL ENC_SAMPLE BLOCKSIZE -cookies ...` or `python3 -m padding_oracle` to **decrypt** the token and **forge** arbitrary plaintext (encrypt) — e.g. set `admin=true`. Cross-ref CBC/`ViewState` deserialization → `web-deserialization`.
4. **IV / nonce issues:** fixed/zero IV in CBC → first-block manipulation/equality leaks; **CTR/GCM nonce reuse** under the same key → keystream reuse (XOR two ciphertexts to recover plaintext), and GCM nonce reuse → **authentication-key recovery → forgery**. Detect by collecting multiple tokens and comparing IV/nonce fields.
5. **Weak RNG / predictable tokens:** reset/session/CSRF tokens from `rand()`/`mt_rand()`/`Math.random()`/time-seeded PRNG. Collect many, test for structure/sequence; tools: `php_mt_seed` (recover mt_rand seed), timestamp-correlation. Predict next token → account takeover.
6. **Hash length-extension:** signature = `H(secret ‖ data)` with MD5/SHA1/SHA256 (Merkle–Damgård) and length controllable → append data and forge a valid MAC without the secret: `hash_extender -d DATA -s KNOWNHASH -a APPEND -l SECRETLEN --format sha256`. Common in homemade API signing.
7. **Insecure primitives:** MD5/SHA1 for integrity/passwords, DES/3DES/RC4, hardcoded keys, static salts, ECB mode defaults, missing authenticated encryption.
## Modern / rare techniques
- **GCM nonce-reuse forgery** (authentication bypass, not just confidentiality) — high impact, often overlooked.
- **Timing-based padding oracle** when no explicit error differs — statistical timing on the decrypt endpoint.
- **"Encrypt" oracle via padding oracle** to mint tokens, not just decrypt.
- Cross-link **JWT** weaknesses (alg confusion, `none`, weak HMAC secret crack) → `jwt`.
## Bypass / evasion
Oracles may be subtle (timing/length/behavior not a visible error) — automate differential measurement. `${CLAUDE_PLUGIN_ROOT}/payloads/waf-bypass.md` rarely relevant.
## Escalation / chaining
Forged token → auth bypass/ATO (`web-auth-session`, `idor`); padding-oracle decrypt → secret recovery; CBC gadget → `web-deserialization`; token secret → `jwt`.
## Backend & tooling
Preferred Kali path (native / WSL+Kali / Kali-SSH / Kali-MCP). padbuster, hash_extender, php_mt_seed, CyberChef, python `pycryptodome` for PoC scripts; run scripts with `python3 -I` from a separate dir. See `zazy-orchestrator`.
## Verification (background, before reporting)
Reproduce decrypt/forge twice with distinct samples; confirm a forged token is accepted by the app before claiming impact. Report true positives only.
## Evidence
Scheme identified + tell (repeated blocks / oracle behavior / nonce reuse), tool output, a forged/decrypted sample accepted by the app. Remediation: use authenticated encryption (AES-GCM/XChaCha20-Poly1305) with unique random nonces, CSPRNG for tokens, HMAC (not `H(secret‖data)`) for signatures, drop MD5/SHA1/DES/ECB, rotate hardcoded keys, constant-time comparisons.