ghsa-52m2-vc4m-jj33
Vulnerability from github
Published
2022-09-30 05:29
Modified
2022-09-30 05:29
Summary
Twig may load a template outside a configured directory when using the filesystem loader
Details

Description

When using the filesystem loader to load templates for which the name is a user input, it is possible to use the source or include statement to read arbitrary files from outside the templates directory when using a namespace like @somewhere/../some.file (in such a case, validation is bypassed).

Resolution

We fixed validation for such template names.

Even if the 1.x branch is not maintained anymore, a new version has been released.

Credits

We would like to thank Dariusz Tytko for reporting the issue and Fabien Potencier for fixing the issue.

Show details on source website


{
   affected: [
      {
         package: {
            ecosystem: "Packagist",
            name: "twig/twig",
         },
         ranges: [
            {
               events: [
                  {
                     introduced: "1.0.0",
                  },
                  {
                     fixed: "1.44.7",
                  },
               ],
               type: "ECOSYSTEM",
            },
         ],
      },
      {
         package: {
            ecosystem: "Packagist",
            name: "twig/twig",
         },
         ranges: [
            {
               events: [
                  {
                     introduced: "2.0.0",
                  },
                  {
                     fixed: "2.15.3",
                  },
               ],
               type: "ECOSYSTEM",
            },
         ],
      },
      {
         package: {
            ecosystem: "Packagist",
            name: "twig/twig",
         },
         ranges: [
            {
               events: [
                  {
                     introduced: "3.0.0",
                  },
                  {
                     fixed: "3.4.3",
                  },
               ],
               type: "ECOSYSTEM",
            },
         ],
      },
   ],
   aliases: [
      "CVE-2022-39261",
   ],
   database_specific: {
      cwe_ids: [
         "CWE-22",
      ],
      github_reviewed: true,
      github_reviewed_at: "2022-09-30T05:29:36Z",
      nvd_published_at: "2022-09-28T14:15:00Z",
      severity: "HIGH",
   },
   details: "# Description\n\nWhen using the filesystem loader to load templates for which the name is a user input, it is possible to use the `source` or `include` statement to read arbitrary files from outside the templates directory when using a namespace like `@somewhere/../some.file` (in such a case, validation is bypassed).\n\n# Resolution\n\nWe fixed validation for such template names.\n\nEven if the 1.x branch is not maintained anymore, a new version has been released.\n\n# Credits\n\nWe would like to thank Dariusz Tytko for reporting the issue and Fabien Potencier for fixing the issue.\n",
   id: "GHSA-52m2-vc4m-jj33",
   modified: "2022-09-30T05:29:36Z",
   published: "2022-09-30T05:29:36Z",
   references: [
      {
         type: "WEB",
         url: "https://github.com/twigphp/Twig/security/advisories/GHSA-52m2-vc4m-jj33",
      },
      {
         type: "ADVISORY",
         url: "https://nvd.nist.gov/vuln/detail/CVE-2022-39261",
      },
      {
         type: "WEB",
         url: "https://github.com/twigphp/Twig/commit/35f3035c5deb0041da7b84daf02dea074ddc7a0b",
      },
      {
         type: "WEB",
         url: "https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2022-39261.yaml",
      },
      {
         type: "PACKAGE",
         url: "https://github.com/twigphp/Twig",
      },
      {
         type: "WEB",
         url: "https://lists.debian.org/debian-lts-announce/2022/10/msg00016.html",
      },
      {
         type: "WEB",
         url: "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2OKRUHPVLIQVFPPJ2UWC3WV3WQO763NR",
      },
      {
         type: "WEB",
         url: "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/AUVTXMNPSZAHS3DWZEM56V5W4NPVR6L7",
      },
      {
         type: "WEB",
         url: "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NWRFPZSR74SYVJKBTKTMYUK36IJ3SQJP",
      },
      {
         type: "WEB",
         url: "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TW53TFJ6WWNXMUHOFACKATJTS7NIHVQE",
      },
      {
         type: "WEB",
         url: "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WV5TNNJLGG536TJH6DLCIAAZZIPV2GUD",
      },
      {
         type: "WEB",
         url: "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YU4ZYX62H2NUAKKGUES4RZIM4KMTKZ7F",
      },
      {
         type: "WEB",
         url: "https://symfony.com/blog/twig-security-release-possibility-to-load-a-template-outside-a-configured-directory-when-using-the-filesystem-loader",
      },
      {
         type: "WEB",
         url: "https://www.debian.org/security/2022/dsa-5248",
      },
      {
         type: "WEB",
         url: "https://www.drupal.org/sa-core-2022-016",
      },
   ],
   schema_version: "1.4.0",
   severity: [
      {
         score: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
         type: "CVSS_V3",
      },
   ],
   summary: "Twig may load a template outside a configured directory when using the filesystem loader",
}


Log in or create an account to share your comment.

Security Advisory comment format.

This schema specifies the format of a comment related to a security advisory.

UUIDv4 of the comment
UUIDv4 of the Vulnerability-Lookup instance
When the comment was created originally
When the comment was last updated
Title of the comment
Description of the comment
The identifier of the vulnerability (CVE ID, GHSA-ID, PYSEC ID, etc.).



Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.