# URL and path concatenation traversal

User input glued into a URL or file path without encoding or normalization, letting it escape the intended prefix

_Area: Memory corruption and native code. Seen in 2 disclosed reports; one confirmed bounty: $7,500; latest 2024-05-07. Updated 2026-11-09._

## How it works
A component builds a URL or file path by gluing user-controlled text onto a trusted prefix, assuming the input is a harmless identifier. If the input is not encoded and the result is not normalized, characters like `../`, `?`, `#` or an absolute path let the input change which resource is addressed. The trust boundary ("this ID only names my own row/file") silently breaks, and the request or file access lands somewhere the developer never intended.

## Where it shows up
- String concatenation of an ID, rowKey, filename or query value into a backend URL or filesystem path [E2](https://bugbountylibrary.com/r/blog%3Abreachproof-net-blog-lethal-injection-how-we-hacked-microsoft-ai-chat-bot.md).
- Hand-rolled query-string parsing that diverges from the browser's URL parser, e.g. `lastIndexOf('?')` instead of the first `?` [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md).
- Local HTTP servers or webview resource roots that accept paths from a page or iframe [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md).
- Enabling condition: `localResourceRoots` or file-access scopes set to a whole disk rather than a narrow directory, widening what a traversal can reach [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md).
- ActiveX/OLE objects whose control path is loaded from an external URL without path validation [E3](https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-formbook-adopts-cab-less-approach.md).

## How to review
Find every place user input reaches a URL or path. The invariant: after construction, the resolved target must still sit under the intended prefix and address only the intended resource. Check that input is percent-encoded for URL components and that the final path is normalized and prefix-checked (not just string-prefixed). For parsers, confirm the code uses the same parser as the consumer (browser URL API, `path.resolve`) rather than manual index math. For webviews, confirm resource roots are scoped to the extension's own directory [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md). For document renderers, confirm externally linked controls cannot traverse to a dropped local file [E3](https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-formbook-adopts-cab-less-approach.md).

## How finders spotted it
- Recognized the Azure Table API response shape in a data-connections endpoint, hypothesized tenants share one table, then tested traversal on the rowKey [E2](https://bugbountylibrary.com/r/blog%3Abreachproof-net-blog-lethal-injection-how-we-hacked-microsoft-ai-chat-bot.md).
- Read the SARIF viewer rendering code and noticed `escapeHtml=false` plus a disk-wide `localResourceRoots`; after CSP blocked script injection, pivoted to the local server and spotted `lastIndexOf('?')` diverging from browser parsing [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md).
- Decoded HTML-entity-encoded OLE relationship targets in `word/_rels/document.xml.rels` to recover the external URLs the document pointed at [E3](https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-formbook-adopts-cab-less-approach.md).

## Variants seen
- Backend URL traversal via unencoded rowKey reaching another tenant's table rows [E2](https://bugbountylibrary.com/r/blog%3Abreachproof-net-blog-lethal-injection-how-we-hacked-microsoft-ai-chat-bot.md).
- Parser-differential path traversal in a local HTTP server, escalated by DNS rebinding [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md).
- Directory traversal in MSHTML ActiveX control loading from an Office document [E3](https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-formbook-adopts-cab-less-approach.md).

## Impact and severity
E2 chained cross-tenant secret disclosure with sandbox escapes to reach backend root and read process memory for Azure JWT secrets and Kubernetes traffic. E1 enabled local file theft (SSH keys) once DNS rebinding removed the need for the victim to preview a malicious file. E3's traversal was the loading step in a chain that ended in a credential-stealing trojan; the traversal itself is the entry, not the payload. Severity rises with reach (cross-tenant, whole disk) and with chaining to code execution or secret disclosure [E1](https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md)[E2](https://bugbountylibrary.com/r/blog%3Abreachproof-net-blog-lethal-injection-how-we-hacked-microsoft-ai-chat-bot.md)[E3](https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-formbook-adopts-cab-less-approach.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.
- **Azure Health Bot** (data-connections API and Node.js vm2 sandbox) (version not stated): Lethal Injection: How We Hacked Microsoft's Healthcare Chat Bot. Report: https://bugbountylibrary.com/r/blog%3Abreachproof-net-blog-lethal-injection-how-we-hacked-microsoft-ai-chat-bot.md
- **Microsoft SARIF viewer** (ReactMarkdown rendering of finding descriptions) (version not stated): Escaping misconfigured VSCode extensions. Report: https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Ablog-trailofbits-com-2023-02-21-vscode-extension-escape-vulnerability.md
- E2: https://bugbountylibrary.com/r/blog%3Abreachproof-net-blog-lethal-injection-how-we-hacked-microsoft-ai-chat-bot.md
- E3: https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-formbook-adopts-cab-less-approach.md
