# 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: Media 3 lenguajes cubiertos - Impact: Alto 3 reglas de severidad alta - Prevention: Documentada 3 ejemplos de corrección **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 Estrategias de prevención para CRLF Injection basadas en 1 reglas de detección de Shoulder. ### Python Strip newline characters from email headers before use ## Warning Signs - [HIGH] user input used in email headers without newline sanitization ## Consequences - Modificar datos de la aplicación - Ejecutar código no autorizado - Ocultar actividades ## Mitigations - Elimina o codifica las secuencias CRLF de toda entrada usada en cabeceras o logs - Usa frameworks que gestionen automáticamente la codificación de cabeceras - Verifica que las entradas no contengan caracteres de control inesperados ## 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