CVE-2023-29159
Starlette has Path Traversal vulnerability in StaticFiles
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Exploit likelihood
What each source reports
NVD Score used
7.5
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
CVE-2023-29159- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-22
- Updated
- 2026-11-02
CVE List
7.5
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
CVE-2023-29159- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-22
- Updated
- 2026-11-02
EUVDEUVD-2023-0245
7.5
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
EUVD-2023-0245- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-v5gw-mw7f-84px
6.3
Starlette has Path Traversal vulnerability in StaticFiles
Summary
When using StaticFiles, if there's a file or directory that starts with the same name as the StaticFiles directory, that file or directory is also exposed via StaticFiles which is a path traversal vulnerability.
Details
The root cause of this issue is the usage of os.path.commonprefix():
https://github.com/encode/starlette/blob/4bab981d9e870f6cee1bd4cd59b87ddaf355b2dc/starlette/staticfiles.py#L172-L174
As stated in the Python documentation (https://docs.python.org/3/library/os.path.html#os.path.commonprefix) this function returns the longest prefix common to paths.
When passing a path like /static/../static1.txt, os.path.commonprefix([full_path, directory]) returns ./static which is the common part of ./static1.txt and ./static, It refers to /static/../static1.txt because it is considered in the staticfiles directory. As a result, it becomes possible to view files that should not be open to the public.
The solution is to use os.path.commonpath as the Python documentation explains that os.path.commonprefix works a character at a time, it does not treat the arguments as paths.
PoC
In order to reproduce the issue, you need to create the following structure:
├── static
│ ├── index.html
├── static_disallow
│ ├── index.html
└── static1.txt
And run the Starlette app with:
import uvicorn
from starlette.applications import Starlette
from starlette.routing import Mount
from starlette.staticfiles import StaticFiles
routes = [
Mount("/static", app=StaticFiles(directory="static", html=True), name="static"),
]
app = Starlette(routes=routes)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
And running the commands:
curl --path-as-is 'localhost:8000/static/../static_disallow/'
curl --path-as-is 'localhost:8000/static/../static1.txt'
The static1.txt and the directory static_disallow are exposed.
Impact
Confidentiality is breached: An attacker may obtain files that should not be open to the public.
Credits
Security researcher Masashi Yamane of LAC Co., Ltd reported this vulnerability to JPCERT/CC Vulnerability Coordination Group and they contacted us to coordinate a patch for the security issue.
- Record
GHSA-v5gw-mw7f-84px- CVSS 4.0
- 6.3 Medium
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N - CVSS 3.1
- 3.7 Low
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N - Weakness
- CWE-22
- Updated
- 2026-11-02
OSV
7.5
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
CVE-2023-29159- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2023-29159
7.5
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
DEBIAN-CVE-2023-29159- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
Show 5 moreShow less
OSVGHSA-v5gw-mw7f-84px
6.3
Starlette has Path Traversal vulnerability in StaticFiles
Summary
When using StaticFiles, if there's a file or directory that starts with the same name as the StaticFiles directory, that file or directory is also exposed via StaticFiles which is a path traversal vulnerability.
Details
The root cause of this issue is the usage of os.path.commonprefix():
https://github.com/encode/starlette/blob/4bab981d9e870f6cee1bd4cd59b87ddaf355b2dc/starlette/staticfiles.py#L172-L174
As stated in the Python documentation (https://docs.python.org/3/library/os.path.html#os.path.commonprefix) this function returns the longest prefix common to paths.
When passing a path like /static/../static1.txt, os.path.commonprefix([full_path, directory]) returns ./static which is the common part of ./static1.txt and ./static, It refers to /static/../static1.txt because it is considered in the staticfiles directory. As a result, it becomes possible to view files that should not be open to the public.
The solution is to use os.path.commonpath as the Python documentation explains that os.path.commonprefix works a character at a time, it does not treat the arguments as paths.
PoC
In order to reproduce the issue, you need to create the following structure:
├── static
│ ├── index.html
├── static_disallow
│ ├── index.html
└── static1.txt
And run the Starlette app with:
import uvicorn
from starlette.applications import Starlette
from starlette.routing import Mount
from starlette.staticfiles import StaticFiles
routes = [
Mount("/static", app=StaticFiles(directory="static", html=True), name="static"),
]
app = Starlette(routes=routes)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
And running the commands:
curl --path-as-is 'localhost:8000/static/../static_disallow/'
curl --path-as-is 'localhost:8000/static/../static1.txt'
The static1.txt and the directory static_disallow are exposed.
Impact
Confidentiality is breached: An attacker may obtain files that should not be open to the public.
Credits
Security researcher Masashi Yamane of LAC Co., Ltd reported this vulnerability to JPCERT/CC Vulnerability Coordination Group and they contacted us to coordinate a patch for the security issue.
- Record
GHSA-v5gw-mw7f-84px- CVSS 4.0
- 6.3 Medium
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N - CVSS 3.1
- 3.7 Low
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N - Weakness
- CWE-22
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2023-29159
7.5
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
UBUNTU-CVE-2023-29159- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
OSVCLSA-2026-1787300457 No score
TuxCare security update for starlette (3 CVEs)
TuxCare rebuilt starlette to address 3 CVEs. Fixed in 0.13.6.post4+tuxcare.
- Record
CLSA-2026-1787300457- Updated
- 2026-11-02
OSVCLSA-2026-1789447406 No score
TuxCare security update for starlette (8 CVEs)
TuxCare rebuilt starlette to address 8 CVEs. Fixed in 0.25.0.post1+tuxcare.
- Record
CLSA-2026-1789447406- Updated
- 2026-11-02
OSVPYSEC-2023-83 No score
Directory traversal vulnerability in Starlette versions 0.13.5 and later and prior to 0.27.0 allows a remote unauthenticated attacker to view files in a web service which was built using Starlette.
- Record
PYSEC-2023-83- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
starlettePyPI |
0.13.5 up to 0.27.0 | 0.27.0 |
starletteTuxCare:PyPI From an advisory covering 3 CVEs |
0.13.6 up to 0.13.6.post4+tuxcare, plus listed versions 0.13.6.post1+tuxcare0.13.6.post2+tuxcare0.13.6.post3+tuxcare |
0.13.6.post4+tuxcare |
starletteTuxCare:PyPI From an advisory covering 8 CVEs |
0.25.0 up to 0.25.0.post1+tuxcare | 0.25.0.post1+tuxcare |
starletteDebian:12 |
before 0.26.1-1+deb12u1, plus listed versions 0.26.1-1 |
0.26.1-1+deb12u1 |
starletteDebian:13 |
before 0.28.0-1 | 0.28.0-1 |
starletteDebian:14 |
before 0.28.0-1 | 0.28.0-1 |
starlettePyPI |
0.13.5 up to 0.27.0, plus listed versions 0.13.60.13.70.13.80.14.00.14.1 Show 22 moreShow less0.14.20.15.00.16.00.17.00.17.10.18.00.19.00.19.10.20.00.20.10.20.20.20.30.20.40.21.00.22.00.23.00.23.10.24.00.25.00.26.00.26.0.post10.26.1 |
0.27.0 |
starletteUbuntu:22.04:LTS |
All versions, plus listed versions 0.14.1-10.16.0-10.18.0-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2023-29159 is a high vulnerability (CVSS 7.5) in Encode Starlette, published May 17, 2023. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 2.59%, the 85th percentile. Fixed in starlette 0.27.0.
References
github.com/encode/starlette/security/advisories/GHSA-v5gw-mw7f-84px
github.com/encode/starlette/releases/tag/0.27.0
jvn.jp/en/jp/JVN95981715
github.com/encode/starlette/commit/1797de464124b090f10cf570441e8292936d63e3
github.com/encode/starlette/blob/4bab981d9e870f6cee1bd4cd59b87ddaf355b2dc/starlette/staticfiles.py
nvd.nist.gov/vuln/detail/CVE-2023-29159
Show 7 moreShow less
github.com/pypa/advisory-database/tree/main/vulns/starlette/PYSEC-2023-83.yaml
github.com/advisories/GHSA-v5gw-mw7f-84px
github.com/CVEProject/cvelistV5/tree/main/cves/2023/29xxx/CVE-2023-29159.json
security-tracker.debian.org/tracker/CVE-2023-29159
github.com/encode/starlette
ubuntu.com/security/CVE-2023-29159
cve.org/CVERecord?id=CVE-2023-29159