Ctf crypto

From wgpsec/AboutSecurity · View interactive version

Ctf crypto is an AI agent skill from the GitHub repository wgpsec/AboutSecurity. CTF 密码学攻击技术。用于 RSA/AES/ECC/格密码/PRNG/ZKP/古典密码等 CTF 加密类挑战。当遇到加密数据需要破解、密码学相关 CTF 题目、需要分析加密算法弱点、或识别到密文/公钥/密码学参数时使用。覆盖从古典替换密码到现代公钥密码、椭圆曲线、格攻击、零知识证明等全方位密码学攻防技术

How to use this skill

Skill file

CTF 密码学攻击

深入参考

以下参考资料按需加载,根据识别出的具体方向选择对应文件:


分类决策树

题目涉及加密?
├─ 古典密码(Caesar/Vigenere/XOR/替换) → [references/classic-ciphers.md](references/classic-ciphers.md)
├─ 对称加密(AES/DES/RC4/分组密码)
│  ├─ ECB → 块重排 / 逐字节oracle
│  ├─ CBC → 比特翻转 / Padding Oracle
│  └─ 流密码 → LFSR / Berlekamp-Massey
├─ RSA
│  ├─ 小e → 开根号         ├─ 小d → Wiener
│  ├─ p≈q → Fermat          ├─ 公共模数 → ExtGCD
│  └─ 部分已知因子 → Coppersmith (SageMath)
├─ ECC
│  ├─ 阶有小因子 → Pohlig-Hellman
│  ├─ 奇异曲线 → 映射到加法群
│  └─ ECDSA nonce重用 → 恢复私钥
├─ 格/LWE → Babai CVP / LLL 短向量
├─ PRNG → MT19937 untemper / LCG / V8 xs128p
├─ ZKP → 碰撞/预测盐 / Z3求解
└─ 哈希 → 长度扩展(hashpump) / 生日攻击

速查工具

| 场景 | 工具/命令 |

|------|----------|

| RSA 自动攻击 | RsaCtfTool.py -n N -e E --uncipher C |

| 替换密码 | quipqiup.com |

| SageMath | sage -python script.py(Coppersmith/ECC/格) |

| Z3 约束求解 | pip install z3-solver → BitVec / Int |

| PRNG MT19937 | pip install not_random(浮点恢复状态) |

| V8 Math.random | d0nutptr/v8_rand_buster |

| Padding Oracle | PadBuster / padding-oracle 库 |

| XOR 操作 | from pwn import xor |

常用 Python 库

pip install pycryptodome z3-solver sympy gmpy2

RSA 基础速查

from Crypto.Util.number import inverse, long_to_bytes
phi = (p-1)*(q-1)
d = inverse(e, phi)
m = pow(c, d, n)
print(long_to_bytes(m))

常见模式

RSA 小指数攻击

Padding Oracle 细节

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.