Skip to content
Agentmart
Submit a tool

ctf-crypto-advanced-math

CTF advanced math crypto.

Skill by Yoraexe

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/yoraexe-ctf-crypto-advanced-math

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

CTF advanced math crypto. LLL lattice attacks, Coppersmith method, Pohlig-Hellman on smooth curves, isogeny graph traversal, quaternion RSA factoring, LWE via CVP, Manger padding oracle, non-permutation S-box collision, polynomial CRT in GF(2). Triggers: 'lll attack', 'lattice crypto', 'coppersmith', 'pohlig-hellman', 'isogeny', 'lwe', 'lattice', 'manger oracle', 'quaternion rsa', 'gf2 polynomial'.

Use cases: finance

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/ctf-crypto-advanced-math

What's inside

Skill name
ctf-crypto-advanced-math
Description
CTF advanced math crypto. LLL lattice attacks, Coppersmith method, Pohlig-Hellman on smooth curves, isogeny graph traversal, quaternion RSA factoring, LWE via CVP, Manger padding oracle, non-permutation S-box collision, polynomial CRT in GF(2). Triggers: 'lll attack', 'lattice crypto', 'coppersmith', 'pohlig-hellman', 'isogeny', 'lwe', 'lattice', 'manger oracle', 'quaternion rsa', 'gf2 polynomial'.
License
MIT
Instructions
304 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# CTF Crypto — Advanced Mathematical Attacks

LLL, Coppersmith, isogenies, quaternion RSA, LWE, Manger oracle.

## Install

```bash
sage  # SageMath for lattice/number theory
pip install fpylll z3-solver --break-system-packages
```

---

## Phase 1: LLL Lattice Attack

```python
# Pattern: hints h_i = flag * p_i + noise (noise is small)
# LLL finds short vector → reveals p_i values

from sage.all import *

# Collect 3 server hints:
h1, h2, h3 = (hint1, hint2, hint3)  # from server

M = matrix(ZZ, [
    [1, 0, 0, h1],
    [0, 1, 0, h2],
    [0, 0, 1, h3],
    [0, 0, 0, -1]
])
reduced = M.LLL()
# Short vector: contains p1, p2, p3
# Recover flag: (h1 - noise) // p1
```

---

## Phase 2: Merkle-Hellman Knapsack via LLL

```python
from sage.all import *

def crack_knapsack(pubKey, encoded):
    """Crack Merkle-Hellman knapsack encryption via LLL."""
    nbit = len(pubKey)
    A = Matrix(ZZ, nbit + 1, nbit + 1)
    
    for i in range(nbit):
        A[i, i] = 1
        A[i, nbit] = pubKey[i]
    A[nbit, nbit] = -int(encoded)
    
    res = A.LLL()
    
    for row in res:
        if row[-1] == 0 and all(b in (0, 1) for b in row[:-1]):
            plaintext_bits = list(row[:-1])
            return bytes(int(''.join(map(str, plaintext_bits[i:i+8])), 2) 
                        for i in range(0, len(plaintext_bits)-7, 8))
    return None

# Usage:
flag = crack_knapsack(server_pubkey, server_ciphertext)
```

---

## Phase 3: Coppersmith — Partially Known Prime

```python
from sage.all import *

# Pattern: p = base + 10^k * x where base is known, x is small
# Condition: x < N^(1/e) ≈ N^0.25 for linear polynomial

def coppersmith_known_prefix(N, base, k):
    """Find small x where p = base + 10^k * x divides N."""
    R = PolynomialRing(Zmod(N), 'x')
    x = R.gen()
    
    inv_10k = int(pow(10**k, -1, N))
    f = x + int(base * inv_10k % N)  # Must be monic
    
    roots = f.small_roots(X=2**70, beta=0.5)
    if roots:
        x_val = int(roots[0])
        p = base + 10**k * x_val
        q = N // p
        if p * q == N:
            return p, q
    return None, None

p, q = coppersmith_known_prefix(N, known_base, k_value)
if p:
    phi = (p-1)*(q-1)
    d = pow(e, -1, phi)
    m = pow(ct, d, N)
```

---

## Phase 4: Pohlig-Hellman (Smooth Curve Order)

```python
from sage.all import *

# ECC with smooth order → Pohlig-Hellman DLP

def pohlig_hellman_ecc(G, P, E, n):
    """Solve discrete log P = d*G where E.order() is smooth."""
    factors = factor(n)
    partial_logs = []
    
    for (prime, exp) in factors:
        cofactor = n // (prime ** exp)
        G_sub = cofactor * G
        P_sub = cofactor * P
        
        d_sub = discrete_log(P_sub, G_sub, ord=prime**exp)

From Yoraexe/ceobe, MIT.

Signals

Stars
1
Forks
1
Open issues
0
Last commit (this folder)
Jul 17, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Yoraexe

Cite this page

ctf-crypto-advanced-math skill. Agent Mart. https://agentmart.dev/skills/yoraexe-ctf-crypto-advanced-math (last updated 2026-10-24)