陕西省大学生网络安全技能大赛 2023
Misc
管道
stegsolve一把梭,稍微试试通道和顺序即可:
可是雪啊飘进双眼
snow.txt里有部分不可见字符,结合题目名猜测是snow隐写,但恢复额外信息需要密码;au分析hint.wav,利用莫斯得到密码为WOAISHANXI,snow隐写得到解压密码shanxiroujiamo:
解压得到hide.jpg和key.jpg,binwalk分离key.jpg得到2.jpg,通过2.jpg上的字符对照key.jpg得到最后一个口令,最后linux下steghide求冗余信息即可恢复flag:
Crypto
奇怪的sar
前一半就是lcg无参数求解,具体来说可通过构造两个模数的倍数做gcd求模数,已知模数再恢复a和b即可,最后逆过来求seed。seed = p^q,因此做一个剪枝算法即可分解n。
from Crypto.Util.number import *
from gmpy2 import *
import sys # 导入sys模块
sys.setrecursionlimit(3000)
n = 24044063028844014127418595700558729326190738802687551098858513077613750188240082663594575453404975706225242363463089392757425008423696150244560748490108425645064339883915929498539109384801415313004805586193044292137299902797522618277016789979196782551492020031695781792205215671106103568559626617762521687128199445018651010056934305055040748892733145467040663073395258760159451903432330506383025685265502086582538667772105057401245864822281535425692919273252955571196166824113519446568745718898654447958192533288063735350717599092500158028352667339959012630051251024677881674246253876293205648190626145653304572328397
c = 14883053247652228283811442762780942186987432684268901119544211089991663825267989728286381980568977804079766160707988623895155236079459150322336701772385709429870215701045797411519212730389048862111088898917402253368572002593328131895422933030329446097639972123501482601377059155708292321789694103528266681104521268192526745361895856566384239849048923482217529011549596939269967690907738755747213669693953769070736092857407573675987242774763239531688324956444305397953424851627349331117467417542814921554060612622936755420459029769026126293588814831034143264949347763031994934813475762839410192390466491651507733968227
n1 = 137670797028117726329534659376416493367957852768263083700434198723955223922183386928456013703791817601151754417828367188186912209697081337658512940425529211281290630976671911327606706953154608427885071841566358882014021242768190762103365969320014710368160869517966437591299370072284930202718943785099916898209
enc = [101737402423360536260958229788866250367716256968287178187558336481872788309727545478736771692477306412259739856568227009850831432381180909815512654609798228982433082928392936844193974517574281026029228179913579225687286945054175762659252515268270399329404664775893089132101252158524000295899895962104782878103, 37355684997487259669354747104430314505839306993101096210478266975184357608742619438151118843905165289324251734149329596611854110739738607745107961453008343886403511257039401245484528985856920723694142989180291902939107642020398816995584650913417698279936585230648639613028793148102494100898288564799111024672, 58677759595639211550435023449462812079890625834313820227189340593596480924226619376872336960357021314847975570175387751632125898437020801920862764666175594874885587518469384576361008639967382152477408865298759987606155830674598034578657554841283906976808719095766296677147076808250022898199866472085742989883, 61841632061818470036288407041172200048676249787061823756736224887116113640875444187463656719652972233582538657844183320242896612625995507633237074900538692102956750184024574603018257213912795847625926653585010890014291951218199774765624860625726555381815237888483974246173727262881650634287497285246796321130, 7618244158597756867387754433401378508070531356170836765779245254233413235386172690733378371343899289510629513166609513857423499004879497768588665836034791151090648182168421570449377835494883902907064269417199065924565304966242954268460876762295575715334403142360198583318323418975108290758222653083011275844, 106276841058222138994123556391380518368163552919305398852484130331884811278068151915582752795463570013359693610495645946230044828403849434903415989487924763756589202218361370725532394478569304449884620166937809374355282324069422109879874964479199929174533104879048175102339134830614476339153367475243140156049, 54574757236475194407137831004617398270525645136836468973535243574661043352422598443323384197261529289829451787586618886007968913414366545291507686451774653217577858375086817168124727394445167274831801876424578654786480330913650363551771258617533162477541882336257099777912519011890593910515860435759936717781, 15567087904962670212229825713697043597876172881256160613623383896576159414077875401117959132252949501643234465895697270909085179587988268864498823765197994781747034644583869111599516151129007414228897958635533561248099927507725880289417298814703767549313482346652043188826434944367260731729064673486516315207, 10757138067445225320504771816863593606847219020279502671965413470243269270456133564739090471033889069283122519782525412134604896073598293410977787230108853737796640474070194546344190858079847734817109910030714675258996740807873872365037296486121580542250452443305370358407408558223735250474249180772656905880, 68097848963949068260912124852455363245291187860801223898468533992003737157497436432969031551088942445561676359631354280979357356539429863946694570097104716411407829017684705171462511875250672979623888463245258237680782731827727876526411531354910982579164963119481534453651300645314177478026462894232377307020]
t0 = enc[1] - enc[0]
t1 = enc[2] - enc[1]
t2 = enc[3] - enc[2]
t3 = enc[4] - enc[3]
x1 = t2*t0 - t1*t1
x2 = t3*t1 - t2*t2
n1 = gcd(x1,x2)
print(n1)
a = (enc[2] - enc[1]) * inverse(enc[1] - enc[0],n1) % n1
b = (enc[1] - enc[0] * a) % n1
seed = (enc[0] - b) * inverse(a,n1) % n1
# def findp(p,q):
# if len(p)==1024:
# pp=int(p,2)
# if n%pp==0:
# print(pp)
# print(n//pp)
# else:
# l=len(p)
# pp=int(p,2)
# qq=int(q,2)
# if (pp ^ qq)%(2**l)==seed%(2**l) and pp*qq%(2**l)==n%(2**l):
# findp('1'+p,'1'+q)
# findp('1'+p,'0'+q)
# findp('0'+p,'1'+q)
# findp('0'+p,'0'+q)
#
# findp('1','1')
p = 136684274356315612487659217209422309110679526145315687701807802133803279866185818899991993884467313793599158843950483228582160463511388849758567202472905559846777250024605202939046541380251340624743050639969339200934727970697454003281829379562185118379160449090683059062519707425788095221998247228048681125693
q = n//p
f = (p-1)*(q-1)
d = inverse(65537,f)
print(long_to_bytes(pow(c,d,n)))
HaM3
... CryptoCTF2021的一个题,参考春哥,讲的很清楚。
BigDataEnc
没做出来,赛后请教了hash_hash师傅。举例推导会好理解一些:
代码实现颇有意思hhh:
import pickle
import sys
from gmpy2 import *
from Crypto.Util.number import *
def loop(t,g):
t0 = t
c = 0
while (t0 == t):
t = gcd(g,t)
g = g // t
c+=1
return t,c,g
# 该设置让超长的string转int
sys.set_int_max_str_digits(0)
with open('a', 'rb') as f1:
a = int(pickle.load(f1))
with open('b', 'rb') as f2:
b = int(pickle.load(f2))
g = gcd(a,b)
t = iroot(g,20)[0]
ga = a//g
gb = b//g
t1 = gcd(ga,t)
ga_ = ga // (t1**3)
# one_place = [0]
# while True:
# try:
# t1,c,ga_ = loop(t1,ga_)
# one_place.append(c+one_place[-1])
# except:
# print(one_place)
m = ['0'] * 255
one_place = [1, 2, 4, 5, 6, 9, 10, 13, 14, 16, 17, 21, 22, 24, 25, 28, 30, 32, 33, 36, 38, 41, 42, 46, 49, 50, 57, 58, 60, 61, 62, 65, 66, 67, 70, 73, 74, 75, 81, 82, 84, 85, 86, 88, 89, 94, 97, 98, 100, 102, 104, 105, 109, 113, 114, 116, 121, 122, 124, 125, 129, 130, 132, 133, 137, 138, 140, 144, 145, 149, 153, 154, 161, 162, 163, 169, 170, 173, 177, 178, 179, 184, 185, 189, 190, 193, 194, 196, 197, 200, 201, 204, 206, 209, 210, 213, 214, 217, 218, 222, 225, 226, 227, 233, 234, 235, 238, 241, 242, 244, 245, 246, 249, 250, 253, 254]
for i in one_place:
m[i] = '1'
mm = ''.join(m)
print(mm)
print(long_to_bytes(0b011011100110011011000110110010101100101001100010011000000110111001110010011100000110111011000010011010101100010001101000011011000110110001101000110001000110000001110000011001000111000011000110011011001100101001100110011000100111000001110010011011100110011))