Headline
Xenforo 2.2.15 Remote Code Execution
XenForo versions 2.2.15 and below suffer from a remote code execution vulnerability in the Template system.
-----------------------------------------------------------------------XenForo <= 2.2.15 (Template System) Remote Code Execution Vulnerability-----------------------------------------------------------------------[-] Software Link:https://xenforo.com[-] Affected Versions:Version 2.2.15 and prior versions.[-] Vulnerability Description:XenForo implements a template system which gives complete control overthe layout of XenForo pages. Through these templates, it might bepossible to call certain "callback methods", however there is a sortof "sandbox" which allows to solely call read-only methods: a methodis to be considered read-only when it begins with one of the allowedprefixes, such as "get" or "filter". Malicious users might be able tobypass this "sandbox" by abusing the getRepository() method from theXF\Mvc\Entity\Manager class in order to get an instance object of theXF\Util\Arr class, and from there they can abuse its filterRecursive()static method in order to execute arbitrary callbacks or functions(internally, this method calls the array_filter() PHP function with anattacker-controlled "callback" parameter). As such, this can beexploited to e.g. execute arbitrary OS commands by using a payloadlike the following within a template, which will try to execute thepassthru() PHP function passing to it the string "whoami" as argument,potentially resulting in the execution of the "whoami" command on theweb server:{{ $xf.app.em.getRepository('XF\Util\Arr').filterRecursive(['whoami'],'passthru')}}Successful exploitation of this vulnerability requires an account withpermissions to administer styles or widgets.[-] Solution:Update to a fixed version or apply the vendor patches.[-] Disclosure Timeline:[22/02/2024] - Vulnerability details sent to SSD Secure Disclosure[05/06/2024] - Vendor released patches and fixed versions[14/06/2024] - CVE identifier requested[16/06/2024] - CVE identifier assigned[16/07/2024] - Coordinated public disclosure[-] CVE Reference:The Common Vulnerabilities and Exposures project (cve.mitre.org) hasassigned the name CVE-2024-38458 to this vulnerability.[-] Credits:Vulnerability discovered by Egidio Romano.[-] Other References:https://xenforo.com/community/threads/222133https://ssd-disclosure.com/ssd-advisory-xenforo-rce-via-csrf/[-] Original Advisory:http://karmainsecurity.com/KIS-2024-06