메뉴 건너뛰기

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



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


번호 제목 글쓴이 날짜 조회 수
49 인터넷으로 서비스를 제공하기 위해 챙겨야 할 실용적인 보안 가이드 관리자 2016.05.24 33
48 termination protection on instances and instance protection on auto scaling 관리자 2016.05.31 30
47 mod_rpaf on aws elb 관리자 2016.06.17 43
46 Apache Tomcat Versions – Which Do I Want? 관리자 2016.06.24 44
45 $_SERVER[‘SERVER_SOFTWARE’]=’Apache’ in wp-config.php 관리자 2016.06.24 50
44 WordPress 4.6 Beta 1 관리자 2016.06.30 36
43 mysqlbinlog: unknown variable ‘default-character-set=utf8’ 관리자 2016.07.09 65
42 WordPress 4.6 Beta 3 관리자 2016.07.14 33
41 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
40 WordPress 4.6 Release Candidate 관리자 2016.07.28 42
39 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 1편 관리자 2016.08.12 75
38 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 2편 관리자 2016.08.12 69
37 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 3편 관리자 2016.08.12 76
36 WordPress 4.6 “Pepper” 관리자 2016.08.17 46
35 Unable to validate certificate chain in aws elb – comodossl 관리자 2016.09.06 160
위로