-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The wrapper extends the type that promises hostname verification, and discards the parameter that carries the hostname\n\nThe 2016 wrapper file is 73 lines of Java in `handler/src/main/java/io/netty/handler/ssl/util/X509TrustManagerWrapper.java`. The patch for CVE-2026-50010 deletes it. Reproduced verbatim from the pre-patch source at tag `netty-4.2.14.Final`:\n\n```java\nfinal class X509TrustManagerWrapper extends X509ExtendedTrustManager {\n\n private final X509TrustManager delegate;\n\n X509TrustManagerWrapper(X509TrustManager delegate) {\n this.delegate = checkNotNull(delegate, \"delegate\");\n }\n\n @Override\n public void checkServerTrusted(X509Certificate[] chain, String s) throws CertificateException {\n delegate.checkServerTrusted(chain, s);\n }\n\n @Override\n public void checkServerTrusted(X509Certificate[] chain, String s, Socket socket)\n throws CertificateException {\n delegate.checkServerTrusted(chain, s);\n }\n\n @Override\n public void checkServerTrusted(X509Certificate[] chain, String s, SSLEngine sslEngine)\n throws CertificateException {\n delegate.checkServerTrusted(chain, s);\n }\n // checkClientTrusted overloads identical in shape\n}\n```\n\n`X509ExtendedTrustManager` is the abstract class the JDK added in Java 7 to carry hostname-verification context into the trust manager's check methods. The 3-argument overloads receive a `Socket` or an `SSLEngine`, and the implementation is supposed to read the SSLSession's peer host off that argument and run the endpoint identification check. `X509TrustManager` is the Java 1.4 interface that predates hostname verification entirely: 2-argument methods, no transport context, no opinion about hostnames.\n\nThe wrapper extends the new class and implements every 3-argument method by calling the 2-argument variant on the wrapped delegate. The `SSLEngine` parameter is read once, to be discarded.\n\nThe factory that installed it lived one file over, in `SimpleTrustManagerFactory`:\n\n```java\n@Override\nprotected TrustManager[] engineGetTrustManagers() {\n TrustManager[] trustManagers = this.trustManagers;\n if (trustManagers == null) {\n trustManagers = parent.engineGetTrustManagers();\n wrapIfNeeded(trustManagers);\n this.trustManagers = trustManagers;\n }\n return trustManagers.clone();\n}\n\nprivate static void wrapIfNeeded(TrustManager[] trustManagers) {\n for (int i = 0; i < trustManagers.length; i++) {\n final TrustManager tm = trustManagers[i];\n if (tm instanceof X509TrustManager && !(tm instanceof X509ExtendedTrustManager)) {\n trustManagers[i] = new X509TrustManagerWrapper((X509TrustManager) tm);\n }\n }\n}\n```\n\n`SimpleTrustManagerFactory` is the framework base class for every custom trust manager factory in the Netty ecosystem. It is what an application supplies when it loads certs from a non-default location, uses a system trust store with a constraint, composes a verification policy on top of the system roots, or wires any non-default trust to the SSL context. The factory walks the trust managers the application returned from its `engineGetTrustManagers` and wraps every plain `X509TrustManager` into one that already looks like an `X509ExtendedTrustManager` to the JDK.\n\nThe JDK's reason for caring about that distinction is in `sun.security.ssl.SSLContextImpl.init`. The JDK calls `instanceof X509ExtendedTrustManager` on each trust manager it receives. If the answer is no, the JDK wraps the plain trust manager in its own internal `AbstractTrustManagerWrapper`, which delegates the certificate chain validation to the wrapped manager and adds the endpoint identification check on top, reading the hostname from the `SSLEngine` the runtime passes. The wrap is silent: no log, no warning, no exception. The application gets hostname verification for free.\n\nNetty's wrapper passes the JDK's `instanceof` check. The JDK skips its own wrapping. Hostname verification is gone.\n\n## The wrap defeated the JDK's silent adapter on purpose, for the wrong population\n\nTrustin Lee committed the wrapper at `bcea25cc` on October 12, 2016. The commit message names exactly what it does:\n\n> Motivation:\n>\n> Since Java 7, X509TrustManager implementation is wrapped by a JDK class called AbstractTrustManagerWrapper, which performs an additional certificate validation for Socket or SSLEngine-backed connections.\n>\n> This makes the TrustManager implementations provided by InsecureTrustManagerFactory and FingerprintTrustManagerFactory not insecure enough, where their certificate validation fails even when it should pass.\n>\n> Modifications:\n>\n> - Add X509TrustManagerWrapper which adapts an X509TrustManager into an X509ExtendedTrustManager\n> - Make SimpleTrustManagerFactory wrap an X509TrustManager with X509TrustManagerWrapper is the provided TrustManager does not extend X509ExtendedTrustManager\n>\n> Result:\n>\n> - InsecureTrustManagerFactory and FingerprintTrustManagerFactory are now insecure as expected.\n> - Fixes #5910\n\nTwo trust managers Netty shipped had a problem with the JDK's silent hostname check:\n\n- `InsecureTrustManagerFactory` accepts every certificate by design. It exists for development, testing, and the operator who knows they are talking to a peer with a self-signed cert whose name does not match the connect target. With the JDK silently adding hostname verification, the factory enforced the hostname even when the operator had asked for nothing to be enforced. The factory was named `Insecure` and behaved as `insecure plus hostname-strict`.\n\n- `FingerprintTrustManagerFactory` accepts every certificate whose fingerprint matches a pinned value. The pinning is the trust decision: if the leaf's SHA matches what was pinned, the cert is trusted regardless of CA chain or hostname. With the JDK silently adding hostname verification, the fingerprint match was followed by a hostname check that the pinned cert would often fail.\n\nThe two factories share a parent: `SimpleTrustManagerFactory`. The fix Trustin Lee chose was to wrap at the parent. Every plain `X509TrustManager` returned by any subclass would be converted into an `X509ExtendedTrustManager` the JDK trusted to handle hostname verification itself. The wrapper handled hostname verification by skipping it.\n\nThe two factories that needed the JDK's silent wrap defeated were the two named in the commit message. The factory base class through which the defeat was applied is the parent of:\n\n- `InsecureTrustManagerFactory` (target of the fix)\n- `FingerprintTrustManagerFactory` (target of the fix)\n- Every other custom trust manager factory anyone has ever written on top of Netty, including the ones that load CA bundles from operator-supplied paths, the ones that wrap the system trust store with certificate-transparency constraints, the ones that implement custom revocation logic\n\nFor nine years and seven months, every customer of `SimpleTrustManagerFactory` got the `InsecureTrustManagerFactory` treatment.\n\n## Netty 4.2 made the bug discoverable\n\nThe 4.2 client default for `endpointIdentificationAlgorithm` lives in `SslContext.java`:\n\n```java\nprivate static final String DEFAULT_ENDPOINT_VERIFICATION_ALGORITHM_PROPERTY =\n \"io.netty.handler.ssl.defaultEndpointVerificationAlgorithm\";\n\n/**\n * Endpoint verification is enabled by default from Netty 4.2 onward, but it wasn't in Netty 4.1 and earlier.\n * ...\n */\nprotected static final String defaultEndpointVerificationAlgorithm;\n\nstatic {\n String defaultEndpointVerification = SystemPropertyUtil.get(DEFAULT_ENDPOINT_VERIFICATION_ALGORITHM_PROPERTY);\n if (\"LDAP\".equalsIgnoreCase(defaultEndpointVerification)) {\n defaultEndpointVerificationAlgorithm = \"LDAP\";\n } else if (\"NONE\".equalsIgnoreCase(defaultEndpointVerification)) {\n logger.info(\"Default SSL endpoint verification has been disabled: -D{}=\\\"{}\\\"\",\n DEFAULT_ENDPOINT_VERIFICATION_ALGORITHM_PROPERTY, defaultEndpointVerification);\n defaultEndpointVerificationAlgorithm = null;\n } else {\n if (defaultEndpointVerification != null && !\"HTTPS\".equalsIgnoreCase(defaultEndpointVerification)) {\n logger.warn(\"Unknown default SSL endpoint verification algorithm: -D{}=\\\"{}\\\", \" +\n \"will use \\\"HTTPS\\\" instead.\",\n DEFAULT_ENDPOINT_VERIFICATION_ALGORITHM_PROPERTY, defaultEndpointVerification);\n }\n defaultEndpointVerificationAlgorithm = \"HTTPS\";\n }\n}\n```\n\nTwo lines below, `SslContextBuilder`'s client constructor copies the resolved default onto the builder's instance field:\n\n```java\nprivate SslContextBuilder(boolean forServer) {\n this.forServer = forServer;\n if (!forServer) {\n endpointIdentificationAlgorithm = SslContext.defaultEndpointVerificationAlgorithm;\n }\n serverNames = forServer ? null : new ArrayList<>(2);\n}\n```\n\nThe Netty 4.2 release was the security upgrade most consumers were waiting for. The 4.1 default of null meant client connections accepted any valid cert chain from any server until the application remembered to call `endpointIdentificationAlgorithm(\"HTTPS\")` on the builder. The 4.2 default of `\"HTTPS\"` flipped it: clients verify hostnames by default, and the operator who wants the 4.1 behavior has to set a JVM property whose name contains the word `Default` and pass it the string `\"NONE\"`. Operators upgrading from 4.1 to 4.2 read the change in the release notes and got the upgrade they had been promised, except not for any application that had ever extended `SimpleTrustManagerFactory`.\n\nThe CVE-2026-50010 record's affected range names both branches: `>= 4.2.0.Final < 4.2.15.Final` and `<= 4.1.134.Final`. The 4.1 row affects the operator who explicitly opted into hostname verification on the builder. The 4.2 row affects the operator who did nothing.\n\n## The fix is two parts in one commit, both load-bearing\n\nThe June 1, 2026 patch (commit `3a023c0`) deletes the wrapper class and removes the `wrapIfNeeded` loop. It also adds a 25-line block inside `InsecureTrustManagerFactory` that makes that factory's own trust manager extend `X509ExtendedTrustManager` directly:\n\n```java\n// This needs to be X509ExtendedTrustManager so hostname verification is skipped as well.\n// Otherwise the JDK will internally wrap it with AbstractTrustManagerWrapper and add hostname verification\n// by itself.\nprivate static final TrustManager tm = new X509ExtendedTrustManager() {\n @Override\n public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) {\n checkServerTrusted(chain, authType);\n }\n // ... five other methods, same shape\n```\n\nThe comment above the block is the 2016 motivation, restated nine years later. The maintainers always knew what the JDK does. The fix moves the JDK-bypass behavior to the place that needs it (the insecure factory's own trust manager, scoped to that one trust manager) and removes it from the place where it never should have lived (the shared base class for every custom factory).\n\nThe new `SimpleTrustManagerFactoryTest` declares the new contract by assertion:\n\n```java\nTrustManager[] tms = factory.getTrustManagers();\nassertEquals(1, tms.length);\nassertSame(tm, tms[0]);\n```\n\nA trust manager passed in is returned unchanged. The factory no longer transforms its callers' trust managers. Whatever the application supplied, the JDK sees, and the JDK adds the silent hostname-verification wrapper to plain `X509TrustManager` instances as it has done since Java 7.\n\nThe fix's first half restores the security property the framework's hero documentation had been advertising. The fix's second half preserves the insecurity that one named factory always meant to provide. Both are necessary because the original 2016 fix had scoped its workaround to the wrong layer.\n\n## The setting was advisory at the layer below the operator\n\nThis is `setting-was-advisory` expressed at the trust-manager layer rather than the configuration-flag layer. Netty's `endpointIdentificationAlgorithm(\"HTTPS\")` is the `SSLParameters` knob the JDK reads to decide whether to invoke the 3-argument `checkServerTrusted` and pass an `SSLEngine` carrying the peer hostname. The flag reached the `SSLEngine` correctly. The `SSLEngine` invoked `checkServerTrusted(chain, authType, sslEngine)` on the trust manager correctly. The trust manager was Netty's wrapper. The wrapper called `delegate.checkServerTrusted(chain, authType)`, the 2-argument variant on the user's plain `X509TrustManager`, which by interface contract does not check hostnames. The `SSLEngine` was discarded one method call before its argument would have mattered.\n\nThe catalog has named this shape via SGLang's `trust_remote_code=False` ([SGLang Treated trust_remote_code=False As a Suggestion](/posts/sglang-trust-remote-code-was-a-suggestion)) and vm2's `require: false` ([vm2 3.11.1 Rejects One Configuration. The README Is the Patch for the Rest.](/posts/vm2-cve-2026-44007-readme-is-the-patch-for-the-rest)). In those exhibits a wrapper layer flipped the caller's flag inside itself, because the underlying framework returned a generic fallback type for the flag's documented setting. Netty's variant is the same shape from a different direction: the wrapper does not flip the flag, it discards the parameter that the flag's enforcement reads. The flag has the API surface of an enforced control. The runtime behavior is whatever the trust manager does with the `SSLEngine` argument. Netty's wrapper did nothing with it.\n\nThe bypass had been in the source since October 2016 and existed by design. The design was correct for one population (`InsecureTrustManagerFactory`, `FingerprintTrustManagerFactory`) whose trust managers were supposed to be insecure. The placement of the design at `SimpleTrustManagerFactory` applied it to a population that included every other trust manager factory in the ecosystem. The maintainers reading the 2016 motivation in the commit message had named both populations explicitly, in the same paragraph, without noticing they were applying a fix for the first to the second as well.\n\nPoC: [GHSA-c653-97m9-rcg9](https://github.com/advisories/GHSA-c653-97m9-rcg9)","closing_line":"The patch removes the wrapper from every other trust manager and adds it back inside `InsecureTrustManagerFactory`. The wrapper was running in reverse.","hook_md":"Netty 4.2 turned hostname verification on by default for client TLS. The default lives in `SslContext.defaultEndpointVerificationAlgorithm`, which resolves to `\"HTTPS\"` unless the operator explicitly sets the JVM property `io.netty.handler.ssl.defaultEndpointVerificationAlgorithm` to `\"NONE\"`. CVE-2026-50010, published June 5, 2026 and reported by Netty maintainer Chris Vest, is the disclosure that the default never reached the wire for any application using a custom `TrustManagerFactory`. A wrapper class committed by Trustin Lee on October 12, 2016 had been stripping hostname verification out of every trust manager the framework saw, for nine years and seven months, by extending `X509ExtendedTrustManager` and implementing every method by discarding the `SSLEngine` argument that carries the hostname.\nThe patch removes the wrapper from every other trust manager and adds it back inside `InsecureTrustManagerFactory`. The wrapper was running in reverse.","post_id":646,"slug":"netty-cve-2026-50010-2016-wrapper-stripped-the-4-2-default","title":"CVE-2026-50010: Netty 4.2 Turned Hostname Verification On By Default. A 2016 Wrapper Had Already Turned It Off.","type":"initial","unreadable_sentence":"For nine years and seven months, every Netty application that supplied a custom trust manager was running TLS without hostname verification, because the InsecureTrustManagerFactory needed to be insecure."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCauoiJgAKCRDeZjl4jgkQ JrlPAP0QQm86j1i9o8DboHWSBiBBQJg2SPnw/tciMz5wj570rQD/aCEhDT0yOIOS XLA0tNsb6F1MW7vi3FbxJX/+q9HVwwo= =QxIk -----END PGP SIGNATURE-----