{
  "ticket_id": "CVE-2026-24425",
  "code_root": "external/twig",
  "source": {
    "type": "cve",
    "cve_id": "CVE-2026-24425",
    "advisory_id": "GHSA-2q52-x2ff-qgfr",
    "advisory_url": "https://github.com/twigphp/Twig/security/advisories/GHSA-2q52-x2ff-qgfr",
    "vendor": "twigphp",
    "product": "Twig",
    "repo": "https://github.com/twigphp/Twig"
  },
  "facts": {
    "cve_id": "CVE-2026-24425",
    "advisory_id": "GHSA-2q52-x2ff-qgfr",
    "issue_summary": "When the Twig sandbox is enabled per-template through a SourcePolicyInterface (rather than enabled globally), the runtime security check for the sort, filter, map and reduce filters fails to consult the current template's source. As a result the SourcePolicy is not applied to those filters, and an attacker who can supply template content can pass an arbitrary PHP callable to one of those filters and have it executed, bypassing the sandbox.",
    "vulnerability_type": "Protection Mechanism Failure (Twig sandbox escape)",
    "suspected_cwe": ["CWE-693"],
    "affected_versions": "3.9.0 - 3.25.x (and the 2.16.x line)",
    "fixed_versions": ["3.26.0"],
    "reproduce_version": "3.25.0",
    "verify_fixed_version": "3.26.0",
    "repo_url": "https://github.com/twigphp/Twig.git",
    "checkout_ref": "v3.26.0",
    "code_root": "external/twig",
    "ecosystem": "Packagist",
    "package": "twig/twig",
    "install_recipe": "In a scratch directory run `composer require twig/twig:3.25.0` (vulnerable) or `composer require twig/twig:3.26.0` (fixed). The Packagist releases are the canonical artifacts; NVD references the v3.26.0 release tag for the fix.",
    "attacker_access": "Any attacker who can supply template content rendered under a Twig sandbox that is enabled per-template via a SourcePolicyInterface.",
    "exploit_outline": "Configure a Twig environment whose sandbox is enabled per-template through a SourcePolicyInterface. Render attacker-supplied template content that applies one of the affected filters with a dangerous PHP callable, e.g. `{{ ['id']|map('system') }}` or `|filter` with a dangerous callable. Because the runtime check does not consult the template source, the SourcePolicy does not block the filter and the callable is executed.",
    "vulnerable_indicator": "On 3.25.0 the PHP callable passed to sort/filter/map/reduce is executed - the command runs or the observable side effect occurs - even though the template is under a SourcePolicy-based sandbox.",
    "fixed_indicator": "On 3.26.0 the runtime check consults the template source and the SourcePolicy is applied; rendering the same template throws a Twig SecurityError instead of executing the callable.",
    "reproduction_requirements": "PHP with composer and the twig/twig package at the specified version. A Twig environment configured with a per-template SourcePolicyInterface-based sandbox. No network service, database, or browser required - the difference is observable in-process (callable executed vs SecurityError thrown).",
    "notes": "The bypass is specific to per-template sandboxing via SourcePolicyInterface; a globally enabled sandbox is not affected. The PoC must configure the sandbox through a SourcePolicy so the missing source consultation is exercised."
  }
}
