# Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting') (CWE-113) The product receives data from an HTTP agent/component, and it places this data in HTTP response headers without neutralizing CRLF sequences. **Stack:** Go - Prevalence: Średnia Pokryto 3 języków - Impact: Wysoki 2 reguł o wysokim poziomie - Prevention: Udokumentowane 3 przykładów poprawek **OWASP:** Injection (A03:2021-Injection) - #3 ## Description An attacker can inject CRLF sequences into HTTP headers to create additional headers or response body content. This can lead to cache poisoning, cross-site scripting, or other attacks. ## Prevention Strategie zapobiegania dla HTTP Response Splitting oparte na 1 regułach detekcji Shoulder. ### Go Strip CRLF characters from user input before setting HTTP headers ## Warning Signs - [MEDIUM] user input flowing to HTTP headers without CRLF sanitization ## Consequences - Wykonanie nieautoryzowanego kodu - Obejście mechanizmu ochrony - Modyfikacja danych aplikacji ## Mitigations - Nigdy nie umieszczaj danych wprowadzanych przez użytkownika bezpośrednio w nagłówkach odpowiedzi HTTP - Sanitizuj wszystkie dane wprowadzane przez użytkownika, które mogą trafić do nagłówków - Korzystaj z metod udostępnianych przez framework do ustawiania nagłówków, które obsługują kodowanie ## Detection - Total rules: 3 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (1 rules) - **HTTP Header Injection** [MEDIUM]: Detects user input flowing to HTTP headers without CRLF sanitization. - Remediation: Remove CRLF characters from user input before setting headers. ```go value := strings.ReplaceAll(userInput, "\r", "") value = strings.ReplaceAll(value, "\n", "") w.Header().Set("X-Custom", value) ``` Learn more: https://shoulder.dev/learn/go/cwe-113/header-injection