Last active
May 4, 2018 10:04
-
-
Save shmam/07c83b70e6660aa7e581451eb7689a06 to your computer and use it in GitHub Desktop.
Simple exploit of the dangerous stdlib.h system() function in C99 to make a replicating and auto-compiling program. I haven't run the full thing yet because it is probably bad. I really have to study now but I plan on updating this and adding to it after my exam.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(int argc, char *argv[]) { | |
| system(" rm -f spam2.c spam2.o spam2"); | |
| system(" touch spam2.c"); | |
| system(" hexdump -ve \'1/1 \"%.2x\"\' spam.c | xxd -r -p > spam2.c"); | |
| system(" gcc -Wall -std=c99 spam2.c -o spam2"); | |
| system(" echo STOP ME :) "); | |
| // uncomment this to run the file! :0 | |
| // system(" ./spam2"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment