# GHSA-v57x-gxfj-484q: Security Advisory for "Log4Shell"

> Remote attackers can execute arbitrary code on servers using vulnerable Apache Log4j versions by triggering JNDI lookups via logged strings.

- **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:** 21 Jan 2022

## What is GHSA-v57x-gxfj-484q?

GHSA-v57x-gxfj-484q is a code injection vulnerability in com.hazelcast.jet:hazelcast-jet, published on 21 Jan 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact
A highly critical 0-day exploit (CVE-2021-44228) is found in Apache log4j 2 library on December 9, 2021.

This affects Apache log4j versions from 2.0-beta9 to 2.14.1 (inclusive). 

This vulnerability allows a remote attacker to execute code on the server if the system logs an attacker-controlled string value with the attacker's JNDI LDAP server lookup.

Another vulnerability related to the same library, which was discovered on 12/14/2021 (CVE-2021-45046) and revealed another Remote Code Execution vulnerability, has been investigated by Hazelcast team as well and it is found that it does not affect Hazelcast Products under default configurations. 

The finding of CVE-2021-45105 on 12/14/2021, which can cause a Denial of Service attack, was investigated by Hazelcast team and it is confirmed that it does not affect Hazelcast Products under default configurations. 

The finding of CVE-2021-44832 on 12/28/2021, which is a medium vulnerability, is investigated by our security team as well, and not considered to be as critical. It requires attacker to be able to modify logging configuration, which means attacker can modify the filesystem and/or can already execute arbitrary code which is more of a general security breach rather than something log4j specific.

Note that Hazelcast IMDG and IMDG Enterprise itself is not affected.

However, given version distributions are considered to be vulnerable since related ZIP and TGZ distributions contain a vulnerable Hazelcast Management Center version.

### Patches
CVE-2021-44228 is fixed in log4j 2.15.0.
CVE-2021-45046 is fixed in log4j 2.16.0.
CVE-2021-45105 is fixed in log4j 2.17.0.
CVE-2021-44832 is fixed in log4j 2.17.1.

As of 12/21/2021, Hazelcast team has released a new version of all affected products that upgrades log4j to 2.17.0 as listed below: 
Hazelcast Management Center 4.2021.12-1, Hazelcast Management Center 5.0.4.
Hazelcast IMDG and IMDG Enterprise 4.0.5, 4.1.8 and 4.2.4.
Hazelcast Jet 4.5.3.
Hazelcast Platform 5.0.2.

As of 01/06/2022, Hazelcast Management Center 4.2022.01 with the updated log4j 2.17.1 is released. log4j2.17.1 will be included in Management Center 5.1 that is expected to be released in February. 

Hazelcast recommends upgrading to the latest versions available.

### Workarounds
For users that an upgrade is not an option, below mitigations can be applied.

#### Disabling lookups via Environment Variable 
Setting the environment variable LOG4J_FORMAT_MSG_NO_LOOKUPS=true .
This option is the easiest to apply for containerized environments.

#### Disabling lookups in log4j2 configuration
Another good option since there is no need to replace JARs or no need to modify logging configuration file, users who cannot upgrade to 2.17.0 can mitigate the exposure by:

Users of Log4j 2.10 or greater may add `-Dlog4j2.formatMsgNoLookups=true `as a command line option or add `-Dlog4j2.formatMsgNoLookups=true` in a `log4j2.component.properties` file on the classpath to prevent lookups in log event messages.
Users since Log4j 2.7 may specify `%m{nolookups}` in the PatternLayout configuration to prevent lookups in log event messages.
As an example; users deploying Hazelcast Management Center via helm charts can do the following to disable lookups and restart in one command:

`helm upgrade <release-name> hazelcast/hazelcast --set mancenter.javaOpts="<javaOpts> -Dlog4j2.formatMsgNoLookups=true"`

Where <release-name> is the release name and <javaOpts> is existing java options user has added previously.

#### Removing the JndiLookup from classpath
Remove the JndiLookup and JndiManager classes from the log4j-core jar. Note that removal of the JndiManager will cause the JndiContextSelector and JMSAppender to no longer function.

### References
https://nvd.nist.gov/vuln/detail/CVE-2021-44228
https://nvd.nist.gov/vuln/detail/CVE-2021-45046
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105
https://nvd.nist.gov/vuln/detail/CVE-2021-44832
https://logging.apache.org/log4j/2.x/index.html

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [our repo](https://github.com/hazelcast/hazelcast)
* Slack us at [Hazelcast Community Slack](https://slack.hazelcast.com/)

## Which versions are affected by GHSA-v57x-gxfj-484q?

10 open source packages ship an affected version, including com.hazelcast.jet:hazelcast-jet and com.hazelcast:hazelcast.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `com.hazelcast.jet:hazelcast-jet` | Maven | From 4.1 | 4.5.3 |
| `com.hazelcast.jet:hazelcast-jet` | Maven | From 4.1 | 4.5.3 |
| `com.hazelcast:hazelcast` | Maven | From 4.0.0 | 4.0.5 |
| `com.hazelcast:hazelcast` | Maven | From 4.0.0 | 4.0.5 |
| `com.hazelcast:hazelcast` | Maven | From 4.1.1 | 4.1.8 |
| `com.hazelcast:hazelcast` | Maven | From 4.1.1 | 4.1.8 |
| `com.hazelcast:hazelcast` | Maven | From 4.2 | 4.2.4 |
| `com.hazelcast:hazelcast` | Maven | From 4.2 | 4.2.4 |
| `com.hazelcast:hazelcast` | Maven | From 5.0 | 5.0.2 |
| `com.hazelcast:hazelcast` | Maven | From 5.0 | 5.0.2 |

## How do I fix GHSA-v57x-gxfj-484q?

Upgrade com.hazelcast.jet:hazelcast-jet to 4.5.3 or later.

## Is GHSA-v57x-gxfj-484q being exploited?

There is no known exploitation of GHSA-v57x-gxfj-484q in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-v57x-gxfj-484q and fix it if it is affected.

What it is: GHSA-v57x-gxfj-484q is a code injection vulnerability in com.hazelcast.jet:hazelcast-jet, published on 21 Jan 2022. 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-v57x-gxfj-484q in the wild and no public exploit code.

Affected packages and fixed versions:
- com.hazelcast.jet:hazelcast-jet (Maven): affected from 4.1; fixed in 4.5.3
- com.hazelcast.jet:hazelcast-jet (Maven): affected from 4.1; fixed in 4.5.3
- com.hazelcast:hazelcast (Maven): affected from 4.0.0; fixed in 4.0.5
- com.hazelcast:hazelcast (Maven): affected from 4.0.0; fixed in 4.0.5
- com.hazelcast:hazelcast (Maven): affected from 4.1.1; fixed in 4.1.8
- com.hazelcast:hazelcast (Maven): affected from 4.1.1; fixed in 4.1.8
- com.hazelcast:hazelcast (Maven): affected from 4.2; fixed in 4.2.4
- com.hazelcast:hazelcast (Maven): affected from 4.2; fixed in 4.2.4
- com.hazelcast:hazelcast (Maven): affected from 5.0; fixed in 5.0.2
- com.hazelcast:hazelcast (Maven): affected from 5.0; fixed in 5.0.2

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-v57x-gxfj-484q/ (Markdown: https://insights.sbomify.com/GHSA-v57x-gxfj-484q/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-v57x-gxfj-484q

---
From sbomify Insights: https://insights.sbomify.com/GHSA-v57x-gxfj-484q/
Summaries are generated and may contain mistakes; the official description above is the record.
