# CVE-2026-33021: saitoha libsixel use-after-free in sixel_encoder_encode_bytes

Source: https://junglewise.ai/threats/cve-2026-33021-saitoha-libsixel-use-after-free-in-sixel-encoder-encode-bytes  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-14. Updated: 2026-07-25  
License: CC BY 4.0 with a link back

CVE-2026-33021 · Severity: high · CVSS 7.3 · Published 2026-04-14

libsixel is a library used to encode and decode images in the SIXEL format, often used for displaying graphics in terminal emulators. A flaw in how the library handles memory during image resizing can cause it to accidentally delete data that still belongs to the calling application. This can lead to application crashes or allow an attacker to potentially take control of the affected program.

Technologies: [Saitoha Libsixel](https://junglewise.ai/threats/technologies/libsixel). Vendors: [Saitoha](https://junglewise.ai/threats/vendors/saitoha).

## Quick answers

**Is CVE-2026-33021 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-33021 being exploited in the wild.

**How severe is CVE-2026-33021?** High severity, with a CVSS score of 7.3, published 14 April 2026.

**Which products and versions are affected?** Saitoha Libsixel <= 1.8.7.

**Is there a fix for CVE-2026-33021?** A patch was published on 2026-04-14: Fixed in version 1.8.7-r1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-33021 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-33021?** Check whether you run Saitoha Libsixel at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A use-after-free vulnerability exists in libsixel versions 1.8.7 and prior within the sixel_encoder_encode_bytes() function. The root cause is in sixel_frame_init(), which stores a pointer to the caller-provided pixel buffer directly in frame->pixels without a defensive copy. If a resize operation is triggered (e.g., via SIXEL_OPTFLAG_WIDTH), sixel_frame_convert_to_rgb888() unconditionally frees this caller-owned buffer and replaces it with an internal allocation. This leaves the caller with a dangling pointer; subsequent access to the original buffer results in a use-after-free. An attacker providing specially crafted frames can trigger this reliably, leading to a crash or potential arbitrary code execution. The issue is fixed in version 1.8.7-r1.

## Affected products

- saitoha libsixel <= 1.8.7

## Timeline

- 2026-04-14: disclosed
- 2026-04-14: advisory
- 2026-04-14: patched: Fixed in version 1.8.7-r1

## References

- [https://github.com/saitoha/libsixel/releases/tag/v1.8.7-r1](https://github.com/saitoha/libsixel/releases/tag/v1.8.7-r1)
- [https://github.com/saitoha/libsixel/security/advisories/GHSA-j6m5-2cc7-3whc](https://github.com/saitoha/libsixel/security/advisories/GHSA-j6m5-2cc7-3whc)

## Related threats

- [saitoha libsixel NULL pointer dereference in sixel_decode_raw](https://junglewise.ai/threats/cve-2026-44638-saitoha-libsixel-null-pointer-dereference-in-sixel-decode-raw)
- [saitoha libsixel integer overflow in SIXEL parser](https://junglewise.ai/threats/cve-2026-44637-saitoha-libsixel-integer-overflow-in-sixel-parser)
- [saitoha libsixel heap buffer overflow in sixel_encode_highcolor](https://junglewise.ai/threats/cve-2026-44636-saitoha-libsixel-heap-buffer-overflow-in-sixel-encode-highcolor)
- [saitoha libsixel use-after-free in load_with_gdkpixbuf](https://junglewise.ai/threats/cve-2026-33023-saitoha-libsixel-use-after-free-in-load-with-gdkpixbuf)
- [saitoha libsixel heap overflow in sixel_frame_convert_to_rgb888](https://junglewise.ai/threats/cve-2026-33020-saitoha-libsixel-heap-overflow-in-sixel-frame-convert-to-rgb888)
