IE 11 MSHTML!CPaste­Command::Convert­Bitmapto­Png 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!CPaste­Command::Convert­Bitmapto­Png函数执行这个操作。

这个函数使用BMP图片的大小来储存转换好的PNG图片,如果转换后的PNG大于BMP则会发生溢出

CPaste­Command::Convert­Bitmapto­Png 伪代码

  函数原型
Convert­Bitmapto­Png(
[IN] VOID* po­Bitmap,
UINT u­Bitmap­Size,
[OUT] VOID** ppo­Png­Image,
UINT* pu­Png­Image­Size
) {
// BMP到PNG的转换
CMem­Stm* po­CMem­Stm;
IWICStream* po­Wic­Bitmap;
STATSTG o­Stat­Stg;
TSmart­Array<unsigned char> po­Png­Image;
UINT u­Read­Size;
// Create a CMem­Stm for the PNG image.
Create­Stream­On­HGlobal(NULL, True, po­CMem­Stm);
// Create an IWICStream from the BMP image.
Initialize­From­Memory(po­Bit­Map, u­Bitmap­Size,
&GUID_­Container­Format­Bmp, &po­Wic­Bitmap)));
// Write BMP image in IWICStream to PNG image in CMem­Stm
Write­Wic­Bitmap­To­Stream(po­Wic­Bitmap, &GUID_­Container­Format­Png, po­CMem­Stm);
// Get size of PNG image in CMem­Stm and save it to the output variable.
o­CMem­Stm->Stat(&o­Stat­Stg, 0);
*pu­Png­Image­Size = o­Stat­Stg.cb­Size.Low­Part;
// Allocate memory for the PNG
//这一句产生问题,使用了BMP的大小给PNG分配内存
po­Png­Image->New(u­Bitmap­Size);
// Go to start of PNG image in CMem­Stm
po­CMem­Stm->Seek(0, STREAM_­SEEK_­SET, NULL, &p­Position­Low);
// Read PNG image in CMem­Stm to allocated memory.
//这一句读入PNG的内容,导致溢出
po­CMem­Stm->Read(po­Png­Image, *pu­Png­Image­Size, &u­Read­Size);
// Save location of allocated memory with PNG image to output variable.
*ppo­Png­Image = po­Png­Image;
}

POC

只有用js实现图片复制的脚本,图片本身需要另外生成

这个洞因为没有完整的POC所以我没有调,但是其实作者在概述里已经说的很清楚了,这个洞的成因比较有意思放在这里开阔一下思路。

【OOB】MSHTML!CPaste­Command::Convert­Bitmapto­Png heap-based buffer overflow学习的更多相关文章

  1. CVE-2016-10190 FFmpeg Http协议 heap buffer overflow漏洞分析及利用

    作者:栈长@蚂蚁金服巴斯光年安全实验室 -------- 1. 背景 FFmpeg是一个著名的处理音视频的开源项目,非常多的播放器.转码器以及视频网站都用到了FFmpeg作为内核或者是处理流媒体的工具 ...

  2. CVE-2016-10191 FFmpeg RTMP Heap Buffer Overflow 漏洞分析及利用

    作者:栈长@蚂蚁金服巴斯光年安全实验室 一.前言 FFmpeg是一个著名的处理音视频的开源项目,使用者众多.2016年末paulcher发现FFmpeg三个堆溢出漏洞分别为CVE-2016-10190 ...

  3. metasploit--exploit模块信息

    Name                                             Disclosure Date  Rank    Description ----           ...

  4. Kali linux 2016.2(Rolling)中的Exploits模块详解

    简单来将,这个Exploits模块,就是针对不同的已知漏洞的利用程序. root@kali:~# msfconsole Unable to handle kernel NULL pointer der ...

  5. BUFFER OVERFLOW 10 Vulnerability & Exploit Example

    SRC= http://www.tenouk.com/Bufferoverflowc/Bufferoverflow6.html THE VULNERABLE AND THE EXPLOIT     W ...

  6. sqlmap用法大全

    sqlmap参数详解: Usage: python sqlmap.py [options] Options(选项): -h, --help            Show basic help mes ...

  7. fuzz实战之honggfuzz

    Honggfuzz实战 前言 本文介绍 libfuzzer 和 afl 联合增强版 honggfuzz .同时介绍利用 honggfuzz 来 fuzz 网络应用服务. 介绍 honggfuzz 也是 ...

  8. An Assembly Language

    BUFFER OVERFLOW 3 An Assembly Language Introduction Basic of x86 Architecture Assembly Language Comp ...

  9. arcmap Command

    The information in this document is useful if you are trying to programmatically find a built-in com ...

随机推荐

  1. Java之数据流-复制二进制文件

    package test_demo.fileoper; import java.io.*; /* * 数值字节流操作,复制二进制文件 * 输入流:从文件中读取数据,扩展为数据流(二进制) * 输出流: ...

  2. 2017-2018 ACM-ICPC, Asia Daejeon Regional Contest F(递推)

    F题 Problem F Philosopher’s Walk 题意:给你n,m,n代表一个长宽都为2的n次方的格子里,m代表走了从左下角开始走了m米,求最后的坐标. 思路: 看上图很容易便可以看出规 ...

  3. Educational Codeforces Round 35 (Rated for Div. 2)A,B,C,D

    A. Nearest Minimums time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. Kruskal重构树学习笔记+BZOJ3732 Network

    今天学了Kruskal重构树,似乎很有意思的样子~ 先看题面: BZOJ 题目大意:$n$ 个点 $m$ 条无向边的图,$k$ 个询问,每次询问从 $u$ 到 $v$ 的所有路径中,最长的边的最小值. ...

  5. 【bzoj3529】 Sdoi2014—数表

    μhttp://www.lydsy.com/JudgeOnline/problem.php?id=3529 (题目链接) 题意 多组询问,每次给出${n,m,a}$.求$${\sum_{i=1}^n\ ...

  6. 【poj3693】 Maximum repetition substring

    http://poj.org/problem?id=3693 (题目链接) 题意 给定一个字符串,求重复次数最多的连续重复子串,若存在多组解,输出字典序最小的. Solution 后缀数组论文题,就是 ...

  7. php Mockery 错误 "call_user_func_array() expects parameter 1 to be a valid callback, class 'Mockery\Expectation' does not have a method"

    错误写法 $mock = Mockery::mock(MyClass::class) ->shouldReceive('foo') ->once() ->with($arg) -&g ...

  8. IntelliJ IDEA 破解 - pycharm

    MAC激活方法 下载破解文件 下载地址: https://files.cnblogs.com/files/resn/JetbrainsCrack-2.7-release-str.jar.zip 或者去 ...

  9. AngularJs -- 模 块

    在JavaScript中,将函数代码全部定义在全局命名空间中绝对不是什么好主意,这样做会导致冲突从而是调试变得非常困难,浪费宝贵的时间. 上一章介绍数据绑定时,就是写在全局命名空间中定义的函数. 在A ...

  10. 第9月第13天 传递lua匿名函数到c/c++

    1. lua函数都在refid_fun refid_fun[refid] = fun TOLUA_API int toluafix_ref_function(lua_State* L, int lo, ...