Awesome-POC/Web应用漏洞/GhostScript 沙箱绕过(命令执行)漏洞 CVE-2018-16509.md
2024-11-06 14:10:36 +08:00

34 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GhostScript 沙箱绕过(命令执行)漏洞 CVE-2018-16509
## 漏洞描述
Ghostscript是一套建基于Adobe、PostScript及可移植文档格式PDF的页面描述语言等而编译成的免费软件。
8 月 21 号Tavis Ormandy 通过公开邮件列表,再次指出 GhostScript 的安全沙箱可以被绕过,通过构造恶意的图片内容,将可以造成命令执行、文件读取、文件删除等漏洞:
- http://seclists.org/oss-sec/2018/q3/142
- https://bugs.chromium.org/p/project-zero/issues/detail?id=1640
GhostScript 被许多图片处理库所使用,如 ImageMagick、Python PIL 等,默认情况下这些库会根据图片的内容将其分发给不同的处理方法,其中就包括 GhostScript。
## 环境搭建
Vulhub执行如下命令启动漏洞环境其中包括最新版 GhostScript 9.23、ImageMagick 7.0.8
```
docker-compose up -d
```
环境启动后,访问`http://your-ip:8080`将可以看到一个上传组件。
## 漏洞复现
上传[poc.png](https://github.com/vulhub/vulhub/blob/master/ghostscript/CVE-2018-16509/poc.png),将执行命令`id > /tmp/success && cat /tmp/success`
![image-20220223191635128](images/202202231916175.png)
进入容器,可以看到/tmp/success已被创建。
![image-20220223192502496](images/202202231925597.png)