glibc 是一個 Linux 系統核心裡很重要的東西,大部份程式都會使用這個,

這次的漏洞名稱叫 GHOST,由來是從 gethostbyname() functions 發生的

What is the vulnerability?

During a code audit Qualys researchers discovered a buffer overflow in the __nss_hostname_digits_dots() function of glibc. This bug can be triggered both locally and remotely via all the gethostbyname*() functions. Applications have access to the DNS resolver primarily through the gethostbyname*() set of functions. These functions convert a hostname into an IP address.

參考 The GHOST Vulnerability

檢查工具

cat > GHOST.c << EOF
#include 
#include 
#include 
#include 
#include 
 
#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] = '\0';
 
  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);
}
EOF

gcc GHOST.c -o GHOST

./GHOST

因為用到 glibc 的程式就有這些,你可以一個一個 restart ,不然就要 reboot 了

lsof | grep libc | awk '{print $1}' | sort | uniq

參考: wooyunfreebuf

Related posts 相關文章
QUALYS 發現 Linux glibc 有嚴重漏洞,可以遠端控制系統 part2
More...
線上弱點、惡意病毒掃描廠商
More...
好煩喔之持續觀注 bash/shellshock 漏洞
More...
我在升級過程遇到的 bash 套件版本更新變化
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。