crypto-rsa-attacks
Skill26 starsChanged 31 days agoMITView on GitHub
Break RSA when parameters or padding are weak — recover plaintext or the private key from a public key and ciphertext. Load when you meet RSA in auth/tokens/TLS/custom crypto and have (n, e) + a ciphertext. Signals: a public key or n/e/c values, small exponent e=3, "textbook RSA", a JWT signed RS256 with a suspicious key, RsaCtfTool, factordb, close/shared primes, key you can't verify.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- NoorQureshi/roninword for word, first seen Oct 11, 2026
- NoorQureshi/security-skillsword for word, first seen Oct 11, 2026
Other versions2 projects use a version of this.
Word for word · 2
- NoorQureshi/security-skills★ 27100% same
- NoorQureshi/ronin★ 26100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository207 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ad-adcsSkill
- ad-dacl-abuseSkill
- ad-delegation-abuseSkill
- ad-kerberoastingSkill
- ad-pivot-arsenalSkill
- ai-agent-tool-abuseSkill
- ai-insecure-output-handlingSkill
- ai-jailbreakSkill
- ai-llm-dosSkill
- ai-mcp-securitySkill
- ai-model-extractionSkill
- ai-prompt-injectionSkill
- ai-rag-poisoningSkill
- ai-sensitive-data-disclosureSkill
- ai-supply-chainSkill
- ai-system-prompt-leakageSkill
- api-auth-attacksSkill
- api-bolaSkill
- api-fuzzingSkill
- api-graphqlSkill
- api-grpcSkill
- api-mass-assignmentSkill
- api-mongo-agg-facet-bypassSkill
- api-testing-checklistSkill
- api-versioningSkill
- automation-browserSkill
- automation-nuclei-templatesSkill
- automation-recon-pipelineSkill
- cloud-azureSkill
- cloud-container-escapeSkill
- cloud-docker-api-abuseSkill
- cloud-docker-registrySkill
- cloud-gcpSkill
- cloud-iam-privescSkill
- cloud-imds-ssrfSkill
- cloud-kubernetesSkill
- cloud-s3-exposureSkill
- code-review-cicdSkill
- code-review-cppSkill
- code-review-dangerous-sinksSkill
- code-review-dotnetSkill
- code-review-goSkill
- code-review-iacSkill
- code-review-javaSkill
- code-review-methodologySkill
- code-review-nodejsSkill
- code-review-phpSkill
- code-review-pythonSkill
- code-review-rubySkill
- code-review-rustSkill
- code-review-secrets-detectionSkill
- code-review-soliditySkill
- crypto-oracle-attacksSkill
- ctf-cryptoSkill
- ctf-forensicsSkill
- ctf-methodologySkill
- ctf-pwnSkill
- ctf-revSkill
- The first 60 shown.
The file
Files
RSA attacks
When it applies
RSA is used somewhere you can reach on an authorized target — a session token/cookie, a licence
check, a custom API request signature, a JWT (RS256), or an exposed keypair — and you can read the
public key (n, e) and a ciphertext/signature. Real systems get RSA wrong in a handful of
repeatable ways; each has a direct recovery.
Why it works
RSA is only as strong as its parameters and padding. "Textbook" RSA (no OAEP/PSS) is malleable and deterministic, small or shared parameters are mathematically reversible, and a factorable modulus hands you the private key outright. You don't break RSA — you exploit the specific weakness in this key.
Method
- Extract parameters. From a PEM:
openssl rsa -pubin -in key.pem -text -noout(givesn,e). From a JWT: decode the header/key. Noteeand the bit-length ofn. - Match the weakness → attack:
- Factorable
n— look it up on factordb; small/knownnfactors instantly → derived. - Close primes (p≈q) — Fermat factorisation recovers
p,qin milliseconds. - Small
e(e=3) + small message — plaintext may be< n^(1/e); take the integer cube root ofc(no modular reduction happened). Also Håstad broadcast if the same msg is sent to several keys. - Shared prime across two keys —
gcd(n1, n2)yields a common factor → both keys fall. - Common modulus (same
n, twoewith gcd 1 on the same message) — combine with Bézout. - Small private exponent
d— Wiener's attack (continued fractions). - Textbook (no padding) — malleable: forge/blind via
c' = c·r^e mod n; deterministic encryption enables chosen-ciphertext games.
- Factorable
- Automate the triage with RsaCtfTool (
rsactftool --publickey key.pem --uncipher cruns the above battery), then finish by hand once you know which weakness hit. - Recover and use — with
p,q:d = e^-1 mod (p-1)(q-1), decryptc, or re-sign to forge a token/signature.
Gotchas
- Proper padding (OAEP/PSS) with strong random primes ≈ unbreakable — don't burn time; the win is a misconfiguration, not the algorithm. Confirm it's textbook/weak first.
eanddare inverses mod φ(n) — a wrong φ (usingninstead of(p-1)(q-1)) gives a key that "looks" right but fails; verify by decrypting a known value.- JWT RS256 → key confusion is a different bug (alg swap to HS256) — see
web-auth-jwt; this skill is for weak RSA keys themselves. - Endianness / block size when converting the integer back to bytes trips people up
(
long_to_bytes).
Verify success
Recovered plaintext that is meaningful (or a forged signature/token the target accepts), and — when
you factored n — a private key that correctly decrypts a value you can check.
References
RsaCtfTool; factordb; Boneh "Twenty Years of Attacks on RSA"; Wiener's attack; pycryptodome.
Related: web-auth-jwt, crypto-oracle-attacks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

