lattice-crypto-attacks

Applies LLL/BKZ lattice reduction and Coppersmith methods to cryptanalyze RSA, DSA/ECDSA, and knapsack ciphers.

Updated Jun 5, 2026
One-click install
npx skills add https://github.com/lNwNl/Praxis --skill lattice-crypto-attacks-lnwnl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: lattice-crypto-attacks
Source: https://github.com/lNwNl/Praxis/tree/main/skills/_disabled/lattice-crypto-attacks
Command: npx skills add https://github.com/lNwNl/Praxis --skill lattice-crypto-attacks-lnwnl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Cryptographic CTF challenges involving RSA small roots, biased DSA/ECDSA nonces, or knapsack ciphers require precise lattice constructions that base models frequently get wrong, such as incorrect dimensions, missing scaling factors, or misapplied Coppersmith bounds. ## Core Features & Use Cases - Coppersmith Small Roots: Recover stereotyped RSA messages, partially exposed factors, and small private exponents via univariate and multivariate Coppersmith (Boneh-Durfee) with SageMath small_roots. - Hidden Number Problem Attacks: Recover DSA/ECDSA private keys from biased or reused nonces by reducing the problem to CVP on a signature lattice. - Knapsack and NTRU Attacks: Solve low-density subset sum problems with CJLOSS embedding and recover NTRU keys via circulant lattice reduction. - Use Case: Given an ECDSA challenge where 100 signatures leak one MSB of each nonce, build the HNP lattice, run LLL in SageMath, and extract the private key. ## Quick Start Ask the agent to recover an RSA plaintext where the upper bits of the message are known using the Coppersmith small roots method in SageMath.

Frequently Asked Questions about lattice-crypto-attacks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Coppersmith's method to attack RSA with partial information?▼

Coppersmith's method finds small roots of a polynomial modulo N using SageMath's small_roots function. For a stereotyped message, model f = (known_msb + x)^e - c and call small_roots with X set to the unknown bit bound, which must satisfy X < N^(1/e).

How to recover an ECDSA private key from biased nonces?▼

Biased nonces reduce to the Hidden Number Problem, solved as CVP on a lattice built from the signatures. With roughly one leaked bit per nonce you need about 100 signatures; a fully reused nonce needs only two signatures and direct algebra, no lattice.

LLL vs BKZ: which lattice reduction should I use?▼

LLL runs in polynomial time and suffices for most CTF challenges, so start there. If LLL fails to produce a short enough vector, switch to BKZ with block size 20-40, which gives better approximation at exponential cost in the block size.

Why does SageMath small_roots return an empty list?▼

Empty results usually mean the root bound X exceeds the Coppersmith limit N^(1/d), or beta is set incorrectly. Reduce X, increase epsilon toward 1/100, and use beta=0.5 when finding roots modulo an unknown factor p of size about the square root of N.

When does the knapsack lattice attack work?▼

The low-density subset sum attack works when the knapsack density n / max(log2 ai) is below 0.9408. Build the CJLOSS embedding lattice with a scaling factor near sqrt(n)/2 and apply LLL; super-increasing knapsacks need only a greedy algorithm instead.