# Improper Handling of Extra Parameters (CWE-235) The product does not handle or incorrectly handles when the number of parameters, fields, or arguments with the same name exceeds the expected amount. - Prevalence: मध्यम 2 भाषाएँ कवर की गईं - Impact: मध्यम समीक्षा अनुशंसित - Prevention: प्रलेखित 2 फिक्स उदाहरण **OWASP:** Injection (A03:2021-Injection) - #3 ## Description When applications receive duplicate parameters, they may process them inconsistently, leading to security bypasses or logic errors. Different frameworks may select the first, last, or combine duplicate parameters. ## Prevention 2 Shoulder डिटेक्शन नियमों पर आधारित Improper Handling of Extra Parameters के लिए रोकथाम रणनीतियाँ। ### JavaScript Add hpp middleware to normalize duplicate query parameters ### Python Explicitly check for and reject duplicate HTTP parameters ## Warning Signs - [MEDIUM] handling of duplicate HTTP parameters without proper validation - [LOW] Request parameters used without HPP protection. Express converts duplicate query/body params to arrays, which can bypass - [LOW] missing HTTP Parameter Pollution (HPP) protection in Express ## Consequences - सुरक्षा तंत्र को बायपास करना - एप्लिकेशन डेटा संशोधित करना ## Mitigations - डुप्लिकेट पैरामीटरों को संभालने के लिए नीति परिभाषित करें और लागू करें - सुरक्षा-संवेदनशील पैरामीटरों के डुप्लिकेट वाले अनुरोधों को अस्वीकार करें - ऐसे फ़्रेमवर्क का उपयोग करें जो डुप्लिकेट को सुसंगत तरीके से संभालते हैं ## Detection - Total rules: 2 - Languages: javascript, typescript, python ## Rules by Language ### Javascript (1 rules) - **HTTP Parameter Pollution Prevention in Express.js** [LOW]: Detects missing HTTP Parameter Pollution (HPP) protection in Express.js applications. - Remediation: Option 1 - Add hpp middleware (recommended): npm install hpp const hpp = require('hpp'); app.use(hpp()); Option 2 - Validate parameters manually: const value = Array.isArray(req.query.param) ? req.query.param[0] // Take first value : req.query.param; ### Typescript (1 rules) - **HTTP Parameter Pollution Prevention in Express.js** [LOW]: Detects missing HTTP Parameter Pollution (HPP) protection in Express.js applications. - Remediation: Option 1 - Add hpp middleware (recommended): npm install hpp const hpp = require('hpp'); app.use(hpp()); Option 2 - Validate parameters manually: const value = Array.isArray(req.query.param) ? req.query.param[0] // Take first value : req.query.param; ### Python (1 rules) - **HTTP Parameter Pollution** [MEDIUM]: Detects handling of duplicate HTTP parameters without proper validation. - Remediation: Check for duplicate parameters and reject requests with unexpected multiples. ```python if len(request.args.getlist('param')) > 1: return "Duplicate parameters not allowed", 400 ``` Learn more: https://shoulder.dev/learn/python/cwe-235/parameter-pollution