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

Business Logic Errors

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

Business Logic Errors

The product does not properly implement the business logic rules, which may allow users to manipulate the system in unintended ways.

Business logic errors occur when the application's implementation doesn't correctly enforce the intended business rules. Unlike technical vulnerabilities, these are flaws in the application's design or logic.

व्यापकता
मध्यम
3 भाषाएँ कवर की गईं
प्रभाव
उच्च
3 उच्च गंभीरता वाले नियम
रोकथाम
प्रलेखित
3 फिक्स उदाहरण
2 रोकथाम
2 रोकथाम

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

3 Shoulder डिटेक्शन नियमों पर आधारित Business Logic Errors के लिए रोकथाम रणनीतियाँ।

Business Logic Bypass HIGH

Calculate financial values server-side from trusted data sources instead of accepting client-submitted totals

+14 -1 go
  package main
  
  import (
      "net/http"
      "strconv"
  )
  
  func checkoutHandler(w http.ResponseWriter, r *http.Request) {
-     total, _ := strconv.ParseFloat(r.FormValue("total"), 64)
+     productID := r.FormValue("product_id")
+     qty, err := strconv.Atoi(r.FormValue("quantity"))
+     if err != nil || qty <= 0 {
+         http.Error(w, "Invalid quantity", http.StatusBadRequest)
+         return
+     }
+ 
+     var product Product
+     if err := db.First(&product, productID).Error; err != nil {
+         http.Error(w, "Product not found", http.StatusNotFound)
+         return
+     }
+ 
+     total := product.Price * float64(qty)
      processPayment(total)
      w.Write([]byte("Payment processed"))
  }
  
Business Logic Bypass HIGH

Calculate totals and prices server-side using database values instead of client-submitted data

+2 -1 javascript
  app.post('/checkout', async (req, res) => {
-   const { total } = req.body;
+   const product = await Product.findById(req.body.productId);
+   const total = product.price * req.body.quantity;
    await stripe.charges.create({ amount: total, currency: 'usd' });
  });
  
Business Logic Bypass HIGH

Calculate totals server-side using database prices instead of client-submitted values

+5 -3 python
  from flask import request
  
  @app.route('/checkout', methods=['POST'])
  def checkout():
-     price = float(request.form['price'])
-     quantity = int(request.form['quantity'])
-     stripe.Charge.create(amount=int(price * quantity * 100))
+     item_id = int(request.form['item_id'])
+     quantity = int(request.form['quantity'])
+     product = Product.query.get(item_id)
+     total = product.price * quantity
+     stripe.Charge.create(amount=int(total * 100))
  
3 पहचान
3 पहचान

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

Business Logic Errors पैटर्न के लिए अपने कोडबेस को स्कैन करने के लिए Shoulder का उपयोग करें। 3 नियम.

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

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

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

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

🟠
client-controlled prices or amounts flowing to payment operations without server-side validation javascript-business-logic-bypass
🟠
client-controlled business-critical values (price, quantity, discount) flowing to payment or busines python-business-logic-bypass
🔍

अपने कोडबेस को इसके लिए स्कैन करें: Business Logic Errors

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