GIVE YOUR AGENT THE EVIDENCE

Set up in your agent.

One prompt to get started. Paste it into your coding agent to connect cve.new through MCP and bring vulnerability context into your workflow.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GIVE YOUR AGENT THE EVIDENCE

Investigate in your agent.

Turn this advisory into a focused investigation. Ask your agent to check your project’s versions, explain the evidence, and suggest a compatible fix.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GHSA-f6wf-28g6-769xmedium6.9

Smarty: Symlink path traversal out of trusted directories

Check your stack

The advisory, in context

When Smarty's Security policy is enabled, secure_dir (and the configured template/trusted directories) restrict which local files a template may read via {include} and {fetch}. The trust check in Security::_checkDir() resolved the requested path with Smarty::_realpath(), which normalizes the path as a string only and does not follow symbolic links. A symlink placed inside a trusted directory therefore passed the trust check, while the underlying file_get_contents() followed it to an arbitrary file outside the sandbox (e.g. /etc/passwd).

Impact

An attacker able to (a) cause a symlink to exist inside a trusted directory (e.g. a user-upload area located within the template path) and (b) cause a template to reference that path can read arbitrary files readable by the PHP process, escaping the secure_dir boundary. Confidentiality impact only.

Patches

Fixed in 5.8.2. Security::_checkDir() now resolves the requested file with native realpath() and re-validates the canonical, symlink-free path against the trusted directories (which are canonicalized the same way, so legitimate symlinked deployment paths such as a Capistrano current symlink or macOS /var → /private/var keep working). It falls back to string normalization only when the file does not yet exist on disk.

Workarounds

Ensure no untrusted symlinks can be created within any directory listed in secure_dir/the trusted template directories; restrict write access to those directories to trusted processes only.

References

  • Fix commit: 99c048c
  • CWE-22

Affected packages

Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.

Ecosystem versions

From 5.0.0 before 5.8.2

Fixed in 5.8.2

20 explicitly affected versions

v5.0.0, v5.0.1, v5.0.2, v5.1.0, v5.2.0, v5.3.0, v5.3.1, v5.4.0, v5.4.1, v5.4.2, v5.4.3, v5.4.4, v5.4.5, v5.5.0, v5.5.1, v5.5.2, v5.6.0, v5.7.0, v5.8.0, v5.8.1

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "5.0.0"
        },
        {
          "fixed": "5.8.2"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "v5.0.0",
    "v5.0.1",
    "v5.0.2",
    "v5.1.0",
    "v5.2.0",
    "v5.3.0",
    "v5.3.1",
    "v5.4.0",
    "v5.4.1",
    "v5.4.2",
    "v5.4.3",
    "v5.4.4",
    "v5.4.5",
    "v5.5.0",
    "v5.5.1",
    "v5.5.2",
    "v5.6.0",
    "v5.7.0",
    "v5.8.0",
    "v5.8.1"
  ]
}
Ecosystem versions

Earlier releases before 4.5.7

Fixed in 4.5.7

72 explicitly affected versions

v2.6.24, v2.6.25, v2.6.26, v2.6.27, v2.6.28, v2.6.29, v2.6.30, v2.6.31, v2.6.33, v3.1.11, v3.1.12, v3.1.13, v3.1.14, v3.1.15, v3.1.16, v3.1.17, v3.1.18, v3.1.19, v3.1.20, v3.1.21, v3.1.23, v3.1.24, v3.1.25, v3.1.26, v3.1.27, v3.1.28, v3.1.29, v3.1.30, v3.1.31, v3.1.32, v3.1.33, v3.1.34, v3.1.35, v3.1.36, v3.1.37, v3.1.37.1, v3.1.38, v3.1.39, v3.1.40, v3.1.41, v3.1.42, v3.1.43, v3.1.44, v3.1.45, v3.1.46, v3.1.47, v3.1.48, v4.0.0, v4.0.0-rc.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.1.0, v4.1.1, v4.2.0, v4.2.1, v4.3.0, v4.3.1, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.4.0, v4.4.1, v4.5.0, v4.5.1, v4.5.2, v4.5.3, v4.5.4, v4.5.5, v4.5.6

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "0"
        },
        {
          "fixed": "4.5.7"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "v2.6.24",
    "v2.6.25",
    "v2.6.26",
    "v2.6.27",
    "v2.6.28",
    "v2.6.29",
    "v2.6.30",
    "v2.6.31",
    "v2.6.33",
    "v3.1.11",
    "v3.1.12",
    "v3.1.13",
    "v3.1.14",
    "v3.1.15",
    "v3.1.16",
    "v3.1.17",
    "v3.1.18",
    "v3.1.19",
    "v3.1.20",
    "v3.1.21",
    "v3.1.23",
    "v3.1.24",
    "v3.1.25",
    "v3.1.26",
    "v3.1.27",
    "v3.1.28",
    "v3.1.29",
    "v3.1.30",
    "v3.1.31",
    "v3.1.32",
    "v3.1.33",
    "v3.1.34",
    "v3.1.35",
    "v3.1.36",
    "v3.1.37",
    "v3.1.37.1",
    "v3.1.38",
    "v3.1.39",
    "v3.1.40",
    "v3.1.41",
    "v3.1.42",
    "v3.1.43",
    "v3.1.44",
    "v3.1.45",
    "v3.1.46",
    "v3.1.47",
    "v3.1.48",
    "v4.0.0",
    "v4.0.0-rc.0",
    "v4.0.1",
    "v4.0.2",
    "v4.0.3",
    "v4.0.4",
    "v4.1.0",
    "v4.1.1",
    "v4.2.0",
    "v4.2.1",
    "v4.3.0",
    "v4.3.1",
    "v4.3.2",
    "v4.3.3",
    "v4.3.4",
    "v4.3.5",
    "v4.4.0",
    "v4.4.1",
    "v4.5.0",
    "v4.5.1",
    "v4.5.2",
    "v4.5.3",
    "v4.5.4",
    "v4.5.5",
    "v4.5.6"
  ]
}

References