diff --git a/src/pentesting-web/file-upload/README.md b/src/pentesting-web/file-upload/README.md index 1ce102580d5..e028512859e 100644 --- a/src/pentesting-web/file-upload/README.md +++ b/src/pentesting-web/file-upload/README.md @@ -328,6 +328,53 @@ Content-Type: text/xml - Bindings are often localhost-only; pair with a full-read SSRF (absolute-URL request line, Host header ignored) to reach `127.0.0.1` if the Axis2 port isn’t exposed. - After writing, browse to `/trufusionPortal/jsp/shell.jsp?cmd=id` to execute. + +### Auto-handled HTML file inputs in crawlers / browser automation → local arbitrary file write + +Some **browser-powered crawlers** and automation frameworks try to interact with discovered `` elements by **creating a local temporary file** and automatically selecting it in the browser. If the local filename is derived from **page-controlled metadata** such as `accept`, `name`, or `value`, the target website can turn ordinary crawling into a **local arbitrary file write**. + +Typical vulnerable flow: + +1. The crawler discovers a file input and decides to auto-populate it. +2. It derives a **local filename** from attacker-controlled HTML attributes. +3. It writes attacker-controlled bytes to that path. +4. It calls a browser API such as `selectFile()` on the generated path. + +If the implementation accepts any `accept` token starting with `.` as a harmless extension, a payload like `./../../../../target/path/payload.bat` may bypass the check while still carrying **path traversal**. When this string is later passed to `Path.resolve()` / `Path.Combine()` without canonicalization and a **"must stay under temp dir"** check, the final write can escape the temporary directory. + +Minimal malicious form: + +```html +
+``` + +In that pattern: + +- `value` becomes the **local file content** (`calc.exe` in the example). +- `accept` becomes part of the **local filename/path**. +- The result is an **attacker-controlled text file write** anywhere writable if the parent directory already exists. + +A practical Windows chain is to target the current user's **Startup** folder so the dropped `.bat` executes on the next logon: + +```text +C:\Users\