CVE-2026-133765 (GCVE-0-2026-133765)

Vulnerability from cvelistv5 – Published: 2026-11-24 13:07 – Updated: 2026-11-24 13:07
VLAI
Title
Sandbox `__toString()` policy bypass via assignment and destructuring expressions
Summary
The sandbox checks that a template may call toString() on an object before converting it to a string. Since Twig 3.23.0, assignments like x = obj, and the destructuring forms [a] = list and {a} = obj, evaluate to the value that they assign. The sandbox didn't check that value, so a sandboxed template could call a denied toString() method: {{ (x = obj) }} {{ ({secret: s} = obj)|join }} No tag needs to be allowed. The sandbox now checks the result of assignments like the result of filters and functions. {% do x = obj %} and {% if (x = obj) %} still work, since they don't convert the value to a string.
CWE
  • CWE-693 - Protection Mechanism Failure
  • CWE-863 - Incorrect Authorization
Impacted products
Vendor Product Version
Twig twig/twig Affected: 3.23.0 , < 3.31.1 (semver)
Create a notification for this product.
Date Public
2026-11-24 12:58
Show details on NVD website

{
  "containers": {
    "cna": {
      "affected": [
        {
          "collectionURL": "https://packagist.org",
          "defaultStatus": "unaffected",
          "packageName": "twig/twig",
          "product": "twig/twig",
          "repo": "https://github.com/twigphp/Twig",
          "vendor": "Twig",
          "versions": [
            {
              "lessThan": "3.31.1",
              "status": "affected",
              "version": "3.23.0",
              "versionType": "semver"
            }
          ]
        }
      ],
      "credits": [
        {
          "lang": "en",
          "type": "remediation developer",
          "value": "Fabien Potencier"
        },
        {
          "lang": "en",
          "type": "finder",
          "value": "Jacko"
        },
        {
          "lang": "en",
          "type": "finder",
          "value": "Inanna Malick"
        },
        {
          "lang": "en",
          "type": "finder",
          "value": "Tudor-Andrei Oprea"
        }
      ],
      "datePublic": "2026-11-24T12:58:32.000Z",
      "descriptions": [
        {
          "lang": "en",
          "supportingMedia": [
            {
              "base64": false,
              "type": "text/markdown",
              "value": "The sandbox checks that a template may call `__toString()` on an object before converting it to a string. Since Twig 3.23.0, assignments like `x = obj`, and the destructuring forms `[a] = list` and `{a} = obj`, evaluate to the value that they assign. The sandbox didn\u0027t check that value, so a sandboxed template could call a denied `__toString()` method:\n\n```twig\n{{ (x = obj) }}\n{{ ({secret: s} = obj)|join }}\n```\n\nNo tag needs to be allowed.\n\nThe sandbox now checks the result of assignments like the result of filters and functions. `{% do x = obj %}` and `{% if (x = obj) %}` still work, since they don\u0027t convert the value to a string."
            }
          ],
          "value": "The sandbox checks that a template may call toString() on an object before converting it to a string. Since Twig 3.23.0, assignments like x = obj, and the destructuring forms [a] = list and {a} = obj, evaluate to the value that they assign. The sandbox didn\u0027t check that value, so a sandboxed template could call a denied toString() method:\n\n{{ (x = obj) }}\n{{ ({secret: s} = obj)|join }}\n\nNo tag needs to be allowed.\n\nThe sandbox now checks the result of assignments like the result of filters and functions. {% do x = obj %} and {% if (x = obj) %} still work, since they don\u0027t convert the value to a string."
        }
      ],
      "metrics": [
        {
          "cvssV4_0": {
            "baseScore": 5.3,
            "baseSeverity": "MEDIUM",
            "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N",
            "version": "4.0"
          },
          "format": "CVSS",
          "scenarios": [
            {
              "lang": "en",
              "value": "GENERAL"
            }
          ]
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-693",
              "description": "CWE-693 Protection Mechanism Failure",
              "lang": "en",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "cweId": "CWE-863",
              "description": "CWE-863 Incorrect Authorization",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-11-24T13:07:48.546Z",
        "orgId": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
        "shortName": "Symfony"
      },
      "references": [
        {
          "name": "CVE-2026-133765",
          "tags": [
            "vendor-advisory"
          ],
          "url": "https://symfony.com/cve-2026-133765"
        },
        {
          "name": "GHSA-ccrc-gqhf-3cxc",
          "tags": [
            "vendor-advisory"
          ],
          "url": "https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc"
        },
        {
          "tags": [
            "patch"
          ],
          "url": "https://github.com/twigphp/Twig/commit/6bcdbc3d4470dde23e3e2636e7053e0512387edd"
        }
      ],
      "source": {
        "advisory": "GHSA-ccrc-gqhf-3cxc",
        "discovery": "UNKNOWN"
      },
      "title": "Sandbox `__toString()` policy bypass via assignment and destructuring expressions",
      "x_generator": {
        "engine": "symfony/ghsa-to-cve"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
    "assignerShortName": "Symfony",
    "cveId": "CVE-2026-133765",
    "datePublished": "2026-11-24T13:07:48.546Z",
    "dateReserved": "2026-11-20T14:01:43.158Z",
    "dateUpdated": "2026-11-24T13:07:48.546Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "nvd": {
      "cve": {
        "affected": [
          {
            "affectedData": [
              {
                "collectionURL": "https://packagist.org",
                "defaultStatus": "unaffected",
                "packageName": "twig/twig",
                "product": "twig/twig",
                "repo": "https://github.com/twigphp/Twig",
                "vendor": "Twig",
                "versions": [
                  {
                    "lessThan": "3.31.1",
                    "status": "affected",
                    "version": "3.23.0",
                    "versionType": "semver"
                  }
                ]
              }
            ],
            "source": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6"
          }
        ],
        "cveTags": [],
        "descriptions": [
          {
            "lang": "en",
            "value": "The sandbox checks that a template may call toString() on an object before converting it to a string. Since Twig 3.23.0, assignments like x = obj, and the destructuring forms [a] = list and {a} = obj, evaluate to the value that they assign. The sandbox didn\u0027t check that value, so a sandboxed template could call a denied toString() method:\n\n{{ (x = obj) }}\n{{ ({secret: s} = obj)|join }}\n\nNo tag needs to be allowed.\n\nThe sandbox now checks the result of assignments like the result of filters and functions. {% do x = obj %} and {% if (x = obj) %} still work, since they don\u0027t convert the value to a string."
          }
        ],
        "id": "CVE-2026-133765",
        "lastModified": "2026-11-24T18:56:39.360",
        "metrics": {
          "cvssMetricV40": [
            {
              "cvssData": {
                "Automatable": "NOT_DEFINED",
                "Recovery": "NOT_DEFINED",
                "Safety": "NOT_DEFINED",
                "attackComplexity": "LOW",
                "attackRequirements": "NONE",
                "attackVector": "NETWORK",
                "availabilityRequirement": "NOT_DEFINED",
                "baseScore": 5.3,
                "baseSeverity": "MEDIUM",
                "confidentialityRequirement": "NOT_DEFINED",
                "exploitMaturity": "NOT_DEFINED",
                "integrityRequirement": "NOT_DEFINED",
                "modifiedAttackComplexity": "NOT_DEFINED",
                "modifiedAttackRequirements": "NOT_DEFINED",
                "modifiedAttackVector": "NOT_DEFINED",
                "modifiedPrivilegesRequired": "NOT_DEFINED",
                "modifiedSubAvailabilityImpact": "NOT_DEFINED",
                "modifiedSubConfidentialityImpact": "NOT_DEFINED",
                "modifiedSubIntegrityImpact": "NOT_DEFINED",
                "modifiedUserInteraction": "NOT_DEFINED",
                "modifiedVulnAvailabilityImpact": "NOT_DEFINED",
                "modifiedVulnConfidentialityImpact": "NOT_DEFINED",
                "modifiedVulnIntegrityImpact": "NOT_DEFINED",
                "privilegesRequired": "LOW",
                "providerUrgency": "NOT_DEFINED",
                "subAvailabilityImpact": "NONE",
                "subConfidentialityImpact": "NONE",
                "subIntegrityImpact": "NONE",
                "userInteraction": "NONE",
                "valueDensity": "NOT_DEFINED",
                "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
                "version": "4.0",
                "vulnAvailabilityImpact": "NONE",
                "vulnConfidentialityImpact": "LOW",
                "vulnIntegrityImpact": "NONE",
                "vulnerabilityResponseEffort": "NOT_DEFINED"
              },
              "source": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
              "type": "Secondary"
            }
          ]
        },
        "published": "2026-11-24T13:17:24.493",
        "references": [
          {
            "source": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
            "url": "https://github.com/twigphp/Twig/commit/6bcdbc3d4470dde23e3e2636e7053e0512387edd"
          },
          {
            "source": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
            "url": "https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc"
          },
          {
            "source": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
            "url": "https://symfony.com/cve-2026-133765"
          }
        ],
        "sourceIdentifier": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
        "vulnStatus": "Awaiting Analysis",
        "weaknesses": [
          {
            "description": [
              {
                "lang": "en",
                "value": "CWE-693"
              },
              {
                "lang": "en",
                "value": "CWE-863"
              }
            ],
            "source": "b5aa5c7f-767d-4597-9c64-3ac08b8711c6",
            "type": "Secondary"
          }
        ]
      }
    }
  }
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…