zeroshell

zeroshell_1:
打开流量包,找到可疑的ip
alt text
找到之后选中筛选ip.dst == 61.139.2.100
alt text
找到流量,跟踪进去,在refer发现可疑的base64
alt text
赛博厨子解密
alt text
zeroshell_2:
直接咕噜咕噜找cve
alt text
poc直接打!
alt text
alt text
alt text
zeroshell_3:
直接Netstat找就行了
alt text
这里复现环境已经变化了,已经连接不上了
ip是202.115.89.102:8080
zeroshell_4:
在浏览所有文件的时候发现一个奇奇怪怪的配置文件,环境是阿帕奇,但是出现一个.nginx的配置文件,还是在/tmp里,就很怪,cat一看是elf,丢到微步确认是木马
alt text
alt text
zeroshell_5
IDA直接打开,看一下字符串,找到个ip
alt text
就是他了

WinFT

WinFT_1
这里

alt text
这个文件一直在自启,currports一直在报
alt text
查一下地址就找到了
alt text

WinFT_2
alt text
隐藏的计划任务,直接去system32去找,base64就是flag
alt text
alt text

sc05_1
如图
alt text

rand0m

IDA打开一下,shift+f12日常看一眼字符串
alt text
嗯,SUS.
alt text
Python版本要3.12
alt text
根据random这个字符串去找函数
alt text
看样子Pynumber_后面跟个xxx都是需要的函数,找全所有函数
alt text
与运算,移位,异或,幂运算都有了,就一个与没法反推,只能就是爆破了
exp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def circular_shift_left(int_value, k, bit=8):
bit_string = '{:0%db}' % bit
bin_value = bit_string.format(int_value) # 8 bit binary
bin_value = bin_value.rjust(bit * 4, "0")
bin_value = bin_value[k:] + bin_value[:k]
int_value = int(bin_value, 2)
return int_value

def find_numbers(prefix, target_v1, possible_v2s):
for i in range(65536):
num_hex = hex(i)[2:]
full_num = f"{prefix}{num_hex.zfill(4)}{'7F3'}"
number = int(full_num, 16)
v1 = circular_shift_left(number, 4) & 0xFA3AFFFF
if v1 == target_v1:
v2 = (number ^ 0x9E3779B9) >> 11
v2 = pow(v2, 0x10001, 0xFFFFFFFD)
if v2 in possible_v2s:
print("find")
print(full_num)

find_numbers("0x8", 0x12287F38, [0x18D24B3A, 0x98D24B3A])
find_numbers("0xd", 0x4A30F74D, [0x20F1DB77, 0xE0F1DB77])
find_numbers("0x8", 0x23A1268, [0x2DF38403, 0xADF38403])
find_numbers("0x7", 0x88108807, [0xD8499BB6, 0x98499BB6])

rsand

求解flag的两段,题目如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from Crypto.Util.number import getPrime, bytes_to_long
from random import randint
import os

FLAG = os.getenv("FLAG").encode()
flag1 = FLAG[:15]
flag2 = FLAG[15:]

def crypto1():
p = getPrime(1024)
q = getPrime(1024)
n = p * q
e = 0x10001
x1=randint(0,2**11)
y1=randint(0,2**114)
x2=randint(0,2**11)
y2=randint(0,2**514)
hint1=x1*p+y1*q-0x114
hint2=x2*p+y2*q-0x514
c = pow(bytes_to_long(flag1), e, n)
print(n)
print(c)
print(hint1)
print(hint2)


def crypto2():
p = getPrime(1024)
q = getPrime(1024)
n = p * q
e = 0x10001
hint = pow(514*p - 114*q, n - p - q, n)
c = pow(bytes_to_long(flag2),e,n)
print(n)
print(c)
print(hint)
print("==================================================================")
crypto1()
print("==================================================================")
crypto2()
print("==================================================================")

