I used an open-source programming language called Lucee / Cfscript that is closely related to Adobe Coldfusion. The default function that developers use to encrypt and decrypt data (usually for passwords or cookie contents etc) is meant to be compatible with a version of Coldfusion that released in 2002. Given that the algorithm appears to be custom, and not really peer reviewed, and over 20 years old, I'm trying to figure out if it's still safe to use or if legacy code should be updated.
There are a few red flags in the code as far as I can tell.
- If the key length is 0, it uses a default key "Default Seed".
- It allows passing in an empty string or null value for the key. This could happen accidentally I'm guessing.
- If the key is null, you can then decrypt it using an empty string. You can click run on this code to see what I mean. https://trycf.com/gist/06c56b6ec5f95450e32347abc78605aa/lucee5?theme=monokai
- There is no salt (by default), and iterations is set to 0 (by default).
I don't know enough about encryption to know if my intuition is correct and those are actual red flags. The same logic is used to encrypt and decrypt. The algorithm appears really simple. From limited research, the algorithm implements a form of symmetric key encryption using a series of Linear Feedback Shift Registers. The relevant java code is here: https://github.com/lucee/Lucee/blob/8b37274cf040980f1e179d7604fe9afa088ce21f/core/src/main/java/lucee/runtime/crypt/CFMXCompat.java
It's essentially just three functions, setKey, transformString which calls transformByte over and over.
Is this default encryption still safe to use for storing passwords or basic cookie data or should they be migrated to something else? I'm a software developer not a cryptographer so if the tags on this are inaccurate or anything is missing, please let me know and I'll update. Thanks.