Usage of weak hashing library (CRC32)

Description

The use of CRC32 for hashing is insecure. CRC32 is designed for error-checking and not for security purposes, making it vulnerable to intentional data tampering.

Remediations

  • Do not use CRC32 for hashing when security is a concern. It is not secure against intentional data modifications.
    $myhash = crc32($input); // unsafe
  • Do opt for stronger hashing algorithms like SHA-256 to ensure data integrity and security.
    $myhash = hash('sha256', $input);

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=php_lang_weak_hash_crc32

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=php_lang_weak_hash_crc32