docker images used by GitLab Code Quality contain the vulnerable version of log4j CVE-2021-44228
The GitLab Code Quality Docker images contain a vulnerable version of log4j (2.11.2) that is affected by CVE-2021-44228. An attacker could potentially exploit this to achieve remote code execution on a GitLab Runner.
GitLab
Originally disclosed on GitLab
- Fixed in 3 months
- Disclosed after 3 months
HackerOne report #1524801 by keypress on 2022-03-28, assigned to H1 Triage:
Report | How To Reproduce
Report
NOTE! Thanks for submitting a report! Please replace all the (parenthesized) sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!
Summary
It seems that some docker images released/used by GitLab Code Quality module, specifically codeclimate contain/use the vulnerable version of log4j CVE-2021-44228. I could see it on my GitLab Runner servers for jobs including GitLab Code-Quality template.
Steps to reproduce
- Assuming you have a Linux system with Docker installed
- Execute:
docker pull codeclimate/codeclimate-duplication - Execute:
find / -iname "log4j-core*.jar" - You will see sth like that:
/var/lib/docker/overlay2/0998c2fef2dc704b577f5a8e1bfe46ffa4ab87f48428749d185c6043de7fdcab/diff/home/app/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2.jar
/var/lib/docker/overlay2/0998c2fef2dc704b577f5a8e1bfe46ffa4ab87f48428749d185c6043de7fdcab/diff/home/app/.sbt/boot/scala-2.12.12/org.scala-sbt/sbt/1.4.3/log4j-core-2.11.2.jar
- As you can see, there is log4j v2.11.2 which is vulnerable according to https://logging.apache.org/log4j/2.x/security.html
Impact
CVE-2021-44228 could allow RCE
Examples
I am not able to show that one can exploit this situation.
What is the current bug behavior?
Currently there is an old vulnerable JAR version in use.
What is the expected correct behavior?
A newer version of log4j should be used. Or the log4j JAR should be removed, if it is not needed.
Relevant logs and/or screenshots
Given in steps to reproduce.
Output of checks
hmm
Results of GitLab environment info
I have seen it on GitLab 14.7.4. But probably it's in all versions as it's a docker images dependency problem.
Impact
In the worst case an attacker could exploit CVE-2021-44228 as RCE on a docker gitlab runner.
How To Reproduce
Please add reproducibility information to this section:
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Docker image includes a vulnerable version of the log4j library as a dependency.
Impact
In the worst case, an attacker could exploit CVE-2021-44228 to achieve remote code execution on a Docker GitLab Runner.
What the attacker needed
Docker installed; Access to pull the image; GitLab Runner using the image
The fix
A newer version of log4j should be used, or the log4j JAR should be removed if not needed.
How it was found
- Have a Linux system with Docker installed.
- Pull the codeclimate/codeclimate-duplication Docker image.
- Search the filesystem for log4j-core JAR files.
- Observe that log4j-core version 2.11.2 is present, which is vulnerable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Log4j is a logging library used in many Java applications. A serious flaw in some versions lets attackers run their own commands on the server. This report found that a Docker image used by GitLab contains an old, vulnerable version of log4j, so if that image is used, the server could be at risk.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.