# GHSA-3w6p-8f82-gw8r: Using JMSAppender in log4j configuration may lead to deserialization of untrusted data

> Remote attackers can execute code if the ClickHouse JDBC Bridge uses a non-default log4j configuration with JMSAppender and an insecure broker.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Dec 2021

## What is GHSA-3w6p-8f82-gw8r?

GHSA-3w6p-8f82-gw8r is an unsafe deserialization vulnerability in ru.yandex.clickhouse:clickhouse-jdbc-bridge, published on 17 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

ClickHouse JDBC Bridge uses [slf4j-log4j12 1.7.32](https://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.32/), which depends on [log4j 1.2.17](https://repo1.maven.org/maven2/log4j/log4j/1.2.17/). It allows a remote attacker to execute code on the server, if you changed default log4j configuration by adding JMSAppender and an insecure JMS broker.

### Patches

The patch version `2.0.7` removed log4j dependency by replacing `slf4j-log4j12` to `slf4j-jdk14`. Logging configuration is also changed from `log4j.properties` to `logging.properties`.

### Workarounds

1. Do NOT change log4j configuration to use JMSAppender along with insecure JMS broker
2. Alternatively, you can issue below command to remove `JMSAppender.class`:

```(bash)
# install zip command if you don't have
apt-get update && apt-get install -y zip
# remove the class
zip -d clickhouse-jdbc-bridge*.jar ru/yandex/clickhouse/jdbcbridge/internal/log4j/net/JMSAppender.class
```

### References

Please refer to [CVE-2021-4104](https://access.redhat.com/security/cve/CVE-2021-4104) to read more.

### For more information

If you have any questions or comments about this advisory, please feel free to open an issue in the repository.

## Which versions are affected by GHSA-3w6p-8f82-gw8r?

2 open source packages ship an affected version, including ru.yandex.clickhouse:clickhouse-jdbc-bridge.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ru.yandex.clickhouse:clickhouse-jdbc-bridge` | Maven | All versions | 2.0.7 |
| `ru.yandex.clickhouse:clickhouse-jdbc-bridge` | Maven | All versions | 2.0.7 |

## How do I fix GHSA-3w6p-8f82-gw8r?

Upgrade ru.yandex.clickhouse:clickhouse-jdbc-bridge to 2.0.7 or later.

## Is GHSA-3w6p-8f82-gw8r being exploited?

There is no known exploitation of GHSA-3w6p-8f82-gw8r in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-3w6p-8f82-gw8r and fix it if it is affected.

What it is: GHSA-3w6p-8f82-gw8r is an unsafe deserialization vulnerability in ru.yandex.clickhouse:clickhouse-jdbc-bridge, published on 17 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-3w6p-8f82-gw8r in the wild and no public exploit code.

Affected packages and fixed versions:
- ru.yandex.clickhouse:clickhouse-jdbc-bridge (Maven): affected all versions; fixed in 2.0.7
- ru.yandex.clickhouse:clickhouse-jdbc-bridge (Maven): affected all versions; fixed in 2.0.7

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/GHSA-3w6p-8f82-gw8r/ (Markdown: https://insights.sbomify.com/GHSA-3w6p-8f82-gw8r/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-3w6p-8f82-gw8r

---
From sbomify Insights: https://insights.sbomify.com/GHSA-3w6p-8f82-gw8r/
Summaries are generated and may contain mistakes; the official description above is the record.
