You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fail closed when a KeyStore or TrustStore element of Ssl cannot be loaded #4332
bugIncorrect, unexpected, or unintended behavior of existing codeconfigurationAffects the configuration system in a general waypriority: P2Confirmed bug without event loss, hang, crash or leak
When a TrustStore (or KeyStore) element of Ssl cannot be loaded, for example because the file is missing or the password is wrong, TrustStoreConfiguration#createKeyStoreConfiguration throws StoreConfigurationException, PluginBuilder logs an error and returns null for the element, and SslConfiguration#createSSLConfiguration receives null exactly as if the element had been absent. The SSLContext is then initialized with null trust managers, i.e. the JVM default trust store. Independently, SslConfiguration#createSslContext catches any initialization error and falls back to SSLContext.getDefault().
This is not a vulnerability: the configuration is trusted input under the threat model and the failure is reported at ERROR level by the status logger. It is, however, a fail-open behavior for a security-relevant element: a deployer who restricted trust to a private CA ends up with the default trust store after a password rotation or a missing volume mount. This issue originates from a private security report classified as hardening.
Proposal: when a KeyStore or TrustStore child element is present but invalid, the Ssl element should fail to build and the enclosing appender should fail to start. One way is to let the store factories return a configuration object that records the failure instead of throwing, and have SslConfiguration reject it; the default-context fallback in createSslContext should also be removed. This fits the TLS configuration rework tracked in #2792 and #3902.
The property-based configuration has the same fail-open behavior, with less noise:
in SslConfigurationFactory.createSslConfiguration, a failure to create the trust store (or key store) configuration from log4j2.trustStore* / log4j2.keyStore* is caught and only logged at WARN
("Unable to create trust store configuration due to: …").
The factory then continues without it and, if neither store could be created, returns null,
so HTTPS configuration sources silently use the JVM defaults.
It would make sense to fail closed there too, consistently with the <Ssl> element.
bugIncorrect, unexpected, or unintended behavior of existing codeconfigurationAffects the configuration system in a general waypriority: P2Confirmed bug without event loss, hang, crash or leak
Activity
ppkarwasz commentedon Sep 25, 2026
The property-based configuration has the same fail-open behavior, with less noise:
in
SslConfigurationFactory.createSslConfiguration, a failure to create the trust store (or key store) configuration fromlog4j2.trustStore*/log4j2.keyStore*is caught and only logged atWARN("Unable to create trust store configuration due to: …").
The factory then continues without it and, if neither store could be created, returns
null,so HTTPS configuration sources silently use the JVM defaults.
It would make sense to fail closed there too, consistently with the
<Ssl>element.