# Uncontained path join traversal

User path, subdir or version joined to a base path without normalization or containment check

_Area: Web infrastructure and server-side requests. Seen in 2 disclosed reports; latest 2023-12-23. Updated 2026-11-14._

## How it works
A base directory or install spec is combined with a user-supplied value (subdir, file path, package version) by concatenation or `join()` without normalization or a containment check. The code assumes the value is a simple relative name, but `..` sequences, absolute paths, or URL-style specs escape the base. Whatever consumes the result — a directory walker, an uploader, `open()`, or a package manager — then acts outside the intended root [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)[E2](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-deno-registry-tampering-with-arbitrary-packages-en.md)[E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md).

## Where it shows up
- `subdir`/`path`/`file_path` parameters concatenated to a clone or base path, then fed to `walk()`, glob, or storage upload [E2](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-deno-registry-tampering-with-arbitrary-packages-en.md)
- Package-manager install strings built by interpolation, e.g. `npm install pkg@{version}` where version can be a tarball URL [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)
- Sibling functions where one calls a `validate_safe_path()` helper and another does not [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md)
- Internal API proxies that strictly validate one namespace but not per-tenant ones [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)

## How to review
Find every place a user value reaches a filesystem or install operation. The invariant: after joining, the resolved path must still be inside the intended base (normalize, then check the prefix), or the value must be rejected. For install specs, confirm the version is constrained to a literal version, not a URL or path. Grep for the project's own validation helper and verify every filesystem-touching sibling calls it; a validated download next to an unvalidated upload is the classic miss [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md).

## How finders spotted it
- Started from a prior blog post, symlinked build output to read a sensitive file; it failed for one file but worked for a parsed config file, prompting source reading [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)
- Read build_tool source, saw an env var interpolated into `npm install`, then read npm's argument parser to learn versions accept tarball URLs [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)
- While fuzzing an internal proxy, noticed all users shared one account ID and per-deploy namespaces were not validated [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)
- Scoped review to a "secure runtime" claim, noticed `subdir` concatenated to `clonePath` unsanitized, traced into `walk()` and S3 upload [E2](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-deno-registry-tampering-with-arbitrary-packages-en.md)
- Code reading: saw `validate_safe_path()` in `download_attachment()` but missing in `_upload_attachment_direct()` in the same file [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md)

## Variants seen
- Traversal in a registry upload `subdir` leaking `/proc/self/environ` credentials [E2](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-deno-registry-tampering-with-arbitrary-packages-en.md)
- Version-string injection into a package install running as root [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)
- Missing validation on an upload tool's `file_path` — a missing-helper-call form of the same containment failure, not a join bug [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md)

## Impact and severity
E2 chained traversal file read to credential theft and supply-chain tampering of all hosted modules. E1 chained file read to root in a build sandbox to cross-tenant access to all assets and code, plus defacement potential. E3 leaked env vars enabling account takeover and lateral movement, reachable via prompt injection without credentials. Severity rises sharply when the traversal reaches secrets or shared infrastructure [E1](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md)[E2](https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-deno-registry-tampering-with-arbitrary-packages-en.md)[E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md).

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **Cloudflare Pages** (build_tool) (version not stated): Cloudflare Pages: build sandbox root RCE and API proxy traversal. Report: https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-cloudflare-pages-privesc-and-page-tampering.md
- E2: https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-deno-registry-tampering-with-arbitrary-packages-en.md
- E3: https://bugbountylibrary.com/r/ghsa%3AGHSA-g5r6-gv6m-f5jv.md
