# Improper Verification of Cryptographic Signature (CWE-347) The product does not verify, or incorrectly verifies, the cryptographic signature for data. **Stack:** Go - Prevalence: उच्च बार-बार शोषित - Impact: क्रिटिकल 1 क्रिटिकल गंभीरता वाले नियम - Prevention: प्रलेखित 4 फिक्स उदाहरण **OWASP:** Cryptographic Failures (A02:2021-Cryptographic Failures) - #2 ## Description Cryptographic signatures are used to verify the authenticity and integrity of data. When signature verification is missing or incorrectly implemented, attackers can forge or tamper with data. ## Prevention 1 Shoulder डिटेक्शन नियमों पर आधारित Improper Signature Verification के लिए रोकथाम रणनीतियाँ। ### Go Validate JWT algorithm explicitly, use strong secrets, and set expiration ## Warning Signs - [HIGH] JWT implementation has security weaknesses ## Consequences - सुरक्षा तंत्र को बायपास करना - अनधिकृत कोड निष्पादित करना - एप्लिकेशन डेटा संशोधित करना ## Mitigations - डेटा पर भरोसा करने से पहले हमेशा हस्ताक्षर सत्यापित करें - हस्ताक्षर सत्यापन के लिए अच्छी तरह से परीक्षण की गई क्रिप्टोग्राफ़िक लाइब्रेरीज़ का उपयोग करें - JWT के लिए हमेशा हस्ताक्षर सत्यापित करें और एल्गोरिदम मान्य करें ## Detection - Total rules: 4 - Critical: 1 - Languages: python, go, javascript, typescript ## Rules by Language ### Go (1 rules) - **JWT Security Vulnerabilities** [HIGH]: JWT allows "none" algorithm, uses weak secret, or lacks expiration. - Remediation: Validate algorithm explicitly and set token expiration. ```go token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { return nil, fmt.Errorf("unexpected method: %v", token.Header["alg"]) } return []byte(os.Getenv("JWT_SECRET")), nil }) ``` Learn more: https://shoulder.dev/learn/go/cwe-347/jwt-vulnerabilities