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.
この脆弱性の修正方法
2 件の Shoulder 検出ルールに基づく Improper Handling of Extra Parameters の予防策。
Add hpp middleware to normalize duplicate query parameters
+ const hpp = require('hpp'); + app.use(hpp()); + app.get('/search', (req, res) => { const role = req.query.role; if (role === 'admin') { res.json({ admin: true }); } });
Explicitly check for and reject duplicate HTTP parameters
- 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)
コードの脆弱性を見つける
Shoulderを使用してコードのImproper Handling of Extra Parametersパターンをスキャンしましょう。 2 ルール.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=235 # Or scan entire project npx @shoulderdev/cli trust .
検出ルール (2)
コードレビューで注目すべき点
これらのパターンはImproper Handling of Extra Parametersの潜在的な脆弱性を示しています。コードレビューとセキュリティ監査中に探してください。
コードベースをスキャン: Improper Handling of Extra Parameters
Shoulder CLI はコードベース全体から脆弱なパターンを見つけます。