# CVE-2024-23636: SOFARPC Remote Command Execution(RCE) Vulnerbility

> Attackers can execute arbitrary code by bypassing the SOFA Hessian blacklist via a JDK-only gadget chain in SOFARPC.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 23 Jan 2024
- **Updated:** 18 Oct 2024
- **Also known as:** GHSA-7q8p-9953-pxvr

## What is CVE-2024-23636?

CVE-2024-23636 is a critical unsafe deserialization vulnerability in sofastack sofa-rpc, published on 23 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

SOFARPC is a Java RPC framework. SOFARPC defaults to using the SOFA Hessian protocol to deserialize received data, while the SOFA Hessian protocol uses a blacklist mechanism to restrict deserialization of potentially dangerous classes for security protection. But, prior to version 5.12.0, there is a gadget chain that can bypass the SOFA Hessian blacklist protection mechanism, and this gadget chain only relies on JDK and does not rely on any third-party components. Version 5.12.0 fixed this issue by adding a blacklist. SOFARPC also provides a way to add additional blacklists. Users can add a class like `-Drpc_serialize_blacklist_override=org.apache.xpath.` to avoid this issue.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2024-23636?

2 open source packages ship an affected version, including com.alipay.sofa:rpc-sofa-boot-starter. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `com.alipay.sofa:rpc-sofa-boot-starter` | Maven | All versions | 5.12.0 |
| `com.alipay.sofa:rpc-sofa-boot-starter` | Maven | All versions | 5.12.0 |

Products: Sofastack Sofarpc.

## How do I fix CVE-2024-23636?

Upgrade com.alipay.sofa:rpc-sofa-boot-starter to 5.12.0 or later.

## Is CVE-2024-23636 being exploited?

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

## Other vulnerabilities in sofastack sofa-rpc

- [CVE-2023-41331](https://insights.sbomify.com/CVE-2023-41331/): SOFARPC Remote Command Execution (RCE) Vulnerability (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-23636 and fix it if it is affected.

What it is: CVE-2024-23636 is a critical unsafe deserialization vulnerability in sofastack sofa-rpc, published on 23 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-23636 in the wild and no public exploit code.

Affected packages and fixed versions:
- com.alipay.sofa:rpc-sofa-boot-starter (Maven): affected all versions; fixed in 5.12.0
- com.alipay.sofa:rpc-sofa-boot-starter (Maven): affected all versions; fixed in 5.12.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-2024-23636/ (Markdown: https://insights.sbomify.com/CVE-2024-23636/index.md)
```

## Sources

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

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