ECB Mode (ARCH7113)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key php.security.ecb-mode · Severity error · Category security · CWE CWE-327
ECB mode maps identical plaintext blocks to identical ciphertext, so it leaks plaintext patterns and is never IND-CPA secure.
Incorrect
Section titled “Incorrect”<?php$cipher = openssl_encrypt($plaintext, 'aes-256-ecb', $key, OPENSSL_RAW_DATA);Correct
Section titled “Correct”<?php$iv = random_bytes(12);$cipher = openssl_encrypt($plaintext, 'aes-256-gcm', $key, OPENSSL_RAW_DATA, $iv, $tag);Replace ECB with an authenticated mode (AES-GCM) that uses a fresh random IV/nonce per encryption.