Security: Prevent loading of openssl.cnf#13118
Conversation
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!
There was a problem hiding this comment.
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_CONFenvironment variable early inmain()to a deliberately invalid path so OpenSSL won’t loadopenssl.cnf.
You can also share your feedback on Copilot code review. Take the survey.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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?
|
Concur, easy add |
2019185 to
028cdc0
Compare
* 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!
* 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!
* 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!
* 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!
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