# 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