메뉴 건너뛰기

GREATUSER

tech

CVE-2015-0235 GHOST BUG

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

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 : 취약점이 패치되어 있음



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


번호 제목 글쓴이 날짜 조회 수
34 mysql server system variables log_warnings to log_error_verbosity 관리자 2016.10.05 1904
33 yum update error: "error was [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"" 위대한유저 2015.01.30 1974
32 error messag : Fatal error: Call to undefined function session_register() 위대한유저 2015.07.08 2179
31 error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE in PHP (after update centos-7.4) 관리자 2017.11.15 2218
30 mysql error : No data – zero rows fetched, selected, or processed 관리자 2016.04.06 2326
29 XE 1.8.3 Release 위대한유저 2015.06.11 2468
28 IE 확대/축소 기능끄기 위대한유저 2014.07.01 2592
27 XE 1.8.2까지의 버전에서 슬라이드 사용안함 속성이 반영 안되는 문제 위대한유저 2015.05.21 2903
26 xfce4 on centos7(rhel7) 위대한유저 2015.01.28 3453
25 윈도우에서 ARP CACHE 삭제/초기화 하는 방법 위대한유저 2015.05.29 3470
24 넷북 환경에서 윈도우 8.1 업데이트 하기 위대한유저 2014.05.14 3978
23 net use 사용시 시스템 오류 58(이)가 생겼습니다. 위대한유저 2015.04.08 6857
22 [python] 현재 실행중인 함수 이름 구하기 (sys._getframe().f_code.co_name) 관리자 2018.03.28 7672
21 아파치(httpd) ServerTokens 설정 위대한유저 2014.03.16 9809
20 Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP 위대한유저 2014.01.01 15462
위로