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

Inclusion of Functionality from Untrusted Control Sphere

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

Inclusion of Functionality from Untrusted Control Sphere

The product imports, requires, or includes executable functionality from a source that is outside of the intended control sphere.

When software includes functionality from untrusted sources (such as third-party scripts, external modules, or code from untrusted URLs), attackers can inject malicious code that will be executed with the same privileges as the application.

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

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

4 Shoulder डिटेक्शन नियमों पर आधारित Inclusion of Untrusted Functionality के लिए रोकथाम रणनीतियाँ।

LLM Supply Chain Vulnerabilities HIGH

Use an allowlist for permitted models, verify integrity with checksums, and load models over HTTPS only

+17 -4 go
- func handler(w http.ResponseWriter, r *http.Request) {
-     modelPath := r.FormValue("model")
-     model, _ := loadModel(modelPath)
-     resp, _ := http.Get("http://example.com/model.onnx")
+ var allowedModels = map[string]string{
+     "sentiment": "https://models.example.com/sentiment-v2.onnx",
+     "classify":  "https://models.example.com/classify-v1.onnx",
+ }
+ 
+ func handler(w http.ResponseWriter, r *http.Request) {
+     modelID := r.FormValue("model")
+     url, ok := allowedModels[modelID]
+     if !ok {
+         http.Error(w, "invalid model", http.StatusBadRequest)
+         return
+     }
+     data, _ := downloadModel(url)
+     if !verifyChecksum(data, expectedChecksums[modelID]) {
+         return fmt.Errorf("checksum verification failed")
+     }
+     model, _ := loadModel(data)
  }
  
LLM Supply Chain Vulnerabilities HIGH

Use allowlists for permitted models and verify integrity with checksums

+7 -2 javascript
- app.post('/predict', async (req, res) => {
-   const model = await loadModel(req.body.modelId);
+ const ALLOWED_MODELS = { 'sentiment-v1': true, 'classify-v2': true };
+ 
+ app.post('/predict', async (req, res) => {
+   if (!ALLOWED_MODELS[req.body.modelId]) {
+     return res.status(400).json({ error: 'Model not allowed' });
+   }
+   const model = await loadVerifiedModel(req.body.modelId);
    const result = await model.predict(req.body.input);
  });
  
Container Using Latest Tag MEDIUM

Pin container images to specific version tags or SHA digests for reproducible deployments

+1 -1 yaml
  apiVersion: v1
  kind: Pod
  spec:
    containers:
    - name: app
-     image: nginx:latest
+     image: nginx:1.25.3-alpine
  
LLM Supply Chain Vulnerabilities HIGH

Use weights_only=True with torch.load, avoid trust_remote_code=True, and maintain a model allowlist

+14 -3 python
  import torch
  from transformers import AutoModel
- 
- model = torch.load('model.pt')
- nlp_model = AutoModel.from_pretrained('custom/model', trust_remote_code=True)
+ from safetensors.torch import load_model
+ 
+ # Safe: weights_only prevents arbitrary code execution
+ model = torch.load('model.pt', weights_only=True)
+ 
+ # Even safer: use SafeTensors format
+ load_model(model, 'model.safetensors')
+ 
+ # Allowlist for HuggingFace models
+ ALLOWED_MODELS = ['bert-base-uncased', 'distilbert-base-uncased']
+ model_id = request.json['model']
+ if model_id not in ALLOWED_MODELS:
+     raise ValueError('Model not in allowlist')
+ nlp_model = AutoModel.from_pretrained(model_id)
  
3 पहचान
3 पहचान

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

Inclusion of Functionality from Untrusted Control Sphere पैटर्न के लिए अपने कोडबेस को स्कैन करने के लिए Shoulder का उपयोग करें। 4 नियम.

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

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

पहचान नियम (4)

4 चेतावनी संकेत
4 चेतावनी संकेत

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

ये पैटर्न संभावित Inclusion of Functionality from Untrusted Control Sphere भेद्यताओं का संकेत देते हैं। कोड समीक्षा और सुरक्षा ऑडिट के दौरान इन्हें देखें।

🟠
Potential supply chain vulnerability: ... go-llm-supply-chain
🟠
supply chain vulnerabilities in AI/LLM implementations such as untrusted model sources or dynamic mo go-llm-supply-chain
🟠
potential supply chain vulnerabilities in AI/LLM implementations javascript-llm-supply-chain
🟡
Container image uses 'latest' tag or no tag. kubernetes-image-latest-tag
🟡
container images using 'latest' tag or no tag kubernetes-image-latest-tag
🔍

अपने कोडबेस को इसके लिए स्कैन करें: Inclusion of Functionality from Untrusted Control Sphere

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