Skip to content
vetkitChecksChangelogDocumentation

vetkit.php.auth.strcmp-loose-comparison

strcmp() on request input is checked with == 0 / !strcmp(). On PHP < 8 an array input makes strcmp() return NULL, which loosely equals 0 and bypasses the check.

Last updated:

Suite: Security

php

strcmp() on request input is checked with == 0 / !strcmp(). On PHP < 8 an array input makes strcmp() return NULL, which loosely equals 0 and bypasses the check.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Use hash_equals() for secrets (or === with is_string() checks) instead of strcmp() == 0.

References

Source: packages/engine/rules/sast/php.yml.

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.