[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}

相关推荐
Jerry_Gao9211 天前
【CTF】【ez-rce】无字母数字绕过正则表达式
正则表达式·php·ctf
Jerry_Gao9212 天前
【CTF】【ez-inject】通过协议层Length字段的溢出进行注入
网络安全·ctf
unable code3 天前
流量包取证-大流量分析
网络安全·ctf·misc·1024程序员节·流量包取证
unable code4 天前
浏览器取证-[GKCTF 2021]FireFox Forensics
网络安全·ctf·misc·1024程序员节·浏览器取证
unable code4 天前
内存取证-[安洵杯 2019]Attack
网络安全·ctf·misc·1024程序员节·内存取证
unable code5 天前
CTF-SPCS-Forensics
网络安全·ctf·misc·1024程序员节·取证
Chen--Xing5 天前
HGAME 2026 -- Crypto -- WriteUp
ctf·crypto·hgame
unable code6 天前
内存取证-卡比卡比卡比
网络安全·ctf·misc·1024程序员节·内存取证
unable code6 天前
内存取证-Stager
网络安全·ctf·misc·1024程序员节·内存取证
unable code7 天前
内存取证-easy_mem_3
网络安全·ctf·misc·1024程序员节·内存取证