BuzzPHP
LightDarkSystem

Grav: media_directory() Twig function allows filesystem path traversal and file content disclosure from sandboxed page content

High severity. Published 17 September 2026. Update getgrav/grav to 2.0.16 or later: composer update getgrav/grav.

Which versions are affected?

PackageAffected versionsFixed in
getgrav/grav (opens in a new tab)<= 2.0.152.0.16

What should you do?

Update every affected package you use to its fixed version, then check that nothing else in your project matches an advisory. To see which version you run, and whether anything is still affected:

composer show getgrav/grav
composer audit

Advisory details

SeverityHighCVSS 6.5
Published
Updated
CVECVE-2026-72697 (opens in a new tab)
GHSAGHSA-47ch-6w46-6xm7 (opens in a new tab)
WeaknessCWE-22

What the advisory says

Summary

The mediadirectory() Twig function is allow-listed for use in sandboxed, editor-authored page content (system/config/security.yaml). Its implementation, GravExtension::mediaDirFunc(), only treats the input as unsafe when it looks like a Grav stream (user://, theme://, etc). If the input is instead a plain filesystem path, absolute or relative, the stream check is skipped entirely and the raw string is handed straight to new Media($mediadir), which lists every file in that directory whose extension matches a configured media type (which by default includes txt, json, xml, pdf, doc, docx, and more, not just images) and builds Medium objects for them.

Source: GHSA-47ch-6w46-6xm7 (opens in a new tab) in the GitHub Advisory Database (CC BY 4.0). Data from GitHub (opens in a new tab) as of .

Other recent advisories for this package

All Composer security advisories