0x01 漏洞简述
2020年10月22日,360CERT监测发现 Google Chrome 发布了最新桌面版Chrome浏览器,版本86.0.4240.111,此次更新修复了5个安全漏洞,其中最为严重的为 CVE-2020-15999 ,漏洞等级: 高危 ,漏洞评分: 8.8 。
对此,360CERT建议广大用户及时将 Chrome 升级到最新版本。与此同时,请做好资产自查以及预防工作,以免遭受黑客攻击。
0x02 风险等级
360CERT对该漏洞的评定结果如下
评定方式 等级 威胁等级 高危 影响面 广泛 360CERT评分 8.8
0x03 漏洞信息
该漏洞由Google P0团队的安全研究员Sergei Glazunov 于10月19日发现,并且发现此前已有在野利用。
该危害是由于FreeType 字体库存在堆溢出漏洞,FreeType官方于10月20日发布了2.10.4版本,修复了更新的5个漏洞,包括此漏洞。
漏洞存在于src/sfnt/pngshim.c:251 的 Load_SBit_Png 函数中:
FT_LOCAL_DEF( FT_Error ) Load_SBit_Png( FT_GlyphSlot slot, FT_Int x_offset, FT_Int y_offset, FT_Int pix_bits, TT_SBit_Metrics metrics, FT_Memory memory, FT_Byte* data, FT_UInt png_len, FT_Bool populate_map_and_metrics, FT_Bool metrics_only ) { [...] png_get_IHDR( png, info, &imgWidth, &imgHeight, &bitdepth, &color_type, &interlace, NULL, NULL ); // *** 1 *** [...] if ( populate_map_and_metrics ) { metrics->width = (FT_UShort)imgWidth; // *** 2 *** metrics->height = (FT_UShort)imgHeight; map->width = metrics->width; map->rows = metrics->height; map->pixel_mode = FT_PIXEL_MODE_BGRA; map->pitch = (int)( map->width * 4 ); [...] if ( populate_map_and_metrics ) { /* this doesn't overflow: 0x7FFF * 0x7FFF * 4 < 2^32 */ FT_ULong size = map->rows * (FT_ULong)map->pitch; // *** 3 *** error = ft_glyphslot_alloc_bitmap( slot, size ); // *** 4 *** if ( error ) goto DestroyExit; } [...] png_read_image( png, rows ); // *** 5 ***(1)处从header通过png_get_IHDR函数获取图像的width 和 height,都为32-bit整数
(2)处将获得的width 和 height 截断,取低16-bit存放在 TT_SBit_Metrics metrics 结构中
(3)处使用截断的值来计算位图的大小,
(4)处将(3)处计算得到的size来分配空间
(5)png_struct 传入png_read_image,由于png_struct 结构保存的值都是32-bit,因此截断值计算出来的空间无法匹配,造成堆溢出漏洞。
目前该漏洞的Poc文件已经公布。
0x04 补丁分析
diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 2e64e5846..7c98c2282 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -335,6 +335,11 @@ metrics->width = (FT_UShort)imgWidth; metrics->height = (FT_UShort)imgHeight; + /* bail out if the width and/or height were truncated */ + if ( metrics->width != imgWidth || + metrics->height != imgHeight ) + goto DestroyExit; + map->width = metrics->width; map->rows = metrics->height; map->pixel_mode = FT_PIXEL_MODE_BGRA;补丁比较了width 和 height的原始值和截断后的值是否相同,如果不同,说明原始值已经大于0xffff,可能造成溢出,跳转到DestroyExit。
0x05 影响版本
< Chrome v86.0.4240.111
< FreeType 2.10.4
0x06 修复建议
Chrome 更新到最新版本v86.0.4240.111
FreeType 更新到最新版本2.10.4
0x07 时间线
2020-10-19 Sergei Glazunov 发现此漏洞
2020-10-20 FreeType发布最新2.10.4版本
2020-10-20 Chrome发布最新86.0.4240.111版本
2020-10-22 360CERT发布漏洞通告
0x08 参考链接
https://thehackernews.com/2020/10/chrome-zeroday-attacks.html https://savannah.nongnu.org/bugs/?59308 https://chromereleases.googleblog.com/2020/10/stable-channel-update-for-desktop_20.html文章原文链接:https://www.anquanke.com/post/id/220524

