{
  "affected": [
    {
      "ranges": [
        {
          "database_specific": {
            "extracted_events": [
              {
                "introduced": "0"
              },
              {
                "fixed": "0.9.6"
              }
            ],
            "source": [
              "DESCRIPTION",
              "REFERENCES"
            ]
          },
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "93930acf9a79576c99fc8bb4d3ddbc1cd79622f3"
            },
            {
              "fixed": "18b9195598d9b944376754c6d1ad76e38a4adca1"
            }
          ],
          "repo": "https://github.com/marcobambini/gravity",
          "type": "GIT"
        }
      ]
    }
  ],
  "database_specific": {
    "cna_assigner": "VulnCheck",
    "cwe_ids": [
      "CWE-122"
    ],
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40504.json",
    "unresolved_ranges": [
      {
        "extracted_events": [
          {
            "fixed": "18b9195598d9b944376754c6d1ad76e38a4adca1"
          }
        ],
        "source": "AFFECTED_FIELD"
      }
    ]
  },
  "details": "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.",
  "id": "CVE-2026-40504",
  "modified": "2026-07-16T03:31:06.738961549Z",
  "published": "2026-04-16T01:10:27.364Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40504.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/marcobambini/gravity/releases/tag/0.9.6"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40504"
    },
    {
      "type": "ADVISORY",
      "url": "https://www.vulncheck.com/advisories/creolabs-gravity-heap-buffer-overflow-via-gravity-vm-exec"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/marcobambini/gravity/issues/437"
    },
    {
      "type": "FIX",
      "url": "https://github.com/marcobambini/gravity/commit/18b9195598d9b944376754c6d1ad76e38a4adca1"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/marcobambini/gravity"
    }
  ],
  "schema_version": "1.8.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Creolabs Gravity \u003c 0.9.6 Heap Buffer Overflow via gravity_vm_exec"
}