Skip to content

🔒 Replace weak cryptographic functions for salt generation#24

Merged
flydev-fr merged 1 commit into
mainfrom
security-fix-weak-crypto-salts-1961918382625126282
May 4, 2026
Merged

🔒 Replace weak cryptographic functions for salt generation#24
flydev-fr merged 1 commit into
mainfrom
security-fix-weak-crypto-salts-1961918382625126282

Conversation

@flydev-fr

Copy link
Copy Markdown
Contributor

🎯 What: The vulnerability fixed is the use of weak cryptographic functions (md5, sha1, mt_rand) and predictable data (timestamp, filename) to generate security salts in src/Helpers/Installer.php.

⚠️ Risk: If left unfixed, the generated authSalt and tableSalt could 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

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.
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@flydev-fr
flydev-fr merged commit 7f639b4 into main May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant