(Add Vul: FFmpeg) FFmpeg 文件读取漏洞(CVE-2017-9993)

This commit is contained in:
Medicean 2017-06-28 22:15:32 +08:00
parent 0b2590024d
commit 86ee14f3b0
9 changed files with 130 additions and 0 deletions

View File

@ -38,6 +38,7 @@ docker run -d -p 80:8080 medicean/vulapps:s_struts2_s2-037
* [B](#b)
* [C](#c)
* [F](#f)
* [I](#i)
* [J](#j)
* [M](#m)
@ -65,6 +66,10 @@ docker run -d -p 80:8080 medicean/vulapps:s_struts2_s2-037
* [Cisco](./c/cisco/)
* [CmsEasy](./c/cmseasy/)
### [F](./f/)<div id="f"></div>
* [FFmpeg](./i/ffmpeg/)
### [I](./i/)<div id="i"></div>
* [ImageMagick](./i/imagemagick/)

3
f/README.md Normal file
View File

@ -0,0 +1,3 @@
# F
* [FFmpeg](./ffmpeg/)

22
f/ffmpeg/1/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM jrottenberg/ffmpeg:3.1.3-ubuntu
# RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
# ENV TZ=Asia/Shanghai
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN set -x \
&& apt-get update \
&& apt-get install -y apache2 php php-dev libapache2-mod-php php-cli \
&& chown -R www-data:www-data /var/www/html/ \
&& rm -rf /var/www/html/*
COPY src/index.php /var/www/html/index.php
COPY src/start.sh /start.sh
RUN set -x \
&& rm -rf /var/lib/apt/lists \
&& chmod +x /start.sh
EXPOSE 80
ENTRYPOINT ["/start.sh"]

60
f/ffmpeg/1/README.md Normal file
View File

@ -0,0 +1,60 @@
## FFmpeg 文件读取漏洞(CVE-2017-9993)
### 漏洞信息
FFmpeg是一个完整的跨平台解决方案用于记录、转换流式传输音频和视频可用于预览生成和视频转换的视频编码软件。已知FFmpeg可以处理可能包含对外部文件的引用的HLS播放列表,可以使用AVI文件中的GAB2字幕块来触发此功能再通过XBIN编解码器检索转换节点的本地文件从而导致了可以在转码后的视频里包含了本地文件.
### 影响范围
小于 2.8.12, 3.0.x 以及 3.1.x 版本小于 3.1.9, 3.2.x 小于 3.2.6, 以及 3.3.x 版本小于 3.3.2
### 镜像信息
类型 |
:-:|:-:
FFmpeg | 3.1.3
HTTP 端口 | 80
镜像 tag | f_ffmpeg_1
### 获取环境:
1. 拉取镜像到本地
```
$ docker pull medicean/vulapps:f_ffmpeg_1
```
2. 启动环境
```
$ docker run -d -p 8000:80 medicean/vulapps:f_ffmpeg_1
```
> `-p 8000:80` 前面的 8000 代表物理机的端口,可随意指定。
访问 http://127.0.0.1:8000
### POC
> 假如目标地址为: http://127.0.0.1:8000/
使用该脚本用于生成 POC: https://github.com/neex/ffmpeg-avi-m3u-xbin
以读取 `/etc/passwd` 为例:
1. 生成特殊的视频文件
```
$ python3 gen_xbin_avi.py file:///etc/passwd passwd.avi
```
2. 上传 [passwd.avi](./passwd.avi) 到目标,即可看到如下结果:
![](./poc.png)
### 相关链接
* [CVE-2017-9993 Detail](https://nvd.nist.gov/vuln/detail/CVE-2017-9993)
* [ffmpeg-avi-m3u-xbin](https://github.com/neex/ffmpeg-avi-m3u-xbin)
* [FFmpeg 安全问题讨论](http://paper.seebug.org/338/)

BIN
f/ffmpeg/1/passwd.avi Normal file

Binary file not shown.

BIN
f/ffmpeg/1/poc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

33
f/ffmpeg/1/src/index.php Normal file
View File

@ -0,0 +1,33 @@
<?php
// PHP 测试脚本来自:
//
// https://github.com/phith0n/vulhub/blob/master/ffmpeg/phdays/www/index.php
if(!empty($_FILES)) {
$filename = @escapeshellarg($_FILES['file']['tmp_name']);
$newname = './' . uniqid() . '.mp4';
@shell_exec("ffmpeg -i $filename $newname");
}
?>
<html>
<head>
<meta charset="utf-8">
<title>CVE-2017-9993 视频播放器</title>
</head>
<body>
<h1>CVE-2017-9993 Demo</h1>
<?php if(!empty($_FILES)): ?>
<div>
<video src="<?=$newname?>" controls="controls" width="640" height="480"></video>
</div>
<?php endif; ?>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="提交">
</form>
</body>
</html>

3
f/ffmpeg/1/src/start.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/etc/init.d/apache2 restart
/usr/bin/tail -f /dev/null

4
f/ffmpeg/README.md Normal file
View File

@ -0,0 +1,4 @@
FFmpeg
---
1. [FFmpeg 文件读取漏洞(CVE-2017-9993)](./1/)