【OOB】MSHTML!CPasteCommand::ConvertBitmaptoPng heap-based buffer overflow学习
2024-10-16 12:32:24
IE 11 MSHTML!CPasteCommand::ConvertBitmaptoPng heap-based buffer overflow学习
MS14-056, CVE-2014-4138
Time-line
8 May 2014: This vulnerability was submitted to ZDI.
9 June 2014: This vulnerability was acquired by ZDI.
23 June 2014: This vulnerability was disclosed to Microsoft by ZDI.
14 October 2014: This vulnerability was address by Microsoft in MS14-056.
21 December 2016: Details of this vulnerability are released.
越界访问漏洞
版本:Microsoft Internet Explorer 11.0.9600.16521
概述
图片被粘贴到IE11中,会把BMP格式转换成PNG格式,MSHTML!CPasteCommand::ConvertBitmaptoPng函数执行这个操作。
这个函数使用BMP图片的大小来储存转换好的PNG图片,如果转换后的PNG大于BMP则会发生溢出
CPasteCommand::ConvertBitmaptoPng 伪代码
函数原型
ConvertBitmaptoPng(
[IN] VOID* poBitmap,
UINT uBitmapSize,
[OUT] VOID** ppoPngImage,
UINT* puPngImageSize
)
{
// BMP到PNG的转换
CMemStm* poCMemStm;
IWICStream* poWicBitmap;
STATSTG oStatStg;
TSmartArray<unsigned char> poPngImage;
UINT uReadSize;
// Create a CMemStm for the PNG image.
CreateStreamOnHGlobal(NULL, True, poCMemStm);
// Create an IWICStream from the BMP image.
InitializeFromMemory(poBitMap, uBitmapSize,
&GUID_ContainerFormatBmp, &poWicBitmap)));
// Write BMP image in IWICStream to PNG image in CMemStm
WriteWicBitmapToStream(poWicBitmap, &GUID_ContainerFormatPng, poCMemStm);
// Get size of PNG image in CMemStm and save it to the output variable.
oCMemStm->Stat(&oStatStg, 0);
*puPngImageSize = oStatStg.cbSize.LowPart;
// Allocate memory for the PNG
//这一句产生问题,使用了BMP的大小给PNG分配内存
poPngImage->New(uBitmapSize);
// Go to start of PNG image in CMemStm
poCMemStm->Seek(0, STREAM_SEEK_SET, NULL, &pPositionLow);
// Read PNG image in CMemStm to allocated memory.
//这一句读入PNG的内容,导致溢出
poCMemStm->Read(poPngImage, *puPngImageSize, &uReadSize);
// Save location of allocated memory with PNG image to output variable.
*ppoPngImage = poPngImage;
}
POC
只有用js实现图片复制的脚本,图片本身需要另外生成
这个洞因为没有完整的POC所以我没有调,但是其实作者在概述里已经说的很清楚了,这个洞的成因比较有意思放在这里开阔一下思路。
最新文章
- BootLoader的架构设计
- 窗体Showmedol 遇到的奇怪异常: cannot make a visible window model
- JavaScript中对象的含义与this的指向
- python string module
- [ucgui] 子窗口父窗口
- Java入门到精通——基础篇之面向对象
- [Swift 语法点滴]——元组
- .NET反编译之Reflector
- css设置层级显示
- 从零开始理解JAVA事件处理机制(3)
- 深入理解计算机系统chapter1
- input type=passoord 密码框的明密文(显示和隐藏) 显示
- Android 调用 .NET WebService
- sql的基础用法
- JavaScript之基础语法整理
- Collections集合工具类
- iOS代码块block使用
- less用法小结
- Netty 系列一(核心组件和实例).
- 背包的一些idea
热门文章
- 07.基于IDEA+Spring+Maven搭建测试项目--logback.xml配置
- 【BZOJ2054】疯狂的馒头(并查集,线段树)
- BZOJ 1565 [NOI2009]植物大战僵尸 | 网络流
- matlab calibration toolbox -- matlab标定工具的使用方法--去畸变和双目校正
- Problem B: 专家系统 解题报告
- Windows完成端口与Linux epoll技术简介
- Mac 删除应用卸载后无法正常移除的图标
- haoi2006_受欢迎的牛_Solution
- Linux上SSH登录远程服务器免密码
- CentOS 7 系统root用户忘记密码的重置方法