# Improper Neutralization of CRLF Sequences ('CRLF Injection') (CWE-93) The product uses CRLF (carriage return line feed) as a special element, e.g. to separate headers or records, but it does not neutralize or incorrectly neutralizes CRLF sequences from inputs. **Stack:** Python - Prevalence: Średnia Pokryto 3 języków - Impact: Wysoki 3 reguł o wysokim poziomie - Prevention: Udokumentowane 3 przykładów poprawek **OWASP:** Injection (A03:2021-Injection) - #3 ## Description CRLF injection can be used to inject malicious headers in HTTP responses (HTTP response splitting), forge log entries, or manipulate other protocols that use CRLF as a delimiter. ## Prevention Strategie zapobiegania dla CRLF Injection oparte na 1 regułach detekcji Shoulder. ### Python Strip newline characters from email headers before use ## Warning Signs - [HIGH] user input used in email headers without newline sanitization ## Consequences - Modyfikacja danych aplikacji - Wykonanie nieautoryzowanego kodu - Ukrywanie aktywności ## Mitigations - Usuwaj lub koduj sekwencje CRLF z każdego wejścia używanego w nagłówkach lub logach - Korzystaj z frameworków, które automatycznie obsługują kodowanie nagłówków - Sprawdzaj, czy dane wejściowe nie zawierają nieoczekiwanych znaków kontrolnych ## Detection - Total rules: 3 - Languages: go, javascript, typescript, python ## Rules by Language ### Python (1 rules) - **Email Header Injection** [HIGH]: Detects user input used in email headers without newline sanitization. - Remediation: Remove newlines from email headers before use. ```python safe_subject = subject.replace('\r', '').replace('\n', '') ``` Learn more: https://shoulder.dev/learn/python/cwe-93/email-injection