Instagram_RCE:Instagram APP 远程代码漏洞

  • 来源:网络
  • 更新日期:2020-09-29

摘要:研究人员在 Facebook Instagram 安卓和 iOS 版本 APP 中发现了一个高危漏洞,攻击者利用该漏洞可以拒绝用户访问 APP,完全控制用户账户,甚至利用手机设备监听用户。漏洞细节该漏

研究人员在 Facebook Instagram 安卓和 iOS 版本 APP 中发现了一个高危漏洞,攻击者利用该漏洞可以拒绝用户访问 APP,完全控制用户账户,甚至利用手机设备监听用户。

漏洞细节

该漏洞存在于 Instagram 处理图像的方式中,从技术上将该漏洞是一个堆溢出漏洞(CVE-2020-1895),当 Instagram 尝试发送大一点的文件时会触发该漏洞。攻击者只需通过常见的消息平台或邮件向攻击目标发送精心伪造的图片就可以触发该漏洞。

有漏洞的函数为 read_jpg_copy_loop,会在解压缩过程中引发整数溢出。

Read_jpg_copy_loop 代码段

在处理 JPEG 图像文件时,有漏洞的函数会处理图像尺寸。下面是有漏洞的代码的伪代码:

width = rect->right - rect->bottom; height = rect->top - rect->left; allocated_address = __wrap_malloc ( width*height*cinfo->output_components ) ;// output_scanline; if ( ( unsigned int ) output_scanline >= cinfo->output_height ) break; //reads one line from the file into the cinfo buffer jpeg_read_scanlines ( cinfo, line_buffer, 1 ) ; if ( output_scanline >= Rect->left && output_scanline top ) { memcpy ( allocated_address + bytes_copied , line_buffer, width*output_component ) ;// output_component 告诉我们有多少个字节用来表示每个像素。变量的值分别代表不同的意思,1 表示 Greyscale、3 表示 RGB、4 表示 RGB + AlphaCMYK 等。

除了 height 和 width 外,output_component 也可以完全被攻击者控制。因为在分析的过程中并不会与文件中的其他数据进行验证。

__warp_malloc 希望其参数在 32 位的寄存器中进行处理。也就是说如果分配的大小超过 ( 2^32 ) 字节,那么就可以引发整数溢出。

分配的大小是通过图像的 width 乘 height 再乘以 output_components 得到的。因为没有检查,那么一旦被攻击者所控制,进一步滥用后就会引发整数溢出。

__wrap_malloc ( width * height * cinfo->output_components ) ;//