==================================================================
22085673691385548700001659427474199879233351269227410294282295366664219917988874306735394689807794043317962261987126112209635949882060066108692347850409841449894170651591854667244405327938407556907827853419336552210774280975232228677546224182773917062070818813695012067712412271107293302725821594844814126696778403483265541973542109668868389405483129748166226267368495700030783460905946990112691769530650605645814805449306138414067118469625384688908800096804324295020785963746349522339417060594365001190712497412070512110654228191280856471136806704165153644275749314914663318413178062001824108331091754426498270406197
16956593737479305998436326092240674040309478434510142368828931220419900429070914119392946404782457743706835836360717941452160536013610304372177415733551665214780026306041967494005049141693580852435488870744190947693181311493963372853662977282809231530712702212184909167606783043958189287531607766905978176562557045712089246844210658141029848322714203943421655292286678060536594920867763220940988952371633156642625185792412314635589442574484150136830749372334538651116656592378896481529490289378038025752915888414512926941606236542658746653589683109367957327291966783205045351331059077281484137733656523129702542496765
437704380541339576803057391964260700309242756870355941724187922814020375122128701290445428309759606647827135290279316314870567649552168058388178227208966225050091309733262877331017959256454832253338557940183575078716340210761184164538279132083368246330534718975018187862414229411582279413896801552366657112269559236916146345308624075726493276
7960755765418725157180309929903616202229823982215959040313657397594075849508007234890299172041495874139745045818389626400060841943978417442846059583559113425534703415415800607425584695596975532842199180453527166477820878588407165322605897468941566810149984785018672509942978969398693167153514002286746245966246084682173034839772793999196955308834529397741280202639780784012631353326944302461731603871987995122747784524014741509759825562668372537621893693054735959
==================================================================
17838081403758931064151861795547143583158093058430341990251725589352424812951328369409508875125012743685418603879614785103583035973360042048106645580250557282965250330378484698251957107555253836498321531601848135501564767651213745740195253188077484884349736385856328564573202352861244383223682793082305281623682122552204818414134628399662698879704814589138839246794335468949140062554114945214044432006681109960164289436360197840209256077010797580924319345761428423061159688378123566891472384528636853045504232179883754125360009611702391749278400212439686001745395685692699594801712459174498666193427366066833676245583
11696210554205340250800351811260821776625630324159302666748419009669113806641981259017389231397493719793673584167067645488014856249395394374398302422500066067163787310954415136291356236976718798498721088081545903057945846766215496303202996020966039324317030320192259716114444605497375409436382901355791192982914182745794289577402949437996785854800872248151565887196128000334560762292727587342261356212077988186582735509598387759311889564163018107544424933272423898785638899085502074050331417858052887489923811978468319294686693937961374603136580356163443347954783899459445024558971413234423920625466250189628760872074
5721358923542786973064664310451363815037277974791576167041323582357577803969811310010259843829188014069012797851313341873594441629415417526475484599082425310814202418467639476349187859129802730671264031342547104393479708625563496691190025953222072847081811457623243468423763769419894896535857845190176217477163931803022574865938624205914734219981001206453062458289395614817960811790629901022068894980438432720619189836410448448707415366428741286005460107364273063437920091347007864157905630985844572282695554943443657186885759025567054572200300482612037023425409896535681486849502935475314805500940892413773398842592
==================================================================

solve1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from math import gcd
from Crypto.Util.number import *
from random import randint
from gmpy2 import *
from sympy import *


n = 22796989847232584966116294915487109667692399388548208723824857982269426577982533576667163788314199914687535479276346304658350161735113960289104183979696133935415188646776595832215264284722670512770470554707499665153015544069122010065312260439523387858828112487588782099366982294819534417816132401540924904685838957357082330263936694480312350765218239631128311090691899678268513832773081674712659582989336522253361666051011711097920229566557894746540797857900051034731211399362219119533279077307321152458275097560958390957855672781889148144546092193220955239367648666685933810680029234780530383892271357380347995689819
c = 15500809819319696897791338730286899435906011157735748702026575236634076515328980326637207906866268251263940032374975549532185373801022208633640902685377742436930240946081698336042744872766305141702335101808659166638891554974804218420085991738631192662946632425072758982757961934234177973937887628455694588363841837871998858416793380376295499615937813361845507842420460604374447588420143950916761217801763530142272886581350320327182880966932325842751695199453666465100905939351955675042151795182275210958628456634676533901872731200863590971292987298842878421590175171242300414874391295079990929796678060214548392771598
hint1 = 1862211078370543480091335720566337979011214317229942783369303684474721435299886066692282340190601528246995538659713203028079171433051686409953814711803715745539615281056845096130150993388823222740835326508143943663312349159730974161720380360041429884293446791041760189634575810871753491959675639372269149003297678963406284496813354856152984421
hint2 = 451978013031216919732462259517336504381883668982999130384688266648583382806895812105588238968591030312940794462780134987725615664473829801678775053631652958914540268442422509110068911621519971159869478916942393510556788177367803958733251858842353604843493765854908537521426219930292526661256016570010664974221111594991806536179924000671962879710797054864049721795259156390686073225308097020589215361235483029040693704919028018150806601949682138526865044809662092
h1 = hint1 + 0x114
h2 = hint2 + 0x514
e = 0x10001
# flag1 = pow(c,d,n)
# a = [i for i in range(0,2 ** 11) ]
# for a1 in a:
# for a2 in a:
# if gcd(a2 * h1 - a1 * h2,n) != 1:
# print(gcd(a2 * h1 - a1 * h2,n))

