# CVE-2023-28754: ShardingSphere-Agent: Deserialization vulnerability in ShardingSphere Agent

> Attackers with file write access can execute arbitrary code via malicious YAML deserialization in ShardingSphere Agent.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Jul 2023
- **Updated:** 13 Feb 2025
- **Also known as:** GHSA-3cxh-xp3g-jxjm

## What is CVE-2023-28754?

CVE-2023-28754 is a high-severity unsafe deserialization vulnerability in Apache Software Foundation ShardingSphere-Agent, published on 19 Jul 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Deserialization of Untrusted Data vulnerability in Apache ShardingSphere-Agent, which allows attackers to execute arbitrary code by constructing a special YAML configuration file.

The attacker needs to have permission to modify the ShardingSphere Agent YAML configuration file on the target machine, and the target machine can access the URL with the arbitrary code JAR.
An attacker can use SnakeYAML to deserialize java.net.URLClassLoader and make it load a JAR from a specified URL, and then deserialize javax.script.ScriptEngineManager to load code using that ClassLoader. When the ShardingSphere JVM process starts and uses the ShardingSphere-Agent, the arbitrary code specified by the attacker will be executed during the deserialization of the YAML configuration file by the Agent.

This issue affects ShardingSphere-Agent: through 5.3.2. This vulnerability is fixed in Apache ShardingSphere 5.4.0.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2023-28754?

2 open source packages ship an affected version, including org.apache.shardingsphere:shardingsphere. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.shardingsphere:shardingsphere` | Maven | All versions | 5.4.0 |
| `org.apache.shardingsphere:shardingsphere` | Maven | All versions | 5.4.0 |

Products: Apache Shardingsphere.

## How do I fix CVE-2023-28754?

Upgrade org.apache.shardingsphere:shardingsphere to 5.4.0 or later.

## Is CVE-2023-28754 being exploited?

There is no known exploitation of CVE-2023-28754 in the wild and no public exploit code.

## Other vulnerabilities in Apache Software Foundation ShardingSphere-Agent

- [CVE-2022-45347](https://insights.sbomify.com/CVE-2022-45347/): Apache ShardingSphere-Proxy: MySQL authentication bypass (critical 9.8)
- [CVE-2020-1947](https://insights.sbomify.com/CVE-2020-1947/): Deserialization of Untrusted Data in Apache ShardingSphere (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-28754 and fix it if it is affected.

What it is: CVE-2023-28754 is a high-severity unsafe deserialization vulnerability in Apache Software Foundation ShardingSphere-Agent, published on 19 Jul 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-28754 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.apache.shardingsphere:shardingsphere (Maven): affected all versions; fixed in 5.4.0
- org.apache.shardingsphere:shardingsphere (Maven): affected all versions; fixed in 5.4.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-28754/ (Markdown: https://insights.sbomify.com/CVE-2023-28754/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-28754
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-28754
- OSV: https://osv.dev/vulnerability/CVE-2023-28754

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-28754/
Summaries are generated and may contain mistakes; the official description above is the record.
