mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
17 lines
640 B
Rust
17 lines
640 B
Rust
// Phase 08 (Track J.6) — Rust HEADER_INJECTION vuln fixture.
|
|
//
|
|
// The function inserts the attacker-controlled `value` into an axum
|
|
// `HeaderMap` via `headers_mut().insert`, bypassing
|
|
// `HeaderValue::from_str`'s newline check by passing the tainted
|
|
// bytes through `HeaderValue::from_bytes(...).unwrap()`. A payload
|
|
// carrying `\r\nSet-Cookie: nyx-injected=pwn` splits the single
|
|
// header into two on the wire.
|
|
use axum::http::HeaderMap;
|
|
use axum::http::HeaderValue;
|
|
|
|
pub fn run(headers: &mut HeaderMap, value: &str) {
|
|
headers.insert(
|
|
"set-cookie",
|
|
HeaderValue::from_bytes(value.as_bytes()).unwrap(),
|
|
);
|
|
}
|