Go timing attack: MAC compared with == or bytes.Equal
Rule ID: vetkit.go.crypto.timing-unsafe-compare
A MAC or signature is compared with == / bytes.Equal, which returns as soon as a byte differs. Response-time differences let a client guess the value byte by byte.
Last updated:
Suite: Security
go
A MAC or signature is compared with == / bytes.Equal, which returns as soon as a byte differs. Response-time differences let a client guess the value byte by byte.
Category: SECURITY · Engine rule severity: WARNING
How to fix it
Compare with hmac.Equal (or crypto/subtle.ConstantTimeCompare), which takes the same time regardless of where the inputs differ.
References
Source: packages/engine/rules/sast/go.yml.
Related checks
Check your own repository for this
vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.
Start with the free Security Quick Scan · See how the platform works
Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.