Reference no: EM132700844
If you can use online c compiler, that would be great, but if the assignment cannot be done with online c compiler, then please let me know asap and which compiler you should use.
shellcode
======
Compile echo.c with the following command
gcc -m32 -fno-stack-protector -z execstack -fcf-protection=none echo.c
If you are using some old gcc versions, you can take out the option
-fcf-protection=none
if it is not available.
(1) Create shellcode for either unlink (Linux system call 10) or rmdir (Linux system call 40). unlink deletes a name and possibly the file it refers to.
rmdir deletes an empty directory.
They both take (char *pathname) as the parameter, where the string refers to the name of the file or directory including optional path.
You can refer to Linux system call manual for more details (google linux ssytem call list).
(2)
Use echo.c as the victim program, create a payload for the shellcode you created in (1).
Create an attack script (printf or python script as demo'ed in class) to inject the payload.
Demonstrate with the following steps.
a) create a file (for unlink) or directory (for rmdir) named "foo" command: "touch foo" to create a file named foo command: "mkdir foo" to create an empty directory named foo
b) inject the shellcode
c) verify file or directory foo is deleted.
(3)
Do (1) and (2) for both system calls unlink and rmdir.
What to submit:
A report, with screenshots or transcript, and drawings (memory layout) if have.
Include your payload in the report.
Also submit your attack script or command.
Attachment:- echo.rar