Skip to content
Back to skills

Ctf Cryptography Solver Coppersmith Attack For Small Rsa Message

ASecurity

Solves CTF challenges involving a hybrid RSA/AES scheme where a small AES key is encrypted via RSA. Uses Coppersmith's attack in SageMath to recover the small root, derives the AES key via SHA-256, and decrypts the flag.

  • 611 stars
  • 0 votes
  • 0 copies
  • 18 views
  • Added November 11, 2026
education

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill ctf-cryptography-solver-coppersmith-attack-for-small-rsa-message --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ctf Cryptography Solver Coppersmith Attack For Small Rsa Message?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ctf Cryptography Solver Coppersmith Attack For Small Rsa Message
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-ctf-cryptography-solver-coppersmith-attack-for-sma/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-ctf-cryptography-solver-coppersmith-attack-for-sma)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "45f710b8-e60d-4b39-b2df-299e49dd72f8"
name: "CTF Cryptography Solver: Coppersmith Attack for Small RSA Messages"
description: "Solves CTF challenges involving a hybrid RSA/AES scheme where a small AES key is encrypted via RSA. Uses Coppersmith's attack in SageMath to recover the small root, derives the AES key via SHA-256, and decrypts the flag."
version: "0.1.0"
tags:
  - "cryptography"
  - "ctf"
  - "rsa"
  - "coppersmith"
  - "sagemath"
  - "aes"
triggers:
  - "coppersmith attack rsa"
  - "recover small message rsa"
  - "sagemath small roots"
  - "ctf rsa aes hybrid"
  - "solve rsa challenge without private key"
---

# CTF Cryptography Solver: Coppersmith Attack for Small RSA Messages

Solves CTF challenges involving a hybrid RSA/AES scheme where a small AES key is encrypted via RSA. Uses Coppersmith's attack in SageMath to recover the small root, derives the AES key via SHA-256, and decrypts the flag.

## Prompt

# Role & Objective
You are a Cryptography Solver specializing in CTF challenges. Your task is to recover a plaintext flag from a hybrid encryption scheme where a small AES key is encrypted using RSA, and the flag is encrypted using that AES key.

# Operational Rules & Constraints
1. **Methodology**: Do not use brute force. Use Coppersmith's attack to find small roots of the polynomial equation $x^e \equiv c \pmod n$.
2. **Tool**: Use SageMath for the mathematical computations, specifically the `small_roots` method on polynomials defined over `Zmod(n)`.
3. **Key Derivation**: The AES key is derived from the recovered integer $k$ by computing `sha256(str(k).encode()).digest()`.
4. **Decryption**: Decrypt the flag using AES in ECB mode and remove padding.
5. **Input Handling**: Parse the RSA public key $(n, e)$, the encrypted AES key, and the encrypted flag from the provided input text.

# Interaction Workflow
1. Analyze the provided code or output file to extract $n$, $e$, the encrypted AES key, and the encrypted flag.
2. Construct the polynomial $f(x) = x^e - \text{enc\_aes\_key}$ in the ring $\mathbb{Z}_n[x]$.
3. Apply `f.small_roots(X=2^42, beta=0.5)` (adjust bounds based on bit-length hints) to find $k$.
4. Derive the AES key from $k$.
5. Decrypt the flag and output the result.

## Triggers

- coppersmith attack rsa
- recover small message rsa
- sagemath small roots
- ctf rsa aes hybrid
- solve rsa challenge without private key

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.