BETA Shoulder ist in der Beta — Befunde können manchmal falsch sein. Dein Feedback bestimmt, was wir als Nächstes beheben. Feedback teilen

Improper Handling of Extra Parameters

🛡️ 2 Regeln erkennen dies

Improper Handling of Extra Parameters

The product does not handle or incorrectly handles when the number of parameters, fields, or arguments with the same name exceeds the expected amount.

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.

Verbreitung
Mittel
2 Sprachen abgedeckt
Auswirkung
Mittel
Review empfohlen
Prävention
Dokumentiert
2 Fix-Beispiele
2 Prävention
2 Prävention

So behebst du diese Schwachstelle

Präventionsstrategien für Improper Handling of Extra Parameters basierend auf 2 Shoulder-Erkennungsregeln.

HTTP Parameter Pollution Prevention in Express.js LOW

Add hpp middleware to normalize duplicate query parameters

+3 -0 javascript
+ const hpp = require('hpp');
+ app.use(hpp());
+ 
  app.get('/search', (req, res) => {
    const role = req.query.role;
    if (role === 'admin') {
      res.json({ admin: true });
    }
  });
  
HTTP Parameter Pollution MEDIUM

Explicitly check for and reject duplicate HTTP parameters

+8 -7 python
- from flask import request
- 
- @app.route('/api/action')
- def action():
-     user_id = request.args.get('id')
-     # Attacker sends: ?id=1&id=admin
-     # Only gets first value, but backend proxy may use last
+ from flask import request, jsonify
+ 
+ @app.route('/api/action')
+ def action():
+     all_ids = request.args.getlist('id')
+     if len(all_ids) != 1:
+         return jsonify({'error': 'Duplicate parameters not allowed'}), 400
+     user_id = all_ids[0]
      perform_action(user_id)
  
3 Erkennung
3 Erkennung

Finden Sie Schwachstellen in Ihrem Code

Verwenden Sie Shoulder, um Ihren Code nach Improper Handling of Extra Parameters-Mustern zu scannen. 2 Regeln.

Terminal
# Scan with Shoulder CLI
npx @shoulderdev/cli trust --cwe=235

# Or scan entire project
npx @shoulderdev/cli trust .
4 Warnzeichen
4 Warnzeichen

Worauf bei Code-Reviews zu achten ist

Diese Muster weisen auf potenzielle Improper Handling of Extra Parameters-Schwachstellen hin. Achten Sie bei Code-Reviews und Sicherheitsaudits darauf.

🟡
handling of duplicate HTTP parameters without proper validation python-parameter-pollution
🔵
Request parameters used without HPP protection. Express converts duplicate query/body params to arrays, which can bypass javascript-express-hpp-prevention
🔵
missing HTTP Parameter Pollution (HPP) protection in Express javascript-express-hpp-prevention
🔍

Scanne deine Codebasis nach Improper Handling of Extra Parameters

Shoulder CLI findet anfällige Muster in deiner gesamten Codebasis.