# GHSA-373w-rj84-pv6x: SafeURL-Python's hostname blocklist does not block FQDNs

> Attackers can bypass hostname blocklists in SafeURL-Python by using FQDNs, enabling SSRF attacks against specifically blocked hosts.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Jun 2023

## What is GHSA-373w-rj84-pv6x?

GHSA-373w-rj84-pv6x is a server-side request forgery vulnerability in SafeURL-Python, published on 29 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Description
If a hostname was blacklisted, it was possible to bypass the blacklist by requesting the FQDN of the host (e.g. adding `.` to the end).

### Impact
The main purpose of this library is to block requests to internal/private IPs and these cannot be bypassed using this finding. But if a library user had specifically set certain hostnames as blocked, then an attacker would be able to circumvent that block to cause SSRFs to request those hostnames.

### Patches
Fixed by https://github.com/IncludeSecurity/safeurl-python/pull/6

### Credit
https://github.com/Sim4n6

## Which versions are affected by GHSA-373w-rj84-pv6x?

2 open source packages ship an affected version, including SafeURL-Python and safeurl-python.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `SafeURL-Python` | PyPI | All versions | 1.3 |
| `safeurl-python` | PyPI | All versions | 1.3 |

## How do I fix GHSA-373w-rj84-pv6x?

Upgrade SafeURL-Python to 1.3 or later.

## Is GHSA-373w-rj84-pv6x being exploited?

There is no known exploitation of GHSA-373w-rj84-pv6x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-373w-rj84-pv6x and fix it if it is affected.

What it is: GHSA-373w-rj84-pv6x is a server-side request forgery vulnerability in SafeURL-Python, published on 29 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-373w-rj84-pv6x in the wild and no public exploit code.

Affected packages and fixed versions:
- SafeURL-Python (PyPI): affected all versions; fixed in 1.3
- safeurl-python (PyPI): affected all versions; fixed in 1.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-373w-rj84-pv6x/ (Markdown: https://insights.sbomify.com/GHSA-373w-rj84-pv6x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-373w-rj84-pv6x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-373w-rj84-pv6x/
Summaries are generated and may contain mistakes; the official description above is the record.
