D1533/crypto-attacks
GitHub: D1533/crypto-attacks
收集并实现了多种针对RSA、ECC、Diffie-Hellman等常见密码系统的攻击方法的工具仓库。
Stars: 0 | Forks: 0
## 密码攻击
SageMath 和 Python 中密码攻击的实现与概念验证。
## 需求
- SageMath, Python 3
- PyCryptodome
## 结构与内容
### AES 攻击
- [CTR 位翻转攻击](aes/ctr_bit_flipping_attack.py) - 修改密文以在解密时产生选定的明文。
- [ECB 逐字节攻击](aes/ecb_byte_at_a_time.py) - 使用 ECB 加密预言机恢复附加在可控输入中的密钥。
### Diffie-Hellman 攻击
- [GL(n, p) 中的离散对数](diffie-hellman/discrete_log_GL.py) – 求解 GL(n, p) 中的离散对数。
- [Pohlig-Hellman 攻击](diffie-hellman/pohlig_hellman.py) – 当群阶光滑(可分解为小素数)时求解离散对数。
- [小子群攻击](diffie-hellman/small_subgroup_attack_poc.py) – 当群的阶较小时求解离散对数。
### 椭圆曲线攻击
- [ECDSA 偏置随机数攻击](ecc/ecdsa_biased_nonce_attack.py) – 当随机数可部分预测时恢复私钥(格攻击)。
- [ECDSA 随机数重用攻击](ecc/ecdsa_nonce_reuse.py) – 当同一随机数被用于两个签名时恢复私钥。
- [MOV 攻击](mov_attack.py) – 使用 Weil 对将椭圆曲线离散对数归约为有限域离散对数。
- [Smart 攻击](ecc/smart_attack.py) – 求解异常曲线上的离散对数(当 #E = p 时)。
### LWE 攻击
- [Arora-Ge](lwe/arora_ge.py) - 通过求解多项式系统对 LWE 进行代数攻击(适用于小噪声)。
- [最小二乘法攻击](lwe/least_squares_attack.py) - 当未应用模数约简时恢复密钥向量。
### RSA 攻击
- [批量 GCD 攻击](rsa/batch_gcd_attack.py) - 分解共享素数的多个 RSA 模数。
- [盲化攻击](rsa/blinding.py) - 使用签名预言机为禁用消息伪造有效签名。
- [公共模数攻击](rsa/common_modulus_attack.py) - 当使用互素指数和相同模数时恢复明文。
- [Coppersmith 短填充攻击](rsa/coppersmith_short_pad_attack.py) - 当填充太短时恢复消息(未知部分较小)。
- [Franklin-Reiter 攻击](rsa/franklin_reiter.py) - 恢复使用相同模数加密的线性相关消息。
- [Hastad 广播攻击](rsa/hastad_broadcast_attack.py) - 恢复发送给多个接收者且指数较小的明文。
- [小指数攻击](rsa/small_exponent_attack.py) - 当指数较小时直接恢复明文。
- [Wiener 攻击](rsa/wiener_attack.py) - 当 $d < \frac{1}{3} N^{1/4}$ 时恢复 $d$。
## 参考文献
- Boneh, D. (1999). *Twenty Years of Attacks on the RSA Cryptosystem*.
- Arora, S., & Ge, R. (2011). *New algorithms for learning in presence of errors*.
- Menezes, A. J., & Wu, Y.-H. (1997). *The Discrete Logarithm Problem in GL(n, q)*.
- Pohlig, S. C., & Hellman, M. (1978). *An Improved Algorithm for Computing Logarithms over GF(p).*
- Smart, N. P. (1999). *The Discrete Logarithm Problem on Elliptic Curves of Trace One*.
- Menezes, A., Okamoto, T., & Vanstone, S. (1993). *Reducing Elliptic Curve Logarithms to Logarithms in a Finite Field*.
- Breitner, J., & Heninger, N. (2019). *Biased Nonce Sense: Lattice Attacks against Weak ECDSA Signatures in Cryptocurrencies*.
标签:AES, CTR模式, Diffie-Hellman, ECB模式, ECDSA, LWE, MOV攻击, POC, Pohlig-Hellman攻击, PyCryptodome, Python, RSA, SageMath, 位翻转攻击, 共模攻击, 学习with_errors, 密码分析, 密码学, 密码攻击, 密钥恢复, 小整数分解, 手动系统调用, 无后门, 格子攻击, 椭圆曲线密码学, 概念验证, 盲化攻击, 离散对数