offensive-techniques/crypto-technique/SKILL.md
Cryptanalysis methodology for problem diagnosis, attack selection, and exploitation workflow. Covers RSA weak-key attacks, ECC singular curves, lattice-based attacks, PRNG state recovery, padding oracles, symmetric cipher weaknesses, and mathematical shortcuts in cryptographic implementations. Use when analyzing encrypted data, server oracles, key material, or cryptographic protocols to identify exploitable weaknesses and recover secrets.
npx skillsauth add aeondave/malskill crypto-techniqueInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Goal: help the agent diagnose cryptographic weaknesses, select the right attack, and execute exploitation to recover secrets—keys, plaintexts, random state, or authentication bypasses.
Before attempting attacks, reduce the problem to a concrete primitive and rank the most plausible weaknesses.
cyberchef for fast transform sanity checks, rsactftool for common weak-RSA triage, sagemath for algebraic or lattice work, and Python/pwntools only after the attack shape is clear.Cryptanalysis is a structured diagnosis → decision → execution loop:
Loop:
1. Parse the problem: read source code, dump key/ciphertext, connect to oracle.
2. Extract parameters: key size, exponents, curve equation, moduli, nonce/IV properties.
3. Diagnose weakness category: check parameter tables, structural anomalies, oracle behavior.
4. Select primary attack: consult decision trees in technique references.
5. Prepare exploit: build oracle harness, write solver script, or invoke tool.
6. Execute: measure timing/errors, recover secret, validate correctness.
7. Pivot: escalate to next stage (decrypt file, forge signature, assume compromised identity).
Exit when: plaintext recovered, key material compromised, or service bypassed.
Do not attempt multiple attacks in parallel without first ranking them by signal strength and likelihood.
Parse and extract cryptographic artifacts. Understand the attack surface before selecting tools.
If source is available (Python, OpenSSL, Go), look for:
e in RSA? Weak d values? Nonce reuse in DSA/ECDSA?random.randint() instead of secrets.randbelow()? Biased LFSR?Typical red flags:
random.seed() with predictable value (timestamp, PID).random.randint() for cryptographic operations.Dump and inspect all available cryptographic parameters.
RSA:
e, modulus n, ciphertext c.p, q, d, dp, dq, qinv.n factorable? Is e small? Is d abnormally small?ECC:
p, a, b, base point G, order n.p±1 factor smoothly? Is the curve singular or anomalous?DSA/ECDSA:
(r, s), nonce k, message hash.k? Is k drawn from a small space?Symmetric:
PRNG:
If attacking an oracle service (padding oracle, timing leak, signature verification error):
Load references/oracle-detection-checklist.md before building an oracle exploit; it separates real cryptographic signal from parser, cache, WAF, auth, and network-noise artifacts.
Use offensive-tools/network/* to interact with services; use python-patterns or pwntools for harness scripting.
Classify the problem and match it to a primary attack. Most crypto breaks reduce to:
n or solving DLP → choose based on key structure.If the primitive and anomaly are known but the attack construction is still missing after local tests, load knowledge/known-problem-hint-research.
Use it to find one decisive external hint — a paper, implementation note, technical article, public writeup, or discussion that matches the current fingerprint. Do not use it for broad crypto learning or before problem diagnosis; return with a local test and validation condition.
See references/rsa-technique.md.
Quick triage:
e (3 or 5)? → Try cube/fifth root first.e close to φ(n)? → Wiener's attack likely.n? → Common modulus attack.e? → Hastad broadcast.p-1 or q-1 factor smoothly? → Pollard p-1 or ECM.Tool families:
offensive-tools/cryptography/rsactftool/ — automated attack selection and execution.offensive-tools/cryptography/sagemath/ — lattice-based attacks (Wiener, Boneh-Durfee), custom factorization.offensive-tools/cryptography/sagemath/ — elliptic curve factorization (ECM), finite-field arithmetic, custom number-theory scripts.See references/ecc-technique.md.
Quick triage:
n is smooth? → Pohlig-Hellman reduction.k? → Recover private key directly.k drawn from small space? → Brute force or meet-in-the-middle.Tool families:
offensive-tools/cryptography/sagemath/ — ECDLP solving, singular curve reduction.offensive-tools/cracking/hashcat/ — brute-force nonce spaces if small enough.See references/lattice-lwe-technique.md.
Use lattice techniques when:
d in RSA).Tool families:
offensive-tools/cryptography/sagemath/ — LLL lattice reduction, Coppersmith's method.offensive-tools/cryptography/sagemath/ combined with python-patterns for custom constraint modeling.See references/prng-oracle-technique.md.
Tool families:
offensive-tools/cryptography/sagemath/ — lattice recovery for LCG/LFSR state.offensive-tools/network/* — oracle interaction harness (pwntools, boofuzz).python-patterns for oracle methodology.See references/symmetric-cipher-technique.md.
Tool families:
offensive-tools/cryptography/cyberchef/ — mode-specific decryption workflows, plaintext recovery.See references/dh-technique.md.
Quick triage:
p (< 1024 bits)? → Discrete log via Pohlig-Hellman or index calculus is feasible.p-1 factors smoothly? → Pohlig-Hellman reduction; complexity collapses with small factors.g^a mod p reused across sessions with same p? → Logjam / pre-computation attack.q is small (e.g., p = 2q+1 not satisfied, small subgroup)? → Small subgroup confinement attack.g is not a generator of the full group? → Attacker can confine secrets to a small subgroup.a is recovered.Tool families:
offensive-tools/cryptography/sagemath/ — discrete log solving, Pohlig-Hellman, index calculus for small primes.Use constraint solvers when the problem reduces to a set of equations or logical conditions over unknown variables:
solve_mod() or Gröbner basis.from z3 import *
# Example: recover seed from LCG outputs
seed = BitVec('seed', 32)
s = Solver()
# LCG: state = (a * seed + c) % m
a, c, m = 1664525, 1013904223, 2**32
out1, out2 = 0x12345678, 0x9abcdef0 # known outputs
s.add((a * seed + c) % m == out1)
if s.check() == sat:
print(s.model()[seed])
Tool families:
offensive-tools/cryptography/sagemath/ — algebraic solving, Gröbner basis, polynomial systems.z3 — SMT constraint solving; pip install z3-solver.See references/finite-field-technique.md.
(x_i, y_i) tuples with a stated prime? → Shamir secret sharing → Lagrange interpolation over GF(p) or GF(p^k).degree+1 shares; recover with Sage's lagrange_polynomial().GF(p^k) field; constant term of recovered polynomial is the secret.Tool families:
offensive-tools/cryptography/sagemath/ — Lagrange interpolation, GF(p), GF(p^k) field arithmetic.See references/ransomware-encryption-analysis.md.
Once the attack is selected:
offensive-tools/cryptography/rsactftool/ for automated factorization and decryption.offensive-tools/cryptography/sagemath/ with custom scripts for Coppersmith, LLL, or ECDLP.z3 SMT solver (pip install z3-solver) for bit-vector and integer constraint solving; fall back to SageMath for polynomial systems.offensive-tools/cryptography/sagemath/ or custom brute-force.offensive-tools/cryptography/cyberchef/ for offline workflows; load offensive-tools/cryptography/cyberchef/ Node API for programmatic chaining.| Problem shape | First tool skill | Why |
|---|---|---|
| RSA public key/ciphertext bundle | offensive-tools/cryptography/rsactftool/ | Automates common weak-RSA attacks and factorization checks |
| Lattice, finite field, ECC, DH, custom math | offensive-tools/cryptography/sagemath/ | Algebraic modeling and exact arithmetic |
| Encoding, mode experimentation, byte-level transforms | offensive-tools/cryptography/cyberchef/ | Fast reversible transform chains and visual sanity checks |
| Hash/password recovery | cracking-technique + offensive-tools/cracking/hashcat/ or john/ | Candidate generation and offline cracking strategy |
| Oracle interaction | coding/python-patterns/ + pwntools/socket harness | Repeatable measurements and controls |
references/problem-diagnosis.md — detailed problem reading checklist and parameter extraction.references/rsa-technique.md — RSA weakness diagnosis, attack selection matrix, quick-reference attack conditions.references/ecc-technique.md — ECC and DSA weakness diagnosis, nonce reuse patterns, curve singularity checks.references/lattice-lwe-technique.md — LLL lattice reduction, Coppersmith's method, LWE embedding, constraint modeling.references/prng-oracle-technique.md — PRNG state recovery, oracle timing/error-based methodology, Manger's padding oracle.references/oracle-detection-checklist.md — Oracle confirmation workflow: observable channels, timing gates, controls, and exploit-readiness criteria.references/symmetric-cipher-technique.md — ECB, CBC, CTR, and GCM mode weaknesses; plaintext recovery techniques.references/finite-field-technique.md — Shamir secret sharing recovery, Lagrange interpolation over GF(p) and GF(p^k), field extension arithmetic.references/dh-technique.md — Diffie-Hellman weak parameter attacks: small prime, Pohlig-Hellman, small subgroup confinement, logjam, static DH session recovery.references/ransomware-encryption-analysis.md — Malware/ransomware encryption triage: API identification, key hierarchy, file format analysis, memory extraction, and recovery-feasibility assessment.references/problem-diagnosis.md.offensive-tools/cryptography/ to execute.data-ai
Scoped routing: Linux operator; hosts, sessions, users, services, packages, logs, containers, SSH, network paths, privilege evidence.
development
Offensive methodology for ICS/OT/SCADA environments in authorized industrial penetration testing and red team operations. Use when assessing PLCs, RTUs, HMIs, engineering workstations, historians, or field devices running Modbus, DNP3, EtherNet/IP, S7comm/S7+, Profinet, IEC 60870-5-104, BACnet, or OPC-UA. Covers passive OT network enumeration, protocol-level device interrogation, PLC coil/register read-write attacks, HMI session exploitation, historian and engineering workstation compromise, and safe escalation rules for critical infrastructure scope. Does not cover: general IT network exploitation (network-technique), physical hardware interfaces UART/JTAG/SPI (hardware-technique), wireless sensor network attacks (wireless-technique), RF/SDR signal analysis (hardware-ctf or wireless-technique), or CTF-framed ICS lab tasks (ics-ctf).
tools
Offensive methodology for authorized game security assessments, game client security research, and game-adjacent penetration testing in real-world engagements. Use when assessing game clients for cheating vulnerabilities, testing anti-cheat effectiveness, auditing game server protocols for score manipulation or economic fraud, reverse engineering game DRM or license validation, analyzing game save file protection, or assessing game mod/plugin security. Covers: process memory scanning and manipulation (Cheat Engine methodology), game binary reversing for license and DRM bypass, game network protocol analysis and packet replay, anti-cheat mechanism analysis, save file format reversing and tampering, speed hack and value injection techniques. Does NOT cover: CTF game challenges (game-ctf), game engine source code auditing (web-exploit-technique or vuln-search-technique for the backend), or general binary exploitation (pwn-ctf or reversing-technique).
development
Auth assessment: hardware/embedded methodology; UART/JTAG/SWD/SPI/I2C, firmware extraction, boot/debug paths, embedded OS evidence.