hu1y40's blog

hu1y40'blog
天堂的穹空遍布地狱之火的颜色,但也是天堂。
  1. 首页
  2. 漏洞分析
  3. 二进制
  4. DoS
  5. 正文

MP4Box 无限循环漏洞

2023年12月1日 1806点热度 0人点赞 0条评论

MP4Box 无限循环漏洞

0x00 前言

漏洞软件地址:

https://github.com/gpac/gpac

0x01 漏洞挖掘

AFL++:

./configure --static-bin

0x02 漏洞分析

gdb调试crash文件,触发命令为MP4Box -v -fstat <crashfile>。

堆栈如下:

fig:

先看无限循环的地方在av_parsers.c:1639处。

fig:

gf_bs_read_int函数的两个参数第一个为bitstream,第二个为读取的Bits数,函数为从bitsteam读取1Bits为int值返回。

此时传参如下,bitstream为0x611000000040,读取1Bits。

fig:

进入函数,此时已经读了6052068字节。

fig:

整个循环就是已经读到了stream结尾但是一直还在继续读取字节。可以发现bs的size和position都是507(0x1FB),而我们的文件大小就是0x1FB。

fig:

fig:

在此循环运行的第一次打断点。

发现current为0x4A00的值,像是读取到了文件末尾的4A自动补充了一个00。

fig:

至此漏洞点是大概清楚了,就是读完了文件还在继续读。

0x03 报告

1.Version
MP4Box - GPAC version 2.3-DEV-rev636-gfbd7e13aa-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - https://gpac.io

Please cite our work in your research:
GPAC Filters: https://doi.org/10.1145/3339825.3394929
GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --static-bin --enable-sanitizer
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D

2.Program Output
[iso file] Parsing a top-level box at position 0
[iso file] Read Box type ftyp size 32 start 0
[iso file] Parsing a top-level box at position 32
[iso file] Read Box type mv@d size 108 start 32
[iso file] Unknown top-level box type mv@d
[iso file] Parsing a top-level box at position 140
[iso file] Read Box type av1C size 363 start 140
[AV1] parsed AV1 OBU type=7 size=99 at position 152.
[AV1] AV1 unexpected OBU type=152 size=0 found at position 140056310360544. Forwarding.
[AV1] parsed AV1 OBU type=1 size=12 at position 251.
[AV1] parsed AV1 OBU type=1 size=12 at position 263.
[AV1] parsed AV1 OBU type=1 size=12 at position 275.
[AV1] parsed AV1 OBU type=1 size=12 at position 287.
[AV1] parsed AV1 OBU type=2 size=25 at position 299.
[AV1] AV1 unexpected OBU type=299 size=0 found at position 140056310360544. Forwarding.
[AV1] parsed AV1 OBU type=2 size=52 at position 324.
[AV1] AV1 unexpected OBU type=324 size=0 found at position 140056310360544. Forwarding.
[AV1] parsed AV1 OBU type=1 size=12 at position 376.
[AV1] parsed AV1 OBU type=1 size=12 at position 388.
[AV1] parsed AV1 OBU type=1 size=12 at position 400.
[AV1] parsed AV1 OBU type=1 size=12 at position 412.
[AV1] parsed AV1 OBU type=1 size=12 at position 424.
[AV1] parsed AV1 OBU type=1 size=12 at position 436.
[AV1] parsed AV1 OBU type=1 size=12 at position 448.
[AV1] parsed AV1 OBU type=1 size=12 at position 460.
[AV1] parsed AV1 OBU type=1 size=12 at position 472.
[AV1] parsed AV1 OBU type=1 size=12 at position 484.
[BS] Attempt to overread bitstream

3.Reproduction
./MP4Box -v $poc

4.PoC
https://www.mediafire.com/file/fspsarzrcbfceha/hangPoC/file

5.Impact
This vulnerability can result in an infinite loop or lead to a denial-of-service (DoS) condition.

6.Env
Linux ubuntu 5.4.0-84-generic #94~18.04.1-Ubuntu SMP Thu Aug 26 23:17:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

7.Credit
hu1y40

0x04 修复方案

其实我还想加一个是否在文件结尾的标识 不过既然leadingZeros>=32都会返回0xFFFFFFFF不如在循环中一旦发现了leadingZeros>=32就返回。

static u32 av1_uvlc(GF_BitStream *bs, const char *fname)
{
u32 res;
u8 leadingZeros = 0;
while (1) {
if (leadingZeros >= 32) {
return 0xFFFFFFFF;
}
Bool done = gf_bs_read_int(bs, 1);
if (done)
break;
leadingZeros++;
}
res = gf_bs_read_int(bs, leadingZeros) + (1 << leadingZeros) - 1;
gf_bs_log(bs, 2*leadingZeros, fname, res);
return res;
}

0x05 问题

1.对于这种价值较低的漏洞有必要分析详细吗?(此漏洞并没有分析特别详细,包括文件格式为什么如此解析,流对象等)

标签: FUZZ 漏洞
最后更新:2023年12月1日

hu1y40

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复
文章目录
  • MP4Box 无限循环漏洞
    • 0x00 前言
    • 0x01 漏洞挖掘
    • 0x02 漏洞分析
    • 0x03 报告
    • 0x04 修复方案
    • 0x05 问题

分类目录

  • 0day安全
  • Bypass
  • C++Prime
  • CTF
  • DoS
  • DoS
  • FUZZ
  • iot
  • JSONP
  • MISC
  • MISC
  • PHP伪协议
  • Python
  • REVERSE
  • sqli-labs
  • SQL注入
  • Trick
  • UAF
  • WEB
  • WEB
  • XXE
  • 书籍阅读
  • 二进制
  • 代码阅读
  • 信息搜集
  • 信息泄露
  • 加密与解密
  • 双重释放漏洞
  • 反序列化
  • 命令执行
  • 命令执行
  • 堆溢出
  • 密码学
  • 弱加密
  • 提权漏洞
  • 整数溢出
  • 文件上传
  • 未分类
  • 栈溢出
  • 格式化字符串漏洞
  • 模型
  • 汇编语言
  • 渗透测试
  • 漏洞分析
  • 漏洞利用
  • 漏洞战争
  • 漏洞挖掘
  • 病毒分析
  • 越界读取
  • 路径遍历
  • 逻辑漏洞
  • 配置不当
  • 钓鱼
  • 靶场
最新 热点 随机
最新 热点 随机
加密算法 2023年度总结 RTSPServer StackOverflow Vulnerability FUZZ 总览篇 MP4Box 无限循环漏洞 CVE-2023-40477 Winrar RCE漏洞分析
3CXDesktopApp供应链攻击分析 PyPI恶意存储库fshec2攻击分析 加密与解密 第4章 CVE-2013-2551 IE COALineDashStyleArray整数溢出漏洞 加密与解密 第5章实验 CVE-2018-17297 Hutool 路径遍历漏洞

COPYRIGHT © 2023 hu1y40's blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

鄂ICP备2021009673号-1