Advisory

GHSA-6j75-5wfj-gh66

Also known as: CVE-2024-45411

Summary

Twig has a possible sandbox bypass

Details

Description

Under some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions.

The security issue happens when all these conditions are met:

  • The sandbox is disabled globally;
  • The sandbox is enabled via a sandboxed include() function which references a template name (like included.twig) and not a Template or TemplateWrapper instance;
  • The included template has been loaded before the include() call but in a non-sandbox context (possible as the sandbox has been globally disabled).

Resolution

The patch ensures that the sandbox security checks are always run at runtime.

Credits

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

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-09-09 20:19 UTC
Modified
2024-10-10 15:29 UTC

Affected packages and fixes

twig/twig

Packagist · All systems

Affected

  • introduced 1.0.0, fixed 1.44.8 (ecosystem)

Fixed versions

1.44.8

Fix

The export has no generic command for this ecosystem.

twig/twig

Packagist · All systems

Affected

  • introduced 2.0.0, fixed 2.16.1 (ecosystem)

Fixed versions

2.16.1

Fix

The export has no generic command for this ecosystem.

twig/twig

Packagist · All systems

Affected

  • introduced 3.12.0, fixed 3.14.0 (ecosystem)

Fixed versions

3.14.0

Fix

The export has no generic command for this ecosystem.

twig/twig

Packagist · All systems

Affected

  • introduced 3.0.0, fixed 3.11.1 (ecosystem)

Fixed versions

3.11.1

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences