CVE-2025-65960

6.6 MEDIUM

📋 TL;DR

This vulnerability allows authenticated back-end users in Contao CMS to execute arbitrary PHP functions through template closures, potentially leading to remote code execution. It affects Contao versions 4.0.0 to 4.13.56, 5.0.0 to 5.3.41, and 5.4.0 to 5.6.4. Only users with back-end access and control over template closures can exploit this.

💻 Affected Systems

Products:
  • Contao CMS
Versions: 4.0.0 to 4.13.56, 5.0.0 to 5.3.41, 5.4.0 to 5.6.4
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Requires back-end user access and control over template closures. Not exploitable by anonymous users.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

An authenticated attacker gains full server control through arbitrary PHP function execution, leading to data theft, system compromise, or lateral movement.

🟠

Likely Case

Privileged back-end users escalate privileges or execute unauthorized code within the application context.

🟢

If Mitigated

With proper access controls and monitoring, exploitation is limited to authorized users who would be detected if abusing their privileges.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires authenticated back-end access and specific knowledge of template closure manipulation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.13.57, 5.3.42, 5.6.5

Vendor Advisory: https://contao.org/en/security-advisories/remote-code-execution-in-template-closures

Restart Required: No

Instructions:

1. Identify your Contao version. 2. Upgrade to 4.13.57, 5.3.42, or 5.6.5 depending on your major version. 3. Follow standard Contao update procedures via Composer or manual update.

🔧 Temporary Workarounds

Manual patch of Contao\Template::once() method

all

Manually apply the security fix to the vulnerable method as described in the advisory.

Refer to GitHub security advisory GHSA-98vj-mm79-v77r for specific code changes

🧯 If You Can't Patch

  • Restrict back-end user access to only trusted administrators
  • Implement strict monitoring of template modifications and PHP function calls

🔍 How to Verify

Check if Vulnerable:

Check Contao version via admin panel or composer.json. If version falls within affected ranges, system is vulnerable.

Check Version:

php vendor/bin/contao-console contao:version

Verify Fix Applied:

Confirm version is 4.13.57, 5.3.42, or 5.6.5 or higher. Test template closure functionality.

📡 Detection & Monitoring

Log Indicators:

  • Unusual PHP function calls from template files
  • Template modification by non-admin users
  • Unexpected system command execution

Network Indicators:

  • Unusual outbound connections from web server process

SIEM Query:

Search for 'Contao\Template::once' in application logs with suspicious parameters

🔗 References

📤 Share & Export