p = 150556757501089377335436861597668532759167063418149451873892673041441574746484480172770281695029395204024492543703641890608225475429941688457272867924226947004930880375197608715370559553857293816362519349893628875986030179953298651731386899559083522042580464565731414626985004100382424686783522608921806319081
q = n // p
print(q)
d = mod_inverse(e,(p-1)*(q-1))
print(long_to_bytes(pow(c,d,n)))

solve2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gmpy2
from Crypto.Util.number import *
from sympy import *
import numpy

e = 0x10001
n = 24035750183831967945862792163318687711636752271371090849587486052996743335317925707644158466361992088680284764537863907870483800987927045977262379436707935507352930731625828010232148531698069195679206414771560405690866206801521560068223111553181555589657902912351690944653598852969643576557244361774811847786620528125766038976290871157015582419666377724077626852783161544588108892151231349381914349567742343809860879779842598253145859022455636285730609230213893482168129936443755613145793453450265841379651392614504305926698789993597967575449464830551464752887958111479014119364003208540559602831610061068580024304819
c = 19934689766676402834945257825359386260778644093931507561829377556171227917476487950297033854166232075447889855506414923788944066873230395572730425922321820345287653931899872053996044824782950906993111807754923238617369022881802203840405204432268446924041095481162467048547431813579298444860037069073330808101615311961018893636588389609087080788546193553692725702289368182831547430390563914513490366135018553210142200762531317435146556932342500456400144935440074460440245575109860904136544180958572452150042290099122096819070557715615930816198575927509264695516100566470057658853949332163685198579685526667964321845739
hint = 18567032867512285860307419488165768578686620568031343693371467586033464180932929719298233554289159514429056422062355183818429533169961696923649809870818260456617136078495827646887535954139551435058217919572553957538876498055301171484653056802489660140508839376495703495298792704494360514709918221629239667571477378551204563319518122929355306964308922342824945446469956403936864310867999869021233291094379139359357336767219934171235565098713539397213682169115587641501816149888627310047627322248269203989245666081524212042527661700223870861838643701360684940245909880865049035523276592323505026950707591320306175476700
t = inverse(hint,n)
p,q = symbols('p q')

res=solve([514*p-114*q-t,p*q-n],[p,q])
print(res)
p = res[1][0]
p = int (p)
q = n//p
print(p,q)
d = inverse(e,(p-1)*(q-1))
m = pow(c,d,n)
print(long_to_bytes(m))

fffhash

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from Crypto.Util.number import *
def giaogiao(hex_string):
base_num = 0x6c62272e07bb014262b821756295c58d
x = 0x0000000001000000000000000000013b
MOD = 2**128
for i in hex_string:
base_num = (base_num * x) & (MOD - 1)
base_num ^= i
return base_num


giao=201431453607244229943761366749810895688

print("1geiwoligiaogiao")
hex_string = int(input(),16)
s = long_to_bytes(hex_string)

print(s)

if giaogiao(s) == giao:
print(os.getenv('FLAG'))
else:
print("error")

WP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from sympy import Matrix, identity_matrix

# 基础数值
base_number = 0x6c62272e07bb014262b821756295c58d
prime_p = 0x0000000001000000000000000000013b
# 模数
modulus = 2**128

# 目标值
target = 201431453607244229943761366749810895688

# 多项式的度数
poly_degree = 20
# 构建矩阵M
M = Matrix.column([prime_p**(poly_degree - i - 1) for i in range(poly_degree + 1)] + [-(target - base_number * prime_p**poly_degree), modulus])
M = M.augment(identity_matrix(poly_degree + 1).stack(Matrix([0] * (poly_degree + 1))))

# 构造对角矩阵Q并应用到M
diagonal_values = [2**256] + [2**8] * poly_degree + [2**16]
Q = Matrix.diagonal(diagonal_values)
M = M * Q
M = M.BKZ() # 应用BKZ算法
M = M / Q # 移除Q的影响

# 寻找合适的行
for row in M:
if row[0] == 0 and abs(row[-1]) == 1:
row *= row[-1]
coefficients = row[1:-1]
break

# 初始化结果列表和中间变量
solution = []
y = int(base_number * prime_p)
t = (base_number * prime_p**poly_degree + coefficients[0] * prime_p**(poly_degree - 1)) % modulus

# 寻找解
for i in range(poly_degree):
for x in range(256):
y_ = (int(y) ^ int(x)) * prime_p**(poly_degree - i - 1) % modulus
if y_ == t:
solution.append(x)
if i < poly_degree - 1:
t = (t + coefficients[i + 1] * prime_p**(poly_degree - i - 2)) % modulus
y = ((int(y) ^ int(x)) * prime_p) % modulus
break