/penetration-tester:detecting-weak-cryptographyfrom penetration-tester
Scans source trees for weak cryptographic primitives (MD5, SHA-1, DES, 3DES, RC4, ECB mode), custom crypto, hardcoded IVs, predictable random, and disabled cert verification. Use for pre-merge gates, SOC2/PCI audits, or post-incident reviews.
Ships in penetration-tester. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Weak cryptography (CWE-327 Use of a Broken or Risky Cryptographic
Algorithm, CWE-330 Use of Insufficiently Random Values) shows up
when engineers use the convenient API instead of the cryptographic
one. hashlib.md5(password) is faster to type than the correct
bcrypt/argon2 invocation; Math.random() returns a number quickly
without needing to know about crypto.randomBytes().
The fix is universal: use the modern primitive. SHA-256 for general
hashing, bcrypt/argon2/scrypt for passwords, AES-GCM for encryption,
HMAC-SHA256 for signing, secrets / crypto.randomBytes /
SecureRandom for randomness.
| Finding | Severity | Threshold | Affected control |
|---|---|---|---|
| MD5 used in security context | HIGH | hashlib.md5, MessageDigest.MD5, CryptoJS.MD5 | CWE-327 |
| SHA-1 used in security context | HIGH | hashlib.sha1, etc. | CWE-327 |
| DES / 3DES cipher | CRITICAL | DESCrypto, "DES/CBC", "DESede" | CWE-327 |
| RC4 cipher | CRITICAL | "ARC4", "RC4" | CWE-327 |
| AES ECB mode | CRITICAL | "AES/ECB" or MODE_ECB | CWE-327 |
| Hardcoded IV (initialization vector) | CRITICAL | IV literal in source | CWE-329 |
| Custom XOR-based "encryption" | CRITICAL | XOR loop over bytes | CWE-327 |
| Predictable random for crypto seed | CRITICAL | Math.random / java.util.Random / random.random for keys | CWE-330 |
| TLS cert verification disabled | CRITICAL | verify=False, rejectUnauthorized:false, ServerCertificateValidationCallback returning true | CWE-295 |
| Hardcoded HMAC secret | HIGH | Long literal in HMAC constructor | CWE-321 |
| Insecure password hashing (no salt, no KDF) | CRITICAL | hashlib.sha256(password) without bcrypt/argon2 | CWE-916 |
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-weak-cryptography/scripts/scan_weak_crypto.py /path/to/repo
Options: --output, --format, --min-severity, --include-tests,
--languages, --allow-md5-checksums (excludes MD5 used in
non-security contexts like content-addressable storage).
CRITICAL = direct cryptographic break available against the algorithm. CVEs, public attack tools, sometimes pre-computed tables (rainbow tables for MD5/SHA-1).
HIGH = algorithm collision-broken (MD5, SHA-1) but the specific use case may tolerate the weakness (file-deduplication checksums, non-security HMAC). Verify the usage context.
See references/PLAYBOOK.md for per-primitive migration. Modern
defaults: SHA-256/SHA-3 for hashing, AES-256-GCM for encryption,
HMAC-SHA-256 for signing, secrets-grade random for keys, bcrypt /
argon2id for password storage.
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-weak-cryptography/scripts/scan_weak_crypto.py \
--min-severity high $(git diff --name-only main...HEAD | tr '\n' ' ')
- name: Weak-crypto scan
run: |
python3 plugins/security/penetration-tester/skills/detecting-weak-cryptography/scripts/scan_weak_crypto.py \
. --min-severity high
JSON / JSONL / Markdown. Exit codes: 0 / 1 / 2.
False positives common on:
--allow-md5-checksums.Verify each finding by reading whether the algorithm's failure mode (collision, preimage, etc.) is actually exploitable in context.
references/THEORY.md — Per-primitive attack model (why MD5 /
SHA-1 are collision-broken, why ECB leaks structure, why
Math.random is non-crypto-grade)references/PLAYBOOK.md — Per-language modern-crypto recipes
(Python cryptography library, Node crypto, Java JCA with
modern algorithms, Go crypto/rand + crypto/cipher AEAD)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
26 skills in this plugin
/analyzing-tls-configAnalyze a target's TLS configuration — negotiated protocol version, cipher
suite, certificate chain, expiry, and downgrade vectors.
Use when: SOC2 auditor flagged your endpoint for "weak TLS" but you don't
know which control failed (TSC CC6.7 transmission integrity vs CC6.6
encryption) or which cipher is the problem.
Threshold: any negotiated TLSv1.0 or TLSv1.1, OR a cipher with RC4 / 3DES /
null / EXPORT, OR a cert with under 30 days to expiry, OR a chain that fails
hostname verification.
Trigger with: "audit tls", "check ssl config", "weak tls", "analyze tls".
/auditing-cors-policyAudit a target's CORS posture — Access-Control-Allow-Origin handling,
reflected-origin bypass, credentials+wildcard mismatch, preflight
OPTIONS behavior, Vary header correctness.
Use when: a third-party integration is failing CORS preflight and
someone proposes "just set Allow-Origin to *" as the fix, OR your
bug-bounty inbox has a credential-reuse exploit chain.
Threshold: any reflection of arbitrary Origin into Allow-Origin,
Allow-Credentials:true with wildcard origin (browser-rejected combo
but server config wrong), missing Vary:Origin on per-origin responses,
preflight cached over 86400s, OR Allow-Origin trust of attacker-
controlled subdomain pattern.
Trigger with: "audit cors", "check cors policy", "cors bypass",
"preflight check".
/auditing-npm-dependenciesAudit a Node.js project's installed npm dependency tree for known
CVEs by wrapping the npm audit JSON output and emitting findings in
the canonical penetration-tester schema. Detects direct AND transitive
vulnerabilities, normalizes npm's severity scale (info/low/moderate/
high/critical) to the shared Severity enum, and parses both v1 and
v2 audit output formats so the skill works against npm 6 and npm
7+ lockfiles.
Use when: pre-merge gate on a Node project, post-incident sweep
after a transitive package compromise (e.g. event-stream, ua-parser,
node-ipc, color.js), SOC2 vendor-management evidence collection,
or auditing an inherited or acquired Node codebase.
Threshold: any HIGH or CRITICAL CVE in the resolved dependency
tree. MODERATE / LOW reported informationally.
Trigger with: "audit npm deps", "npm vulnerability scan", "check
node packages for CVEs", "npm audit".
/auditing-python-dependenciesAudit a Python project's installed dependencies for known CVEs by
wrapping pip-audit (PyPA's official vulnerability auditor) and
emitting findings in the canonical penetration-tester schema.
Detects vulnerable direct AND transitive packages, normalizes
pip-audit's severity output via OSV severity bands, falls back to
pip list --outdated when pip-audit isn't installed, and supports
requirements.txt, pyproject.toml (PEP 621), Pipfile.lock, and
poetry.lock as input sources.
Use when: pre-merge gate on a Python project, post-incident sweep
after a PyPI compromise (e.g. ctx, request-toolbelt typosquats,
ultralytics 8.3.42 compromise), SOC2 evidence collection, or
inheriting an unfamiliar Python codebase.
Threshold: any HIGH or CRITICAL CVE in the resolved dependency
tree. MODERATE / LOW reported informationally.
Trigger with: "audit python deps", "pip vulnerability scan",
"check pypi packages for CVEs", "pip-audit run".
/checking-http-security-headersAudit a target's HTTP security headers — CSP, HSTS, X-Frame-Options,
X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and the
Cross-Origin trio (COOP, COEP, CORP).
Use when: SOC2 / PCI auditor flagged "missing security headers" or a
Mozilla Observatory grade is below B, OR you need HSTS preload
eligibility for chrome://net-internals.
Threshold: any missing required header on production HTML response,
HSTS max-age below 31536000s (preload requirement), CSP with
'unsafe-inline' or 'unsafe-eval', X-Frame-Options absent AND CSP
frame-ancestors absent (clickjacking), Cache-Control allowing public
cache on authenticated endpoint.
Trigger with: "audit security headers", "check csp", "hsts check",
"header posture".
/checking-license-complianceAudit a project's dependency licenses against an explicit policy
(allow-list / deny-list / review-required) and flag incompatibilities
before they ship to production. Reads SPDX license identifiers from
npm package manifests, Python METADATA / PKG-INFO files, and
pyproject.toml; classifies each license by family (permissive,
weak-copyleft, strong-copyleft, proprietary, unknown); detects
copyleft contamination and SPDX-incompatible license combinations.
Use when: pre-release legal review, M&A code-audit due diligence,
preparing an OSS attribution NOTICE file, or switching a project's
own license.
Threshold: any GPL-family license in a project declaring MIT or
Apache-2.0; any UNKNOWN-license package; any metadata-vs-source
license mismatch.
Trigger with: "check licenses", "license compliance audit",
"SPDX scan", "GPL contamination check".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin penetration-testerOther plugins' skills for the same job