बीटा Shoulder बीटा में है — परिणाम कभी-कभी गलत हो सकते हैं। आपकी प्रतिक्रिया तय करती है कि हम आगे क्या ठीक करें। प्रतिक्रिया साझा करें
🔐

Improper Authentication

🛡️ 2 नियम इसे पहचानते हैं

Improper Authentication

When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.

Authentication is the process of determining if a claimed identity is correct. When authentication is insufficient or incorrect, attackers can assume the identity of legitimate users.

व्यापकता
उच्च
बार-बार शोषित
प्रभाव
क्रिटिकल
2 क्रिटिकल गंभीरता वाले नियम
रोकथाम
प्रलेखित
2 फिक्स उदाहरण
2 रोकथाम
2 रोकथाम

इस भेद्यता को कैसे ठीक करें

2 Shoulder डिटेक्शन नियमों पर आधारित Improper Authentication के लिए रोकथाम रणनीतियाँ।

JWT Decode Used for User Identity (Authentication Bypass) CRITICAL

Use jwt.verify() instead of jwt.decode() when assigning user identity

+3 -1 javascript
- const decoded = jwt.decode(token);
+ const decoded = jwt.verify(token, process.env.JWT_SECRET, {
+   algorithms: ['HS256']
+ });
  req.user = decoded;
  
Authentication Bypass Vulnerability CRITICAL

Use early returns for authentication failures and constant-time comparison

+8 -7 python
  from flask import request, jsonify
- 
- @app.route('/login', methods=['POST'])
- def login():
-     user = User.query.filter_by(username=request.json['username']).first()
-     if user and user.password == request.json['password']:
-         return jsonify({'token': generate_token(user)})
-     return jsonify({'error': 'Invalid'}), 401
+ from werkzeug.security import check_password_hash
+ 
+ @app.route('/login', methods=['POST'])
+ def login():
+     user = User.query.filter_by(username=request.json['username']).first()
+     if not user or not check_password_hash(user.password_hash, request.json['password']):
+         return jsonify({'error': 'Invalid credentials'}), 401
+     return jsonify({'token': generate_token(user)})
  
3 पहचान
3 पहचान

अपने कोड में भेद्यताएँ खोजें

Improper Authentication पैटर्न के लिए अपने कोडबेस को स्कैन करने के लिए Shoulder का उपयोग करें। 2 नियम.

टर्मिनल
# Scan with Shoulder CLI
npx @shoulderdev/cli trust --cwe=287

# Or scan entire project
npx @shoulderdev/cli trust .
4 चेतावनी संकेत
4 चेतावनी संकेत

कोड समीक्षा में किन बातों पर ध्यान दें

ये पैटर्न संभावित Improper Authentication भेद्यताओं का संकेत देते हैं। कोड समीक्षा और सुरक्षा ऑडिट के दौरान इन्हें देखें।

🔴
authentication checks that can be bypassed due to missing return statements or weak boolean logic python-authentication-bypass
🔍

अपने कोडबेस को इसके लिए स्कैन करें: Improper Authentication

Shoulder CLI आपके पूरे कोडबेस में भेद्य पैटर्न खोजता है।