The vulnerability in jasypt-spring-boot stems from two insecure default configurations that weaken the password-based encryption mechanisms. The root cause is twofold:
-
Predictable Salt in AES/GCM Mode: The primary vulnerability lies in com.ulisesbocchio.jasyptspringboot.encryptor.SimpleGCMConfig.getSecretKeySaltGenerator. When a user follows the documentation for AES/GCM encryption with a master password but does not explicitly provide a salt, the library defaults to using a ZeroSaltGenerator. This results in a static, all-zero salt for the PBKDF2 key derivation function. Using a fixed, predictable salt across all installations means that the derived encryption key is solely dependent on the master password. This allows an attacker to pre-compute rainbow tables for common passwords and use them to attack any ciphertext generated by any application using this library with the default configuration. It also leads to key reuse across different deployments if they happen to use the same master password.
-
Insufficient Key Derivation Iterations: Both the GCM and PBE encryption modes are configured with a default of only 1000 iterations for the PBKDF2 key derivation function, as seen in StringEncryptorBuilder.createGCMDefault and StringEncryptorBuilder.createPBEDefault. This number is far below the current OWASP recommendation of 600,000 iterations for PBKDF2-HMAC-SHA256. A low iteration count drastically reduces the computational cost required to perform a brute-force or dictionary attack on the master password, making it feasible for an attacker with access to the ciphertext to recover the plaintext.
In summary, any application using jasypt-spring-boot for password-based encryption without overriding the default salt and iteration count configurations is at risk. An attacker who obtains the encrypted property values could potentially decrypt them through offline attacks due to these weak cryptographic defaults.