Skip to content

Addressed CVE-2025-59250 and version updates for 13.2.1#2801

Merged
divang merged 2 commits intorelease/13.2from
fresh-release-13.2.1-updates
Oct 15, 2025
Merged

Addressed CVE-2025-59250 and version updates for 13.2.1#2801
divang merged 2 commits intorelease/13.2from
fresh-release-13.2.1-updates

Conversation

@divang
Copy link
Copy Markdown
Contributor

@divang divang commented Oct 15, 2025

This PR includes:

  • Addressing CVE-2025-59250: JDBC Driver for SQL Server Spoofing Vulnerability: Improper input validation in JDBC Driver for SQL Server allows an unauthorized attacker to perform spoofing over a network.
  • Version updates to 13.2.1

Problem Statement

The MSSQL JDBC driver's SSL certificate validation contains a critical security vulnerability that allows hostname spoofing attacks. The current parseCommonName() method uses unsafe string parsing on the "canonical" format of X.509 Distinguished Names, which can be exploited by malicious certificates.

Security Impact

An attacker can craft malicious X.509 certificates that bypass hostname validation by embedding fake hostnames within other certificate attributes. This allows man-in-the-middle attacks where:

Attacker presents a certificate with DN like: OU=CN=legitimate-server.com, CN=attacker.com
The vulnerable parser incorrectly extracts legitimate-server.com instead of the actual CN attacker.com
Application accepts the certificate as valid for legitimate-server.com when it's actually issued for attacker.com
SSL/TLS connection proceeds with compromised security

Root Cause Analysis

Unsafe String Parsing: Original code used indexOf("cn=") and substring operations on the "canonical" DN format
Format Ambiguities: The "canonical" format lowercases and reverses RDN order, creating parsing ambiguities
Insufficient Validation: No proper escaping/unescaping of DN components
Regex Vulnerabilities: Simple pattern matching vulnerable to DN injection attacks

Solution

Complete rewrite of CN parsing logic using secure, industry-standard approaches:

Secure DN Parsing:

Replaced custom string parsing with javax.naming.ldap.LdapName and Rdn classes
Uses RFC2253 format instead of vulnerable "canonical" format
Proper handling of escaped characters and DN structure

Security Testing:

Added testSecureCNParsing_preventsHostnameSpoofing() test case
Validates fix prevents known attack vectors
Mock certificate testing framework for edge cases

…bility: Improper input validation in JDBC Driver for SQL Server allows an unauthorized attacker to perform spoofing over a network
Comment thread CHANGELOG.md Outdated
@divang divang merged commit d95ab31 into release/13.2 Oct 15, 2025
4 checks passed
dongjoon-hyun added a commit to apache/spark that referenced this pull request Nov 3, 2025
### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` test dependency to `13.2.1.jre11`.

### Why are the changes needed?

To use the latest features (like JDK 23 official support) and bug fixed versions during testing.
- https://github.com/microsoft/mssql-jdbc/releases/tag/v13.2.1
  - microsoft/mssql-jdbc#2801
- https://github.com/microsoft/mssql-jdbc/releases/tag/v13.2.0
  - microsoft/mssql-jdbc#2724
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.2
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.1
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.0
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.9.0
  - microsoft/mssql-jdbc#2515
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.2

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #52856 from dongjoon-hyun/SPARK-54155.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Nov 3, 2025
### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` test dependency to `13.2.1.jre11`.

### Why are the changes needed?

To use the latest features (like JDK 23 official support) and bug fixed versions during testing.
- https://github.com/microsoft/mssql-jdbc/releases/tag/v13.2.1
  - microsoft/mssql-jdbc#2801
- https://github.com/microsoft/mssql-jdbc/releases/tag/v13.2.0
  - microsoft/mssql-jdbc#2724
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.2
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.1
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.0
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.9.0
  - microsoft/mssql-jdbc#2515
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.2

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #52856 from dongjoon-hyun/SPARK-54155.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 34c3dde)
Signed-off-by: Dongjoon Hyun <[email protected]>
huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
### What changes were proposed in this pull request?

This PR aims to upgrade `mssql-jdbc` test dependency to `13.2.1.jre11`.

### Why are the changes needed?

To use the latest features (like JDK 23 official support) and bug fixed versions during testing.
- https://github.com/microsoft/mssql-jdbc/releases/tag/v13.2.1
  - microsoft/mssql-jdbc#2801
- https://github.com/microsoft/mssql-jdbc/releases/tag/v13.2.0
  - microsoft/mssql-jdbc#2724
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.2
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.1
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.10.0
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.9.0
  - microsoft/mssql-jdbc#2515
- https://github.com/microsoft/mssql-jdbc/releases/tag/v12.8.2

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#52856 from dongjoon-hyun/SPARK-54155.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants