Why it matters
Its defaults are unsafe and it receives no fixes.
How to fix it
Move to libsodium (sodium_crypto_secretbox) or openssl_encrypt with 'aes-256-gcm'.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
<?php
$ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_CBC, $iv);<?php
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
$ciphertext = sodium_crypto_secretbox($plaintext, $nonce, $key);What TrustIvan reads
Runs on repository scans of PHP source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Weak cipher (PHP)
PHPSeverity: High
trustivan-php-weak-cipher - TLS verification disabled (PHP)
PHPSeverity: High
trustivan-php-tls-verification-disabled - Insecure random secret (PHP)
PHPSeverity: Medium
trustivan-php-insecure-random-secret - Unserialize without allowed classes (PHP)
PHPSeverity: Medium
trustivan-php-unserialize-without-allowed-classes - Weak password hash (PHP)
PHPSeverity: High
trustivan-php-weak-password-hash - XXE libxml NOENT (PHP)
PHPSeverity: High
trustivan-php-xxe-libxml-noent
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation