Skip to content

Security: Prevent loading of openssl.cnf#13118

Merged
phoerious merged 2 commits intodevelopfrom
fix/openssl-cnf
Mar 9, 2026
Merged

Security: Prevent loading of openssl.cnf#13118
phoerious merged 2 commits intodevelopfrom
fix/openssl-cnf

Conversation

@droidmonkey
Copy link
Copy Markdown
Member

@droidmonkey droidmonkey commented Mar 9, 2026

Prevent loading openssl.cnf from the originating vcpkg folder tree to avoid DLL injections. This patch force sets the OPENSSL_CONF env var to an invalid directory. This prevents openssl from attempting to load a cnf file which can contain settings to load arbitrary DLL files into KeePassXC memory space.

Thank you to @zdi-disclosures for reporting this finding!

Advisory: GHSA-4gr2-cr97-q9fx

Testing strategy

Confirmed through non-replication of exploit chain and via Procmon.

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

Prevent loading openssl.cnf from the originating vcpkg folder tree to avoid DLL injections. This patch force sets the OPENSSL_CONF env var to an invalid directory. This prevents openssl from attempting to load a cnf file which can contain settings to load arbitrary DLL files into KeePassXC memory space.

Thank you to zdi-disclosures for reporting this finding!
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens the Windows startup path by preventing OpenSSL from loading an openssl.cnf from a potentially user-writable vcpkg directory tree, reducing risk of config-driven DLL injection.

Changes:

  • On Windows, sets the OPENSSL_CONF environment variable early in main() to a deliberately invalid path so OpenSSL won’t load openssl.cnf.

You can also share your feedback on Copilot code review. Take the survey.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.60%. Comparing base (5652102) to head (028cdc0).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #13118      +/-   ##
===========================================
- Coverage    64.60%   64.60%   -0.00%     
===========================================
  Files          378      378              
  Lines        39903    39903              
===========================================
- Hits         25778    25777       -1     
- Misses       14125    14126       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

phoerious
phoerious previously approved these changes Mar 9, 2026
@phoerious phoerious dismissed their stale review March 9, 2026 09:13

I checked again. There's very little documentation about how this works. But I believe we also need to set OPENSSL_MODULES to prevent provider loading from <PREFIX>\ossl-modules. Why is this such a mess of barely documented hazards?

@droidmonkey
Copy link
Copy Markdown
Member Author

Concur, easy add

@phoerious phoerious added the pr:backport-pending Pull request to be backported label Mar 9, 2026
Copilot AI review requested due to automatic review settings March 9, 2026 22:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@phoerious phoerious mentioned this pull request Mar 9, 2026
20 tasks
@phoerious phoerious merged commit b7ad8b4 into develop Mar 9, 2026
10 checks passed
@phoerious phoerious deleted the fix/openssl-cnf branch March 9, 2026 22:42
phoerious pushed a commit that referenced this pull request Mar 9, 2026
* Security: Prevent loading of openssl.cnf

Prevent loading openssl.cnf from the originating vcpkg folder tree to avoid DLL injections. This patch force sets the OPENSSL_CONF and OPENSSL_MODULES env vars to an invalid directory. This prevents openssl from attempting to load a cnf file which can contain settings to load arbitrary DLL files into KeePassXC memory space.

Thank you to zdi-disclosures for reporting this finding!
@phoerious phoerious added pr: backported Pull request backported to previous release and removed pr:backport-pending Pull request to be backported labels Mar 9, 2026
phoerious pushed a commit that referenced this pull request Mar 10, 2026
* Security: Prevent loading of openssl.cnf

Prevent loading openssl.cnf from the originating vcpkg folder tree to avoid DLL injections. This patch force sets the OPENSSL_CONF and OPENSSL_MODULES env vars to an invalid directory. This prevents openssl from attempting to load a cnf file which can contain settings to load arbitrary DLL files into KeePassXC memory space.

Thank you to zdi-disclosures for reporting this finding!
pull bot pushed a commit to Andyworldclub/keepassxc that referenced this pull request Mar 10, 2026
* Security: Prevent loading of openssl.cnf

Prevent loading openssl.cnf from the originating vcpkg folder tree to avoid DLL injections. This patch force sets the OPENSSL_CONF and OPENSSL_MODULES env vars to an invalid directory. This prevents openssl from attempting to load a cnf file which can contain settings to load arbitrary DLL files into KeePassXC memory space.

Thank you to zdi-disclosures for reporting this finding!
pull bot pushed a commit to byxy77/keepassxc that referenced this pull request Mar 10, 2026
* Security: Prevent loading of openssl.cnf

Prevent loading openssl.cnf from the originating vcpkg folder tree to avoid DLL injections. This patch force sets the OPENSSL_CONF and OPENSSL_MODULES env vars to an invalid directory. This prevents openssl from attempting to load a cnf file which can contain settings to load arbitrary DLL files into KeePassXC memory space.

Thank you to zdi-disclosures for reporting this finding!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority 🚨 pr: backported Pull request backported to previous release security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants