欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux Glibc庫安全漏洞檢測方法和修復(fù)方案

  發(fā)布時(shí)間:2015-02-09 14:51:08   作者:佚名   我要評論
這篇文章主要介紹了Linux Glibc庫安全漏洞檢測方法和修復(fù)方案,本文先是給出檢測方法,然后給出各種操作系統(tǒng)的修復(fù)方案,需要的朋友可以參考下

2015年1月27日Linux GNU glibc標(biāo)準(zhǔn)庫的 gethostbyname函數(shù)爆出緩沖區(qū)溢出漏洞,漏洞編號為CVE-2015-0235。黑客可以通過gethostbyname系列函數(shù)實(shí)現(xiàn)遠(yuǎn)程代碼執(zhí)行,獲取服務(wù)器的控制權(quán)及Shell權(quán)限,此漏洞觸發(fā)途徑多,影響范圍大,已確認(rèn)被成功利用的軟件及系統(tǒng):Glibc 2.2到2.17 (包含2.2和2.17版本)。

GNU glibc標(biāo)準(zhǔn)庫的gethostbyname 函數(shù)爆出緩沖區(qū)溢出漏洞,漏洞編號:CVE-2015-0235。 Glibc 是提供系統(tǒng)調(diào)用和基本函數(shù)的 C 庫,比如open, malloc, printf等等。所有動態(tài)連接的程序都要用到Glibc。遠(yuǎn)程攻擊者可以利用這個(gè)漏洞執(zhí)行任意代碼并提升運(yùn)行應(yīng)用程序的用戶的權(quán)限。

漏洞檢測方法

按照說明操作即可:

復(fù)制代碼
代碼如下:

#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("notvulnerable");
exit(EXIT_SUCCESS);
}
puts("should nothappen");
exit(EXIT_FAILURE);
}

將上述代碼內(nèi)容保存為GHOST.c,執(zhí)行:

復(fù)制代碼
代碼如下:

gcc GHOST.c -o GHOST</p> <p>$./GHOST
vulnerable //表示存在漏洞,需要進(jìn)行修復(fù)。</p> <p>$./GHOST
notvulnerable //表示修復(fù)成功。

建議修補(bǔ)方案

特別提示:由于glibc屬于Linux系統(tǒng)基礎(chǔ)組件,為了避免修補(bǔ)對您服務(wù)器造成影響,建議您選擇合適時(shí)間進(jìn)行修復(fù),同時(shí)務(wù)必在修復(fù)前通過快照操作進(jìn)行備份。

CentOS 5/6/7

復(fù)制代碼
代碼如下:

yum update glibc

Ubuntu 12/14

復(fù)制代碼
代碼如下:

apt-get update
apt-get install libc6

Debian 6

復(fù)制代碼
代碼如下:

wget -O /etc/apt/sources.list.d/debian6-lts.list <a >http://mirrors.aliyun.com/repo/debian6-lts.list</a>
apt-get update
apt-get install libc6

Debian 7

復(fù)制代碼
代碼如下:

apt-get update
apt-get install libc6

openSUSE 13

復(fù)制代碼
代碼如下:

zypper refresh
zypper update glibc*

Aliyun linux 5u7

復(fù)制代碼
代碼如下:

wget -O /etc/yum.repos.d/aliyun-5.repo <a >http://mirrors.aliyun.com/repo/aliyun-5.repo</a>
yum update glibc

相關(guān)文章

最新評論