Skip to main content
Menu
Advisories

RCE via unsandboxed Twig rendering when "parseTwig" is enabled

GHSA-R7F2-VRPQ-8XHMPublished Updated GitHub

Description

The plugin has a parseTwig configuration that allows parsing and rendering Twig from the fetched feed data. When enabled, the plugin passes every fetched field value that contains a { character to View::renderObjectTemplate() for Twig rendering. renderObjectTemplate() does not enable Craft’s Twig sandbox - the sandboxed variant renderSandboxedObjectTemplate() is not called. An admin who enables parseTwig=true and runs a feed with attacker-controlled data achieves RCE on the server.

The attack works even with CRAFT_ENABLE_TWIG_SANDBOX=true.

The attack vector is straightforward. A control panel user creates a feed whose feed URL points to an attacker-controlled HTTP server. The attacker returns JSON/CSV/XML with field values that contain a Twig payload. When the feed runs, the payload is rendered unsandboxed.

Impact

A control panel user with feed-me access achieves RCE. Operators who rely on the default sandbox config for protection are exposed whenever an admin enables parseTwig on any feed.

Affected versions

References

GitHub · craftcms/feed-me