# HTTP Request Smuggling in Transform Rules using hexadecimal escape sequences in the concat() function

Transform Rules concat() accepted hex escapes, letting a header rewrite inject CRLF and Transfer-Encoding to smuggle requests past Cloudflare Access into internal origins.

- Payout: $6,000
- Severity: critical
- Program: Cloudflare
- Found by: albertspedersen
- Disclosed: 2022-05-16
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/1478633
- Library page: https://bugbountylibrary.com/r/h1%3A1478633
- Tags: area:cloud domain:infra domain:web impact:integrity impact:internal-access kind:bounty platform:hackerone sev:critical technique:chained vuln:auth-bypass vuln:crlf-injection vuln:request-smuggling

**Target:** Cloudflare Ruleset Engine / Transform Rules header rewrite (concat() function)
**Root cause:** String functions like concat() accepted hexadecimal escape sequences (\x0d\x0a) and the output was not sanitized before being placed into request headers, allowing CRLF injection into header values.
**Steps:**
1. Create a dynamic header rewrite Transform Rule whose value is `concat("-", "\x0d\x0aTransfer-Encoding: chunked")`
2. Send a POST request with body `0\r\n\r\nGET / HTTP/1.1\r\nHost: internal.example.com\r\n\r\n`
3. The injected CRLF adds a Transfer-Encoding: chunked header, creating a TE.CL desync
4. The smuggled request is processed by the internal origin, bypassing Cloudflare Access
**How found:** Researcher noticed the Ruleset Engine accepted hexadecimal escape sequences in string functions like concat(); hypothesized lack of output sanitation would allow newline injection into header values, then tested CRLF + Transfer-Encoding to trigger a desync.
**Exploitation:** Attacker controls a Transform Rule that rewrites a request header; hex escapes inject CRLF plus a Transfer-Encoding: chunked header, desyncing front-end/back-end parsing (TE.CL). The smuggled prefix `0\r\n\r\nGET / HTTP/1.1...` is then interpreted by the internal origin, letting the attacker reach internal content normally gated by Cloudflare Access.
**Escalation:** Because Transform Rules run early in the request flow, internal headers could be used to control many aspects of the request, widening the smuggling surface beyond a single header.
**Insight:** When a WAF/edge rule engine exposes string-building functions, test whether escape sequences (\x0d\x0a, unicode) in function arguments survive into the emitted header/body — rule-engine output is a smuggling injection point, not just user input.

## Proof of concept (copied exactly from the original report)

**Header rewrite rule injecting CRLF via concat()**

```
concat("-", "\x0d\x0aTransfer-Encoding: chunked")
```

**Smuggled request body payload**

```
0\r\n\r\nGET / HTTP/1.1\r\nHost: internal.example.com\r\n\r\n
```

