# CVE-2022-2061: Heap-based Buffer Overflow in hpjansson/chafa

> A heap-based buffer overflow in Chafa allows attackers to execute arbitrary code or cause denial of service via crafted images.

- **Severity:** Low 2.8 (`CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 13 Jun 2022
- **Updated:** 3 Aug 2024
- **Also known as:** DEBIAN-CVE-2022-2061, GHSA-q3m2-24xm-qm8c, JLSEC-2026-1090, UBUNTU-CVE-2022-2061, openSUSE-SU-2022:10017-1, openSUSE-SU-2024:12151-1

## What is CVE-2022-2061?

CVE-2022-2061 is a low-severity memory corruption vulnerability in hpjansson/chafa, published on 13 Jun 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Heap-based Buffer Overflow in GitHub repository hpjansson/chafa prior to 1.12.0.

Weakness: CWE-787 (Out-of-bounds Write), CWE-122 (Heap-based Buffer Overflow)

## Which versions are affected by CVE-2022-2061?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `chafa` | SUSE:Package Hub 15 SP4 | All versions | 1.8.0-bp154.3.3.1 |
| `chafa` | openSUSE:Leap 15.4 | All versions | 1.8.0-bp154.3.3.1 |
| `chafa` | openSUSE:Tumbleweed | All versions | 1.12.1-1.1 |

Products: Chafa Project Chafa.

## How do I fix CVE-2022-2061?

Upgrade to a fixed version.

## Is CVE-2022-2061 being exploited?

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

## Other vulnerabilities in hpjansson/chafa

- [CVE-2022-2301](https://insights.sbomify.com/CVE-2022-2301/): Buffer Over-read in hpjansson/chafa (medium 5.5)
- [CVE-2022-1507](https://insights.sbomify.com/CVE-2022-1507/): Null dereference in hpjansson/chafa (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-2061 and fix it if it is affected.

What it is: CVE-2022-2061 is a low-severity memory corruption vulnerability in hpjansson/chafa, published on 13 Jun 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-2061 in the wild and no public exploit code.

Affected product: hpjansson/chafa. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-2022-2061/ (Markdown: https://insights.sbomify.com/CVE-2022-2061/index.md)
```

## Sources

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

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