Data is encrypted with a broken cipher or in ECB mode

tx0/php:weak-cipherdefaulterrorsecurity/cryptodepth fastsecurity, cwe-327

What it finds

openssl_encrypt($data, 'des-ede3-cbc', $key) or 'aes-128-ecb': DES, triple DES, RC2, RC4 and Blowfish are broken or too small, and ECB mode encrypts equal blocks to equal output, which shows the structure of the data. Use an authenticated mode such as AES-GCM.

From the rule's source, weak_cipher.rs.

Example from the rule's tests
<?phpfunction seal($data, $key, $iv){    $a = openssl_encrypt($data, 'des-ede3-cbc', $key, 0, $iv);tx0 reports: the cipher des-ede3-cbc is weak    $b = openssl_encrypt($data, 'aes-128-ecb', $key);tx0 reports: the cipher aes-128-ecb is weak    $c = openssl_encrypt($data, 'aes-256-gcm', $key, 0, $iv, $tag);    return [$a, $b, $c];}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/php:weak-cipher" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/php:weak-cipher] reason="..."

tx0 explain tx0/php:weak-cipher shows the same in the terminal. Found a false positive? Report it.