首页 > 其他分享 >2023Ciscn初赛WriteUp

2023Ciscn初赛WriteUp

时间:2023-06-22 20:00:41浏览次数:51  
标签:int WriteUp 初赛 k1 2023Ciscn split l0 print readline

2023Ciscn初赛WriteUp

基于国密SM2算法的密钥密文分发

SM2 密钥在线生成工具 (const.net.cn)生成密钥,发送公钥

allkey接口返回服务器端pubkey明文,privatekey密文以及randomString密文

search接口可以直接拿到randomstring明文也就是C

用C作为密钥用SM4_CBC解密privatekey

quantum拿密文,用上面解出的privatekey解出明文,然后check通过

可信度量

传统艺能非预期:grep -ra “flag{” / 2>/dev/null

Sign_in_passwd

一共两行,第一行base64密文,用第二行URLdecode后作为base64换表,解出flag

BB84

exp:

f = open('info.csv', 'r')
l0 = [int(i) for i in f.readline().split(',')[1:]]
l1 = [int(i) for i in f.readline().split(',')[1:]]
l2 = [int(i) for i in f.readline().split(',')[1:]]
l3 = [int(i) for i in f.readline().split(',')[1:]]
l4 = [int(i) for i in f.readline().split(',')[1:]]
k = ''
for i in range(3000):
	if l1[i] + l2[i] + l3[i] + l4[i] == 1:
		if (l0[i] == 1 or l0[i] == 2) and (l1[i] != 1 and l2[i] != 1):
			continue
		elif (l0[i] == 3 or l0[i] == 4) and (l3[i] != 1 and l4[i] != 1):
			continue
		elif l0[i] == 1 or l0[i] == 3:
			k += '0'
		elif l0[i] == 2 or l0[i] == 4:
			k += '1'
		else:
			exit(0)

print(k)
m = len(k)
print(len(k))
a = 1709
b = 2003
x = 17
k1 = ''
for i in range(336):
	k1 += k[x]
	x = (x*a+b)%m
print(k1)
k1 = int(k1,2)
print(k1)
c = 
m = k1^c
from Crypto.Util.number import *
print(long_to_bytes(m))

badKey1

定位到唯一有可能会出问题的代码:

if Integer(n).gcd(d) != 1:
	raise ValueError("RSA private exponent is not coprime to modulus")
# Modulus must be product of 2 primes

考虑使\(d=k_1*p\)

\(e*d=k_2(p-1)(q-1)+1\)

\(ek_1p=k_2(p-1)(q-1)+1\)

可得\(p*[(q-1)*k_2-k_1*e]=(q-1)*k_2-1\)

对上式模e可得 \((q-1)*k_2-1 \equiv p*(q-1)*k_2 \pmod{e}\)

exp:

e = 65537
while True:
    q = getPrime(512)
    for k2 in range(e):
        x = (q-1)*k2
        x %= e
        if x == 0:
            continue
        if ((q-1)*k2-1) % x == 0:
            p = ((q-1)*k2-1)//x
            if isPrime(p) and p.bit_length()==512:
                print(p,q)
                break

标签:int,WriteUp,初赛,k1,2023Ciscn,split,l0,print,readline
From: https://www.cnblogs.com/sCh3n/p/17498233.html

相关文章

  • 2023红明谷杯WriteUp
    2023红明谷WriteUpItTakesTwo!(赛后)比赛的时候脑瘫矩阵除的方向整错了,卡半天没出...最后没时间了#taskfromsage.allimport*fromCrypto.Util.numberimport*fromosimporturandomfromsecretimportflagn=16bound=2^15A=[ZZ.random_element(-bound,bo......
  • 第五届“强网杯”全国网络安全挑战赛-线上赛Writeup
    文章目录WEB[强网先锋]赌徒[强网先锋]寻宝MISC签到BlueTeamingISO1995CipherManEzTime问卷题WEB[强网先锋]赌徒目录扫描发现www.zip下载得到源码index.php<metacharset="utf-8"><?php//hintisinhint.phperror_reporting(1);classStart{public$name='guest';......
  • 2021数字中国创新大赛虎符网络安全赛-Writeup
    文章目录Web签到“慢慢做”管理系统Misc你会日志分析吗Web签到http://cn-sec.com/archives/313267.htmlUser-Agentt:zerodiumsystem("cat/flag");“慢慢做”管理系统根据题目提示,这里第一步登录应该利用一些字符串被md5($string,true)之后会形成如下,从而造成注入PSC:\Users\A......
  • 第十四届全国大学生信息安全竞赛-线上赛Writeup
    文章目录场景实操开场卷WEBeasy_sqleasy_sourceMISCtinytrafficrunning_pixel场景实操二阶卷WEBmiddle_sourceMISC隔空传话场景实操冲刺卷MISCrobot场景实操开场卷WEBeasy_sql有sql报错简单fuzz了一下发现过滤了union、information、column、inno等关键字。无表名,无列名注入......
  • 2021-DASCTF-三月赛-Writeup
    文章目录WEBBestDBez_serializebaby_flaskez_loginMISC签到简单的png隐写雾都孤儿小田的秘密Ascii_art问卷调查和团队的师傅们组队拿了个第十,师傅们带飞,我就是团队的MVP(MostVegetablePeople)WEBBestDB简单的SQL注入/?query=mochu"or/**/1=1%23/?query=mochu"order/**/by/**/......
  • 2020 纵横杯 线上赛 MISC部分Writeup
    文章目录签到马赛克My_Secret问卷调查签到oct_str='[0146,0154,0141,0147,0173,0167,063,0154,0143,0157,0155,0145,0137,0164,0157,0137,062,0157,0156,0147,0137,0150,063,0156,0147,0137,0142,0145,061,0175]'oct_list=oct_str.replace(&q......
  • 白帽子社区端午节活动-白帽寻宝记-纪念屈原Writeup
    搜索引擎找一下即可得知:姓:芈氏:屈名:平字:原md5(芈屈平原,32)=16ccb09f96f27af192f541992560d695解压后先查看文件先来看看这个吧在两张图片的的中间存在一串base64解码得到WingDing编码◻︎♋︎⬧︎⬧︎⬥︎□︎❒︎♎︎♓︎⬧︎♋︎♌︎❍︎◻︎♐︎♓︎●︎♏︎⬥︎♓︎⧫︎♒︎♋︎♌︎♓︎⧫︎♎︎♏︎◻︎⧫︎♒︎□︎♐︎......
  • 第四届BJDCTF 4th-部分Writeup
    文章目录Webeasy_phpMisc马老师的秘籍FakePicCryptoasaReverseEasyVHWebeasy_php经过简单代码审计,发现可以通过变量覆盖来读取文件?var[template][tp1]=/etc/passwd&tp=tp1之后使用php://filter伪协议读取template.php的源码?var[template][tp1]=php://filter/read=convert.base......
  • 2022 RealWorld CTF体验赛Writeup
    文章目录DigitalSouvenirlog4flagBe-a-Database-HackertheSecretsofMemorybabyflaglabFlagConsoleBe-a-Database-Hacker2JavaRemoteDebuggerDigitalSouvenirrwctf{RealWorldIsAwesome}log4flag有一些正则过滤网上bypass方法很多,随便找一个就行${${::-j}ndi:${lower:r......
  • “东华杯”2021年大学生网络安全邀请赛 暨第七届上海市大学生网络安全大赛线上赛MISC-
    文章目录checkinprojectJumpJumpTigerwhere_can_find_code题目附件请自取:链接:https://pan.baidu.com/s/1T9nG-CDg_D8QYQZapuxucg提取码:2wubcheckin+AGYAbABhAGcAewBkAGgAYgBfADcAdABoAH0-UTF-7编码UTF-7在线解码站:http://toolswebtop.com/text/process/decode/utf-7flag{dhb_......