Skip to content
Heist/ feed
Back to feed
Critical

Improper restriction of the scope of accessible objects in Thymeleaf expressions

Type: advisorySources: OSV

Thymeleaf is a server-side Java template engine for web and standalone environments. Versions 3.1.3.RELEASE and prior contain a security bypass vulnerability in the expression execution mechanisms. Although the library provides mechanisms to prevent expression injection, it fails to properly restrict the scope of accessible objects, allowing specific potentially sensitive objects to be reached from within a template. If an application developer passes unvalidated user input directly to the template engine, an unauthenticated remote attacker can bypass the library's protections to achieve Server-Side Template Injection (SSTI). This issue has ben fixed in version 3.1.4.RELEASE.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-40477
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 22:24 UTC · Revision 1

Source evidence

Improper restriction of the scope of accessible objects in Thymeleaf expressions

core-osv · Original source

Published 17 Apr 2026, 21:53 UTC

Thymeleaf is a server-side Java template engine for web and standalone environments. Versions 3.1.3.RELEASE and prior contain a security bypass vulnerability in the expression execution mechanisms. Although the library provides mechanisms to prevent expression injection, it fails to properly restrict the scope of accessible objects, allowing specific potentially sensitive objects to be reached from within a template. If an application developer passes unvalidated user input directly to the template engine, an unauthenticated remote attacker can bypass the library's protections to achieve Server-Side Template Injection (SSTI). This issue has ben fixed in version 3.1.4.RELEASE.

osv:CVE-2026-40477
Complete source record
{
  "id": "6ced764407245f7049f298020a8fd45cfc808a8df2cce54356f05a30713608d1",
  "url": "https://osv.dev/vulnerability/CVE-2026-40477",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Improper restriction of the scope of accessible objects in Thymeleaf expressions",
    "summary": "Thymeleaf is a server-side Java template engine for web and standalone environments. Versions 3.1.3.RELEASE and prior contain a security bypass vulnerability in the expression execution mechanisms. Although the library provides mechanisms to prevent expression injection, it fails to properly restrict the scope of accessible objects, allowing specific potentially sensitive objects to be reached from within a template. If an application developer passes unvalidated user input directly to the template engine, an unauthenticated remote attacker can bypass the library's protections to achieve Server-Side Template Injection (SSTI). This issue has ben fixed in version 3.1.4.RELEASE.",
    "evidence": "osv:CVE-2026-40477",
    "products": [],
    "severity": "critical",
    "structured": {
      "id": "CVE-2026-40477",
      "aliases": [
        "CVE-2026-40477",
        "GHSA-r4v4-5mwr-2fwr"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/thymeleaf/thymeleaf",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "dca2346cf9071501ce498f5f38f93a0c6330f25c"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "3.1.4.RELEASE"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "cpe": "cpe:2.3:a:thymeleaf:thymeleaf:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "3.1.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "thymeleaf-3.1.3.RELEASE",
            "thymeleaf-3.1.2.RELEASE",
            "thymeleaf-3.1.1.RELEASE",
            "thymeleaf-3.1.0.RELEASE",
            "thymeleaf-3.1.0.RC2",
            "thymeleaf-3.1.0.RC1",
            "thymeleaf-3.1.0.M3",
            "thymeleaf-3.1.0.M2",
            "thymeleaf-3.1.0.M2-dev01",
            "thymeleaf-3.1.0.M1",
            "thymeleaf-3.0.14.RELEASE",
            "thymeleaf-3.0.13.RELEASE",
            "thymeleaf-3.0.12.RELEASE",
            "thymeleaf-3.0.11.RELEASE",
            "thymeleaf-3.0.10.RELEASE",
            "thymeleaf-3.0.9.RELEASE",
            "thymeleaf-3.0.8.RELEASE",
            "thymeleaf-3.0.7.RELEASE",
            "thymeleaf-3.0.6.RELEASE",
            "thymeleaf-3.0.5.RELEASE",
            "thymeleaf-3.0.4.RELEASE",
            "thymeleaf-3.0.3.RELEASE",
            "thymeleaf-3.0.2.RELEASE",
            "thymeleaf-3.0.1.RELEASE",
            "thymeleaf-3.0.0.RELEASE",
            "thymeleaf-3.0.0.BETA03",
            "thymeleaf-3.0.0.BETA02",
            "thymeleaf-3.0.0.BETA01",
            "thymeleaf-3.0.0.ALPHA03",
            "thymeleaf-3.0.0.ALPHA02",
            "thymeleaf-3.0.0.ALPHA01",
            "thymeleaf-2.1.3.RELEASE",
            "thymeleaf-2.1.2.RELEASE",
            "thymeleaf-2.1.1.RELEASE",
            "thymeleaf-2.1.0.RELEASE",
            "thymeleaf-2.1.0-beta2",
            "thymeleaf-2.1.0-beta1",
            "thymeleaf-2.1.0-m3",
            "thymeleaf-2.1.0-m2",
            "thymeleaf-2.1.0-m1",
            "thymeleaf-2.0.16",
            "thymeleaf-2.0.15",
            "thymeleaf-2.0.14",
            "thymeleaf-2.0.13",
            "thymeleaf-2.0.12",
            "thymeleaf-2.0.11",
            "thymeleaf-2.0.10",
            "thymeleaf-2.0.9",
            "thymeleaf-2.0.8",
            "thymeleaf-2.0.7",
            "thymeleaf-2.0.6",
            "thymeleaf-2.0.5",
            "thymeleaf-2.0.4",
            "thymeleaf-2.0.3",
            "thymeleaf-2.0.2",
            "thymeleaf-2.0.1",
            "thymeleaf-2.0.0",
            "thymeleaf-2.0.0-beta2",
            "thymeleaf-2.0.0-beta1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-40477.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:39.897098998Z",
      "provider": "osv",
      "references": [
        "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40477.json",
        "https://access.redhat.com/errata/RHSA-2026:21772",
        "https://access.redhat.com/security/cve/CVE-2026-40477",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40477.json",
        "https://github.com/thymeleaf/thymeleaf/security/advisories/GHSA-r4v4-5mwr-2fwr",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-40477",
        "https://bugzilla.redhat.com/show_bug.cgi?id=2459344"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-1336",
          "CWE-917"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40477.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-40477",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 507576,
  "published_at": "2026-04-17T21:53:47.271+00:00"
}