Server-Site Template Injection on CraftCMS 3.8.1
Exploit Author: Tin Pham (aka TF1T) and Trong Pham (aka Dtro) of VietSunshine Cyber Security Services
Vendor of Product: CraftCMS
Affected Product Code Base: 3.8.1
CVE: CVE-2023-30130
Summary:
An issue found in CraftCMS v.3.8.1 allows a remote attacker to execute arbitrary code via a crafted script to the Section parameter.
Go to Settings -> Section -> Edit entry types (Or create new section with Single's Section Type, then edit entry types)
Injection malicious code to Title Format, uses
file_get_contents
andfile_put_contents
to upload files and get RCE.
The story:
CraftCMS is open source and a program of huntr.dev.
Bypass authentication
The Reset password is vulnerable to Head host poisoning, when an attacker changes Host header to attacker's domain/IP, the host of reset link that sends to victim email will be replaced with attacker's IP. If victim clicks the link, reset token will send to attacker server, so an attacker can assign new password and takeover target account.
RAW Request:
RCE
At admin site, we see multiple location allowing user that enter Template code, one of them is at Create a new section with Single's Section Type.
We can inject Twig template to Title Format when editing Entry Types of this section.
We can use 2 function file_get_contents
and file_put_contents
to RCE as below:
Payload:
Access /shell.php to execute command:
Impact: Code execution
Last updated