# GHSA-6r3c-8xf3-ggrr: Directory traversal outside of SENDFILE_ROOT in django-sendfile2

> Attackers can read arbitrary files outside the intended root directory due to improper path validation in django-sendfile2 backends.

- **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:** 24 Jun 2020

## What is GHSA-6r3c-8xf3-ggrr?

GHSA-6r3c-8xf3-ggrr is a path traversal vulnerability in django-sendfile2, published on 24 Jun 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

django-sendfile2 currently relies on the backend to correctly limit file paths to `SENDFILE_ROOT`. This is not the case for the `simple` and `development` backends, it is also not necessarily the case for any of the other backends either (it's just an assumption that was made by the original author).

This will be fixed in 0.6.0 which is to be released the same day as this advisory is made public.

When upgrading, you will need to make sure `SENDFILE_ROOT` is set in your settings module if it wasn't already.

## Which versions are affected by GHSA-6r3c-8xf3-ggrr?

2 open source packages ship an affected version, including django-sendfile2.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `django-sendfile2` | PyPI | All versions | 0.6.0 |
| `django-sendfile2` | PyPI | All versions | 0.6.0 |

## How do I fix GHSA-6r3c-8xf3-ggrr?

Upgrade django-sendfile2 to 0.6.0 or later.

## Is GHSA-6r3c-8xf3-ggrr being exploited?

There is no known exploitation of GHSA-6r3c-8xf3-ggrr in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-6r3c-8xf3-ggrr and fix it if it is affected.

What it is: GHSA-6r3c-8xf3-ggrr is a path traversal vulnerability in django-sendfile2, published on 24 Jun 2020. 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-6r3c-8xf3-ggrr in the wild and no public exploit code.

Affected packages and fixed versions:
- django-sendfile2 (PyPI): affected all versions; fixed in 0.6.0
- django-sendfile2 (PyPI): affected all versions; fixed in 0.6.0

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-6r3c-8xf3-ggrr/ (Markdown: https://insights.sbomify.com/GHSA-6r3c-8xf3-ggrr/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-6r3c-8xf3-ggrr

---
From sbomify Insights: https://insights.sbomify.com/GHSA-6r3c-8xf3-ggrr/
Summaries are generated and may contain mistakes; the official description above is the record.
