Linux glibc幽靈漏洞修復方法

jopen 9年前發布 | 15K 次閱讀 glibc 安全相關

關于這個漏洞網上很多介紹,在這里就不說了,想了解的童鞋點擊下面的連接


CVE-2015-0235:Linux Glibc幽靈漏洞允許黑客遠程獲取系統權限


測試漏洞是否存在: 


把下面的代碼保存為gistfile1.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] = '\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);
}
#* from http://www.openwall.com/lists/oss-security/2015/01/27/9 */



然后在服務器上執行:


 gcc gistfile1.c -o CVE-2015-0235
 ./CVE-2015-0235


如果提示:vulnerable 就說明存在漏洞.


修復方法:

執行這些命令即可


yum clean all 
yum makecache
yum -y install glibc* 


來自:http://blog.csdn.net/sikers/article/details/43230503


 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!