Coding

rsa-ctf-skills

Try it

集成11种RSA攻击算法的CTF解题工具,支持factordb在线分解;当用户需要解密RSA密文、分解n模数、分析CTF密码学题目或实现特定RSA攻击场景时使用

What it does

任务目标 本工具用于:CTF比赛中的RSA密码学题目求解 能力包含:11种常见RSA攻击算法、多种输入方式、统一输出格式 触发条件:用户需要解密RSA密文、分解大整数、或针对特定RSA漏洞进行攻击时

The skill document

RSA CTF解题工具

任务目标

  • 本工具用于:CTF比赛中的RSA密码学题目求解
  • 能力包含:11种常见RSA攻击算法、多种输入方式、统一输出格式
  • 触发条件:用户需要解密RSA密文、分解大整数、或针对特定RSA漏洞进行攻击时

前置准备

  • 依赖说明:
    gmpy2>=2.1.0  # 高性能大整数运算
    sympy>=1.10.0  # 数论函数支持
    

操作步骤

  • 标准流程:

    1. 识别攻击场景:根据题目提供的参数选择攻击方式(见下方攻击类型列表)
    2. 准备输入数据:根据攻击方式收集必要的参数(n, e, c, p, q, d, dp等)
    3. 执行攻击脚本:调用 scripts/rsa_solver.py 执行对应攻击
    4. 解析输出结果:获取明文或中间结果(p, q, d等)
  • 攻击类型快速选择:

    场景攻击方式关键特征
    已分解的nfactorn在factordb数据库中
    明文很短small_em^e < n
    相同n,不同ecommon_modulus多组(e1,c1), (e2,c2)
    泄露dd_leak已知私钥d
    d过小wienerd < n^0.25
    已知p,qnecpq分解完成
    广播攻击crt同一明文,多个n
    dp泄露dp_leak已知dp = d mod (p-1)
    e=2rabinRabin密码系统
    e为2的幂e_power_twoe = 2^k
    e与phi不互素non_coprime_egcd(e,phi) > 1

资源索引

  • 核心脚本:见 scripts/rsa_solver.py(用途:执行所有RSA攻击算法)
  • 攻击指南:见 references/attack-guides.md(何时读取:需要了解攻击原理或选择攻击方式)

使用示例

示例1:低指数攻击

python scripts/rsa_solver.py small_e --n 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137217 --e 3 --c 1271605856918912462699983859985905842276423867777030740152682859600890050685898590999105752584595630467013299575519203653123853137178437196621237640679243779749827039090719670714605250972696434557873580368129958503762635734086800950594749148977042336639587689829975573162748323567814294896446597830609375

示例2:已知p,q解密

python scripts/rsa_solver.py necpq --p 61 --q 53 --e 17 --c 2790

示例3:Wiener攻击

python scripts/rsa_solver.py wiener --n 905016087923017239 --e 3 --c 123456789

示例4:共模攻击

python scripts/rsa_solver.py common_modulus --n 123456789 --e1 3 --c1 111 --e2 5 --c2 222

注意事项

  • 所有数值参数支持大整数,直接输入即可
  • 脚本会自动清理输入中的空格和换行符
  • 输出明文优先尝试UTF-8解码,失败则输出十六进制或整数形式
  • 某些攻击(如factor)可能耗时较长,请耐心等待
  • 选择攻击方式前,先分析题目提供的参数信息

常见问题

  • Q: 如何判断使用哪种攻击? A: 先列出所有已知参数,参考"攻击类型快速选择"表格,或查阅 references/attack-guides.md 获取详细指导

  • Q: 分解n失败怎么办? A: 尝试使用费马分解(factor),或检查是否有其他泄露信息(如dp)

  • Q: 明文输出乱码? A: 可能是加密数据,查看输出的十六进制值或整数形式

Related skills

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván559 installs18 stars

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants4.3k installs296 stars

Run Git operations — commits, branches, merges, rebases, conflict resolution, and recovery — with safety rules enforced.

by Iván535 installs31 stars

More from moxin1044

Browse all skills

Generate runnable Python web crawlers from a target URL, with library selection, JS reverse engineering, and anti-bot handling.

by 末心3 installs

麦当劳MCP平台集成,提供餐品营养查询、外送点餐、配送地址管理、优惠券管理、积分兑换等20个完整功能;当用户需要查询麦当劳餐品营养、下单外卖、管理地址、查询或领取优惠券、兑换积分商品时使用

by moxin104418 installs

QR code scanning and generation. Invoke when user needs to scan/decode QR codes from images, generate QR codes (text, URL, WiFi), or mentions QR code related...

by moxin104421 installs1 stars

Recognizes CAPTCHA images using ddddocr library. Invoke when user needs to recognize/decode CAPTCHA images or mentions captcha verification.

by moxin104427 installs1 stars

网络空间资产搜索引擎,支持 IP/域名/端口/协议/证书等多维度查询;当用户需要进行网络资产发现、安全研究、漏洞资产定位、证书分析或需要查询特定特征的互联网资产时使用

by moxin104420 installs

集成60+正则表达式检测规则,支持PHP、Java、Python、Go等语言的代码安全审计

by moxin10442 installs