메뉴 건너뛰기

GREATUSER

tech

CVE-2015-0235 GHOST BUG

위대한유저 2015.02.05 02:15 조회 수 : 617

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-0235

http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-0235


파일명 : cve-2015-0235.c

#include <netdb.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <errno.h>


#define CANARY "in_the_coal_mine"


struct {

  char buffer[1024];

  char canary[sizeof(CANARY)];

} temp = { "buffer", CANARY };


int main(void) {

  struct hostent resbuf;

  struct hostent *result;

  int herrno;

  int retval;


  /*** strlen (name) = size_needed - sizeof (*host_addr) - sizeof (*h_addr_ptrs) - 1; ***/

  size_t len = sizeof(temp.buffer) - 16*sizeof(unsigned char) - 2*sizeof(char *) - 1;

  char name[sizeof(temp.buffer)];

  memset(name, '0', len);

  name[len] = '';


  retval = gethostbyname_r(name, &resbuf, temp.buffer, sizeof(temp.buffer), &result, &herrno);


  if (strcmp(temp.canary, CANARY) != 0) {

    puts("vulnerable");

    exit(EXIT_SUCCESS);

  }

  if (retval == ERANGE) {

    puts("not vulnerable");

    exit(EXIT_SUCCESS);

  }

  puts("should not happen");

  exit(EXIT_FAILURE);

}

 



gcc -o check_ghost cve-2015-0235.c

./check_ghost


실행후

vulnerable : 취약점을 가지고 있으므로 패치가 필요

not vulnerable : 취약점이 패치되어 있음



물론 업데이트 이후 완전한 적용을 위해 리부팅을 진행해야함~


번호 제목 글쓴이 날짜 조회 수
124 Mozilla SSL Configuration Generator 관리자 2016.10.15 47
123 mysql server system variables log_warnings to log_error_verbosity 관리자 2016.10.05 1680
122 [MariaDB] InnoDB: Redo log crypto: failed to decrypt log block 관리자 2016.09.28 73
121 [mysql] Buffered warning: Could not increase number of max_open_files to more than 1024 on centos 관리자 2016.09.08 95
120 Unable to validate certificate chain in aws elb – comodossl 관리자 2016.09.06 160
119 WordPress 4.6 “Pepper” 관리자 2016.08.17 46
118 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 3편 관리자 2016.08.12 76
117 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 2편 관리자 2016.08.12 69
116 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 1편 관리자 2016.08.12 73
115 WordPress 4.6 Release Candidate 관리자 2016.07.28 42
114 Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MariaDB client in /home1/htdocs/apartzm/affisacc/php/acc_tongys.inc.php on line 188ERROR 1251: Client does not smysql_connect(): Client 관리자 2016.07.26 66
113 WordPress 4.6 Beta 3 관리자 2016.07.14 33
112 mysqlbinlog: unknown variable ‘default-character-set=utf8’ 관리자 2016.07.09 64
111 WordPress 4.6 Beta 1 관리자 2016.06.30 36
110 $_SERVER[‘SERVER_SOFTWARE’]=’Apache’ in wp-config.php 관리자 2016.06.24 50
위로