# 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:** JavaScript - Prevalence: मध्यम 3 भाषाएँ कवर की गईं - Impact: उच्च 2 उच्च गंभीरता वाले नियम - Prevention: प्रलेखित 3 फिक्स उदाहरण **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 1 Shoulder डिटेक्शन नियमों पर आधारित HTTP Response Splitting के लिए रोकथाम रणनीतियाँ। ### JavaScript Strip CRLF characters from user input before setting HTTP response headers ## Warning Signs - [HIGH] user input flowing into HTTP response headers without CRLF sanitization ## Consequences - अनधिकृत कोड निष्पादित करना - सुरक्षा तंत्र को बायपास करना - एप्लिकेशन डेटा संशोधित करना ## Mitigations - HTTP प्रतिक्रिया हेडर में उपयोगकर्ता इनपुट को कभी सीधे शामिल न करें - हेडर में शामिल किए जा सकने वाले सभी उपयोगकर्ता इनपुट को सैनिटाइज़ करें - हेडर सेट करने के लिए फ़्रेमवर्क-प्रदत्त उन विधियों का उपयोग करें जो एनकोडिंग संभालती हैं ## Detection - Total rules: 3 - Languages: go, javascript, typescript, python ## Rules by Language ### Javascript (1 rules) - **HTTP Header Injection (Response Splitting)** [HIGH]: Detects user input flowing into HTTP response headers without CRLF sanitization. - Remediation: Remove CRLF characters from user input before setting headers. ```javascript const sanitized = userInput.replace(/[\r\n]/g, ''); res.setHeader('X-Custom-Header', sanitized); ``` Learn more: https://shoulder.dev/learn/javascript/cwe-113/header-injection ### Typescript (1 rules) - **HTTP Header Injection (Response Splitting)** [HIGH]: Detects user input flowing into HTTP response headers without CRLF sanitization. - Remediation: Remove CRLF characters from user input before setting headers. ```javascript const sanitized = userInput.replace(/[\r\n]/g, ''); res.setHeader('X-Custom-Header', sanitized); ``` Learn more: https://shoulder.dev/learn/javascript/cwe-113/header-injection