[HNCTF 2022 Week1]baby_rsa

源代码:

复制代码
from Crypto.Util.number import bytes_to_long, getPrime
from gmpy2 import *
from secret import flag
m = bytes_to_long(flag)
p = getPrime(128)
q = getPrime(128)
n = p * q
e = 65537
c = pow(m,e,n)
print(n,c)
# 62193160459999883112594854240161159254035770172137079047232757011759606702281
# 17331436837911040930486942133359735652484926528331507431552667656734821231501

攻击代码:

复制代码
from Crypto.Util.number import *
n=62193160459999883112594854240161159254035770172137079047232757011759606702281
c=17331436837911040930486942133359735652484926528331507431552667656734821231501
p= 234560843346150602519484260867514743467
q=n//p
d=inverse(65537,(p-1)*(q-1))
m=pow(c,d,n)
print(long_to_bytes(m))
# b'NSSCTF{Welc0m3_t0_7h3_RSA_w0r1d}'

得到flag:

NSSCTF{Welc0m3_t0_7h3_RSA_w0r1d}

相关推荐
玥轩_5211 天前
BUUCTF [WUSTCTF2020]spaceclub 1
安全·网络安全·ctf·buuctf·ascii·spaceclub·wustctf2020
unable code3 天前
攻防世界-Rerverse-game
网络安全·ctf·reverse
unable code4 天前
攻防世界-Reverse-insanity
网络安全·ctf·reverse
还鮟5 天前
CTF Web PHP弱类型与进制绕过(过滤)
php·ctf
玥轩_52115 天前
BUUCTF [UTCTF2020]File Carving 1
安全·网络安全·elf·ctf·misc·buuctf·png隐写
wyjcxyyy20 天前
DIDCTF-应急响应
笔记·ctf·应急响应与电子取证
kali-Myon21 天前
攻防世界[level7]-Web_php_wrong_nginx_config
前端·nginx·安全·php·web·ctf·攻防世界
Bruce_Liuxiaowei25 天前
某靶场CTF题目:利用Apache APISIX默认Token漏洞(CVE-2020-13945)获取Flag
网络安全·apache·ctf
轨迹H1 个月前
【春秋云镜】CVE-2023-2130漏洞复现exp
网络协议·网络安全·渗透测试·ctf·cve
mottte1 个月前
BUUCTF[极客大挑战 2019]Havefun 1题解
php·web·ctf