🔒 Replace weak cryptographic functions for salt generation#24
Conversation
Replaced the use of `md5`, `sha1`, and `mt_rand` for salt generation in the installer with cryptographically secure `random_bytes()`. Since PHP 8.1 is required, the fallback logic for older PHP versions was removed. Unused variables that were previously used for entropy collection were also removed.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: The vulnerability fixed is the use of weak cryptographic functions (
md5,sha1,mt_rand) and predictable data (timestamp, filename) to generate security salts insrc/Helpers/Installer.php.authSaltandtableSaltcould potentially be predicted or brute-forced, compromising the security of user authentication and other hashed data in the ProcessWire installation.🛡️ Solution: The fix replaces the insecure generation logic with
bin2hex(random_bytes(20)), which uses a cryptographically secure pseudo-random number generator (CSPRNG) to produce 40-character random hex strings. This ensures high entropy and unpredictability for the salts. Unneeded fallbacks and predictable entropy sources were removed.PR created automatically by Jules for task 1961918382625126282 started by @flydev-fr