Crypto rsa attacks

From NoorQureshi/security-skills · View interactive version

Crypto rsa attacks is an AI agent skill from the GitHub repository NoorQureshi/security-skills. 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

How to use this skill

Skill file

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

  1. Extract parameters. From a PEM: openssl rsa -pubin -in key.pem -text -noout (gives n, e).

From a JWT: decode the header/key. Note e and the bit-length of n.

  1. Match the weakness → attack:

of c (no modular reduction happened). Also Håstad broadcast if the same msg is sent to

several keys.

encryption enables chosen-ciphertext games.

  1. Automate the triage with RsaCtfTool (rsactftool --publickey key.pem --uncipher c runs the

above battery), then finish by hand once you know which weakness hit.

  1. Recover and use — with p,q: d = e^-1 mod (p-1)(q-1), decrypt c, or re-sign to forge a

token/signature.

Gotchas

a misconfiguration, not the algorithm. Confirm it's textbook/weak first.

that "looks" right but fails; verify by decrypting a known value.

skill is for weak RSA keys themselves.

(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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.