Padding Oracle encryption vulnerability detected.
- Rule ID: java_lang_padding_oracle_encryption_vulnerability
- Languages: java
- Source: padding_oracle_encryption_vulnerability.yml
Description
Using a block cipher algorithm mode, such as CBC, together with a padding scheme is vulnerable to Padding Oracle attacks.
Remediations
❌ Do not use CBC (Cipher Block Chaining) mode with padding
Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding");
✅ Prefer GCM (Galois/Counter Mode) instead
Cipher c = Cipher.getInstance("AES/GCM/PKCS5Padding");
Resources
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=java_lang_padding_oracle_encryption_vulnerability
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=java_lang_padding_oracle_encryption_vulnerability
Ready to take the next step? Learn more about Bearer Cloud.