Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 1.5
-
Component/s: None
-
Labels:None
Description
It appears that CryptoUtil will gladly accept any Base64-encoded value, decode it, decrypt with a Cipher and return the bytes as a String. This allows Stripes to end up using garbage input, which might cause trouble. When decrypting, CryptoUtil should take measures to ensure it is dealing with values that were encrypted with the same session key.
A magic number is prefixed to the result before encryption and checked for upon decryption. In testing this, I also found that most of the time when a bogus value is fed in to decrypt it results in a BadPaddingException so I added a try/catch to catch that and IllegalBlockSizeException. Those cases plus the case of a bogus input that happens to decrypt properly are logged as a warning and null is returned.