[SECURITY][DS] Complete CVE-2023-49566 fix for non-MySQL JDBC drivers#5449
Merged
casionone merged 1 commit intoJun 26, 2026
Merged
Conversation
…JDBC drivers The CVE-2023-49566 fix shipped earlier only protected the MySQL/StarRocks SqlConnection implementations. The eight other JDBC driver families used by the metadata-query / datasource-manager modules (PostgreSQL, Oracle, SQL Server, ClickHouse, KingBase, Greenplum, DM, DB2) still streamed user- supplied extraParams straight onto the JDBC URL with no allowlist/denylist, so any authenticated user could inject driver-specific dangerous properties: * PG/Greenplum/KingBase: socketFactory + socketFactoryArg -> RCE on drivers below 42.2.25 / 42.3.2 * DB2: clientRerouteServerListJNDIName -> JNDI injection (the original CVE-2023-49566 sink) * Oracle: oracle.net.tns_admin / javax.net.ssl.trustStore -> TLS/TNS hijack * SQL Server: jaasConfigurationName -> JAAS lookup Fix extends the MySQL-only SecurityUtils path to every driver family: * Add JdbcDriverType enum + per-driver denylist/force-params config in SecurityUtils (checkJdbcConnParams(JdbcDriverType, ...) and buildSecureProperties). * All 16 SqlConnection implementations (8 drivers x 2 modules) now call SecurityUtils.checkJdbcConnParams and route through Properties-based DriverManager.getConnection, never URL concatenation. * Add 10 unit tests covering each driver denylist, URL-encoded bypass, host injection, and force-params-wins semantics. Files: linkis-commons/linkis-common/.../utils/JdbcDriverType.java (new) linkis-commons/linkis-common/.../utils/SecurityUtils.java linkis-commons/linkis-common/.../utils/SecurityUtilsTest.java linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/ service/jdbc/.../AbstractSqlConnection.java linkis-public-enhancements/linkis-datasource/linkis-{metadata-query, datasource-manager}/service/jdbc/.../{postgres,oracle,sqlserver, clickhouse,kingbase,greenplum,dm,db2}/SqlConnection.java Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
The CVE-2023-49566 fix shipped earlier only protected the MySQL/StarRocks
SqlConnectionimplementations. The eight other JDBC driver families used bythe metadata-query / datasource-manager modules still streamed user-supplied
extraParamsstraight onto the JDBC URL with no allowlist/denylist, so anyauthenticated user could inject driver-specific dangerous properties and reach
DriverManager.getConnectionwith them.This is the "incomplete fix of CVE-2023-49566" report forwarded by ASF Security
(reporter: greybtw, tested on 1.8.0, CVSS 8.8).
Per-driver sinks reachable before this PR:
socketFactory+socketFactoryArg-> reflective class instantiation -> RCE on PG drivers < 42.2.25 / < 42.3.2clientRerouteServerListJNDIName-> JNDI injection (the original CVE-2023-49566 sink)oracle.net.tns_admin/javax.net.ssl.trustStore-> TLS/TNS config hijackjaasConfigurationName-> JAAS lookupBrief change log
linkis-commons/.../utils/JdbcDriverType.java: enum identifying the 10 JDBC driver families.linkis-commons/.../utils/SecurityUtils.java: add generic JDBC security layercheckJdbcConnParams(JdbcDriverType, host, port, username, password, database, extraParams)— driver-aware denylist dispatch, URL-decode loop, host-injection guardbuildSecureProperties(JdbcDriverType, username, password, extraParams)— builds aPropertiesbag with driver-specific force-set security defaults first, then credentials, then user params that don't conflict with the force-set keyslinkis.jdbc.security.check.enable,linkis.jdbc.{global,postgres,db2,oracle,sqlserver}.blocked.params,linkis.jdbc.{postgres,db2,oracle,sqlserver,clickhouse,dm}.force.paramsSqlConnectionimplementations (8 drivers x 2 modules) now:SecurityUtils.checkJdbcConnParams(driverType, ...)DriverManager.getConnection(url, props)withprops = SecurityUtils.buildSecureProperties(...)extraParamsonto the URLdatasource-manager/.../AbstractSqlConnection.java: the (currently orphaned) hard-coded PostgreSQL path is also routed through SecurityUtils so a future revival cannot reintroduce the sink.linkis-commons/.../SecurityUtilsTest.java: 10 new unit tests covering%73ocketFactory)evil.com:5432/db?socketFactory=x,#,&)trustServerCertificate=falseoverrides usertrue)Backward compatibility
linkis.jdbc.security.check.enable=true); operators who need to disable it temporarily can flip the flag.SecurityUtilsTest— 19 tests) all pass.Checklist
Note
This is a security fix for a privately-reported issue routed through ASF Security.
Until the PMC triages it, please keep the discussion on the private security
channel rather than the public PR. The PR can stay
[WIP]until the embargo lifts.🤖 Generated with Claude Code