High severityC#Authentication & SecretsHIGH confidence
Hardcoded JWT Signing Key
A JWT/HMAC signing key is built from a hard-coded literal secret (CWE-321).
Standards mapping
- OWASP Top 10
- A02:2021 - Cryptographic Failures
- OWASP ASVS
- V6.4.1 (L2)
Vulnerable vs. safe
Flagged by this check
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("hardcoded-signing-key-000001"));Passes - the safe pattern
var key = new SymmetricSecurityKey(material);Why it matters & how to fix it
A JWT/HMAC signing key is built from a hard-coded literal secret (CWE-321). Anyone with source access can forge valid tokens, and the key cannot be rotated without a redeploy. Load the signing key from a secrets manager/Key Vault at startup and rotate any value that was committed.
References
Rule ID integsec.csharp.auth.hardcoded-jwt-signing-key - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Authentication & SecretsHardcoded JWT Secret
- JavaScript / TypeScript - Authentication & SecretsHardcoded Secret
- JavaScript / TypeScript - Authentication & SecretsInsecure Cookie Flags
- JavaScript / TypeScript - Authentication & SecretsJWT Algorithm None
- JavaScript / TypeScript - Authentication & SecretsJWT Decode Without Verify
- JavaScript / TypeScript - Authentication & SecretsTLS Verification Disabled