Sploit.io - Search

Product: z2d, version: > 0.5.1, <= 0.6.0

CVE-2025-46333

Severity: Unknown

Description: z2d is a pure Zig 2D graphics library. Versions of z2d after `0.5.1` and up to and including `0.6.0`, when writing from one surface to another using `z2d.compositor.StrideCompositor.run`, and higher-level operations when the anti-aliasing mode is set to `.default` (such as `Context.fill`, `Context.stroke`, `painter.fill`, and `painter.stroke`), the source surface can be completely out-of-bounds on the x-axis, but not on the y-axis, by way of a negative offset. This results in an overflow of the value controlling the length of the stride. In non-safe optimization modes (consumers compiling with `ReleaseFast` or `ReleaseSmall`), this could potentially lead to invalid memory accesses or corruption. This issue is patched in version `0.6.1`. Users on an untagged version after `v0.5.1` and before `v0.6.1` are advised to update to address the vulnerability. Those still on Zig `0.13.0` are recommended to downgrade to `v0.5.1`.

CVSS Score: N/A

Priority

D

CISA Data

EPSS Data

  • EPSS: 0.001490000
  • Percentile: 0.044520000
  • Date: 2026-06-29

ExploitDB

No data available.

HackerOne Data

  • Rank: 9981
  • Reports submitted count: 0
  • Unknown: 0
  • None: 0
  • Low: 0
  • Medium: 0
  • High: 0
  • Critical: 0

GitHub PoCs

    Nuclei Templates

    No data available.

    VulnCheck Data

    Affected Products:

    • vancluever z2d - Versions: > 0.5.1, <= 0.6.0

    References:

    Risk Assessment

    1. Risk Assessment
    The vulnerability, identified as CVE-2025-46333, is an out-of-bounds write issue within the z2d graphics library. Specifically, when using the `StrideCompositor` for surface composition with anti-aliasing enabled, a negative offset can cause the source surface to extend beyond the intended boundaries on the x-axis. This overflow of the stride length control value, particularly in non-safe optimization modes like `ReleaseFast` or `ReleaseSmall`, can lead to invalid memory accesses or corruption. The vulnerability is rated as HIGH severity (CVSS v4.0 score of 7.3). The business impact depends on how z2d is used. Applications heavily reliant on accurate 2D rendering, especially those processing external or user-supplied data that influences the composition, are at higher risk. A successful exploit could result in application crashes, data corruption, or potentially even remote code execution. Likelihood of exploitation is moderate, as it requires specific conditions (anti-aliasing enabled, non-safe optimization mode) and a suitable input to trigger the negative offset. Ease of exploitation is also moderate, requiring understanding of the z2d API and the composition process. Impacts on confidentiality, integrity, and availability are all potential, with integrity being the most immediately impacted by data corruption.

    2. Potential Attack Scenarios
    A potential attack scenario involves a malicious image or graphic being used as input to an application utilizing z2d. Imagine an application that renders user-uploaded images with anti-aliasing enabled. An attacker could craft an image specifically designed to trigger the negative offset during composition. The attacker could create an image where, when rendered with z2d, the anti-aliasing causes a stride overflow. This overflow, in a `ReleaseFast` compiled application, would overwrite adjacent memory. The attacker could potentially overwrite critical data structures, leading to a crash, or even overwrite code to gain control of the application. The attack vector is the input image file. The attack process involves the application loading the image, rendering it using z2d with anti-aliasing, and the stride overflow occurring during composition. The potential outcome is application crash, data corruption, or potential code execution depending on what memory is overwritten.

    3. Mitigation Recommendations
    The primary mitigation is to update to z2d version `0.6.1` or later. This version includes the patch for the out-of-bounds write. If updating immediately isn't feasible, consider downgrading to z2d version `0.5.1` if the application is still using Zig `0.13.0`. For applications compiled in non-safe optimization modes (`ReleaseFast` or `ReleaseSmall`), prioritize the update to `0.6.1`. If updating isn't possible, consider switching to a safe optimization mode, albeit with a potential performance impact. Review the application’s use of z2d, specifically how the `StrideCompositor` is used and whether anti-aliasing is essential. If anti-aliasing isn’t critical, disable it to reduce the attack surface. Relevant resources include: GitHub advisory: https://github.com/vancluever/z2d/security/advisories/GHSA-mm4c-p35v-7hx3 and the related GitHub issues: https://github.com/vancluever/z2d/issues/104 and https://github.com/vancluever/z2d/issues/105.

    4. Executive Summary
    z2d, a Zig 2D graphics library, contains a vulnerability (CVE-2025-46333) that could lead to application crashes or data corruption. The vulnerability occurs when rendering graphics with anti-aliasing enabled, and it's particularly concerning for applications compiled with performance optimizations. A malicious image could trigger the vulnerability, potentially allowing an attacker to compromise the application. The risk is considered HIGH, and the recommended action is to update to z2d version 0.6.1. This update will prevent the out-of-bounds write and protect your application from potential disruption. Prioritize this update, especially if your application relies heavily on accurate 2D rendering or processes external image data, to ensure continued application stability and data integrity. Delaying the update could result in application crashes and potentially data corruption impacting user experience and business operations.