Unauthenticated Arbitrary Class Loading via SQL Server socketFactoryClass
Description
Impact
Summary
DataEase Community Edition v3.0.0 contains an unauthenticated arbitrary class loading vulnerability in the datasource connection validation interface (POST /de2api/datasource/validate). The endpoint lacks authorization checks (@DePermit), allowing unauthenticated network attackers to invoke it directly. When configuring a Microsoft SQL Server datasource (type=sqlServer), the application fails to validate the socketFactoryClass JDBC connection parameter across both hostName (via extraParams) and raw jdbcUrl configurations. The underlying Microsoft SQL Server JDBC driver (mssql-jdbc) passes this parameter directly to Class.forName(), followed by an instantiation attempt if the class implements javax.net.SocketFactory. This enables unauthenticated attackers to force the server's JVM to load arbitrary classes present on the classpath. Note that this issue is an unauthenticated class loading and instantiation primitive rather than Remote Code Execution (RCE), as no executable SocketFactory gadgets are known on the default classpath.
Affected Code
The vulnerability stems from missing authentication on the validation API combined with missing connection parameter filtering in the SQL Server provider:
1. Missing Authentication Check In io.dataease.api.ds.DatasourceApi.java, the POST /datasource/validate endpoint is not annotated with @DePermit, whereas other endpoints (such as GET /validate/{id}) enforce permissions. In standalone Community Edition deployments (listening on DE_PORT=8100 without reverse-proxy authorization filtering), the validation endpoint can be invoked without providing any authentication token. The validation action only tests connectivity and does not persist the datasource to the database.
2. Incomplete JDBC URL Security Filtering In io.dataease.datasource.type.Sqlserver.java, the getJdbc() method handles connection strings through two code paths, neither of which blocks socketFactoryClass:
- Raw JDBC URL Path (
urlType=jdbcUrl): The code checks only for thejdbc:sqlserverprefix and returns the user-supplied URL directly without passing it throughJdbcUrlSecurityPolicy.validate(). - Hostname Path (
urlType=hostName+extraParams): User-suppliedextraParamsare appended directly to the URL (jdbc:sqlserver://...;EXTRA_PARAMS). WhileJdbcUrlSecurityPolicy.validate()is invoked, the SQL Server-specific dangerous fragments list (TYPE_DANGEROUS_FRAGMENTS["sqlserver"]) was empty, and theCOMMON_DANGEROUS_FRAGMENTSlist filters only MySQL-related parameters (e.g.,autoDeserialize,queryInterceptors) and protocols (jndi:,ldap:), omittingsocketFactoryClass.
3. Driver-Level Class Loading Sink The Microsoft SQL Server JDBC driver (mssql-jdbc) parses connection properties and evaluates socketFactoryClass. Upon receiving this parameter, the driver invokes Class.forName(socketFactoryClass) within the application's classloader context. If the class is found and implements javax.net.SocketFactory, the driver attempts instantiation using the default constructor (or a single String constructor if socketFactoryConstructorArg is provided).
Technical Analysis
Root Cause: The application enforces parameter blacklists for other drivers (such as PostgreSQL's socketFactory or generic autoDeserialize), but left SQL Server parameter filtering empty while leaving the validation API unauthenticated.
Comparative Analysis:
- PostgreSQL
socketFactory→ Rejected byJdbcUrlSecurityPolicywithIllegal parameter: socketFactory. - SQL Server
autoDeserialize→ Rejected byJdbcUrlSecurityPolicywithIllegal parameter: autoDeserialize. - SQL Server
socketFactoryClass→ Passes validation without restriction, reaching the driver'sClass.forNamesink.
Exploitation Scope & Clarification:
- This issue allows unauthenticated arbitrary class loading and attempted instantiation.
- Because no known
javax.net.SocketFactoryimplementations on the default classpath provide an arbitrary command execution gadget, this vulnerability does not provide direct Remote Code Execution. - The
POST /de2api/datasource/validateendpoint performs an in-memory connection test and does not save the datasource record in persistent storage.
Vulnerability Reproduction / POC
Prerequisites:
- Target: DataEase Community Edition v3.0.0 (e.g. official image
dataease:v3.0.0, commita339f1e003f21029d5c37f2c491c8b11c7a72abc) - Network access to port 8100
- No authentication credentials required
Steps:
- Verify Unauthenticated Context: Sending a request without authentication tokens to
GET /de2api/user/ipInforeturns400with messageeq(null) is not allowed, verifying the absence of a user session:
<img width="1684" height="392" alt="Unauthenticated verification via ipInfo" src="raw.githubusercontent.com/
- Verify Existing Blacklist Controls: Attempting to pass MySQL
autoDeserializeor PostgreSQLsocketFactoryconfirms active filtering for those components:
<img width="1832" height="696" alt="SQL Server autoDeserialize blocked" src="raw.githubusercontent.com/
<img width="1794" height="685" alt="PostgreSQL socketFactory blocked" src="raw.githubusercontent.com/
- Trigger Arbitrary
Class.forName: Submit an unauthenticated request toPOST /de2api/datasource/validatewithtype=sqlServerand a non-existent class name insocketFactoryClass:
```http POST /de2api/datasource/validate HTTP/1.1 Host: target:8100 Content-Type: application/json
{ "id": null, "name": "test_sqlserver", "type": "sqlServer", "configuration": "eyJkYXRhQmFzZSI6InRlc3QiLCJleHRyYVBhcmFtcyI6InNvY2tldEZhY3RvcnlDbGFzcz1pby5kYXRhZWFzZS5wb2MuTm90RXhpc3RTb2NrZXRGYWN0b3J5OyIsImhvc3QiOiIxMjcuMC4wLjEiLCJwYXNzd29yZCI6InBhc3MiLCJwb3J0IjoxNDMzLCJ1cmxUeXBlIjoiaG9zdE5hbWUiLCJ1c2VybmFtZSI6InNhIn0=" } `` *Decoded configuration payload:* `json { "host": "127.0.0.1", "port": 1433, "dataBase": "test", "username": "sa", "password": "pass", "urlType": "hostName", "extraParams": "socketFactoryClass=io.dataease.poc.NotExistSocketFactory;" } ``
The server returns ClassNotFoundException: io.dataease.poc.NotExistSocketFactory, confirming that Class.forName was invoked:
<img width="1831" height="716" alt="SQL Server socketFactoryClass triggers ClassNotFoundException" src="raw.githubusercontent.com/
- Verify Raw JDBC URL Bypass: The raw JDBC URL short path (
urlType=jdbcUrl) similarly reachesClass.forName:
<img width="1824" height="728" alt="Raw jdbcUrl short path triggers ClassNotFoundException" src="raw.githubusercontent.com/
- Verify Class Resolution and Subclass Check: Supplying an existing classpath class such as
java.lang.String(socketFactoryClass=java.lang.String;) results in: ``Class java.lang.String must be assignable to javax.net.SocketFactory`This confirms thatClass.forNamesuccessfully located and loaded the class before failing theSocketFactory` type assertion:
<img width="1825" height="715" alt="java.lang.String succeeds forName and fails SocketFactory assignment" src="raw.githubusercontent.com/
Impact
Unauthenticated network attackers can:
- Force the application JVM to execute
Class.forNamefor arbitrary class names. - Trigger static initializers of existing classes on the classpath.
- Probe the classpath for the existence or absence of specific classes via differential error messages.
- Attempt object instantiation if a targeted class implements
javax.net.SocketFactory.
Affected versions
- Affected versions <= v3.0.0 (specifically confirmed on release tag
v3.0.0, commita339f1e003f21029d5c37f2c491c8b11c7a72abc)
Patches
The vulnerability has been addressed in commit b26005c50 and will be included in v3.1.0.
References
If you have any questions or comments about this advisory:
- Open an issue in github.com/
dataease/ dataease - Email us at wei@fit2cloud.com