OSEP-Code-Snippets
OSEP-Code-Snippets copied to clipboard
Linux SimpleShellcodeLoader.c Segfault
Hi there,
while studying for OSEP I stumbled across your SimpleShellcodeLoader for Linux and gave it a shot. Unfortunately running it causes a Segfault on my end and this page explains why I guess. The compiler flag -execstack didnt work on my client (current Kali build). In the second part of his blog he shows how to fix those issues, but the code will differ from your "simpler" version (basically easy copy paste, I tested it and it works really good). Just wanted to provide the info in case someone else gets stuck here :)
Hi @beelow2010, thanks for submitting this issue!
Odd that the -z execstack
option did not work for you, IIRC it was explicitly mentioned to be used in the course materials. Since altering the snippet would diverge from the way it is discussed in the course I will refrain from doing that. I will however keep this issue open for reference :)
Hello again, you're welcome :)
It is correct that it's mentioned in the course and also in the blog port that I linked it states that it is supposed to work but for some reason it didn't on my end with a fresh Kali Install. But as you said, maybe the reference will help some people that run into the same issue - so thanks for your response! :)
Posting this blog since it helped me understand why I was receiving a segfault. I moved the unsigned char buf[]
variable down into the main function and it worked fine for me. Don't forget to compile with -z execstack