CVE-2018-20465 in Craftinfo

Summary

by MITRE

Craft CMS through 3.0.34 allows remote authenticated administrators to read sensitive information via server-side template injection, as demonstrated by a {% string for craft.app.config.DB.user and craft.app.config.DB.password in the URI Format of the Site Settings, which causes a cleartext username and password to be displayed in a URI field.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 04/24/2020

This vulnerability exists in Craft CMS versions 3.0.34 and earlier, where authenticated administrators can exploit a server-side template injection flaw to access sensitive database credentials. The vulnerability specifically manifests when an attacker with administrative privileges manipulates the URI format field in site settings, allowing them to inject template code that references craft.app.config.DB.user and craft.app.config.DB.password. This injection occurs within the template processing system, which executes the malicious code and outputs the cleartext database credentials directly into the URI field, creating a significant information disclosure risk. The flaw represents a critical security weakness in the content management system's template handling mechanism, as it allows authenticated users to bypass normal access controls and extract sensitive configuration data that should remain protected within the application's internal structures.

The technical implementation of this vulnerability leverages Craft CMS's template injection capabilities, where user-controlled input in the URI format field is processed through the template engine without proper sanitization or escaping mechanisms. When the system processes the malicious template code, it executes the craft.app.config.DB.user and craft.app.config.DB.password variables, which are part of the application's internal configuration system. This particular pattern of exploitation demonstrates a classic server-side template injection vulnerability that allows attackers to access internal application variables and configuration data. The vulnerability operates under CWE-94, which covers "Improper Control of Generation of Code ('Code Injection')" and specifically relates to template injection scenarios where untrusted input is processed through template engines without adequate sanitization. The exploitation requires only an authenticated administrative account, making it particularly dangerous as it bypasses network-level security controls and operates within the legitimate administrative context of the application.

The operational impact of this vulnerability extends beyond simple information disclosure, as the extracted database credentials can be used for lateral movement within the application environment and potentially for privilege escalation attacks. An attacker who successfully exploits this vulnerability gains access to database connection details that could be used to directly access the underlying database, potentially leading to data breaches, unauthorized modifications, or complete system compromise. The cleartext exposure of database credentials violates fundamental security principles and creates a persistent threat vector that remains viable even after the initial exploitation attempt. This vulnerability aligns with ATT&CK technique T1566.002, which covers "Phishing for Information" and "Credential Access" through the exploitation of application-level vulnerabilities that allow for the extraction of sensitive authentication data. The impact is particularly severe because it affects the core configuration management system of the CMS, potentially exposing all database connection parameters that could be used to access sensitive user data, content repositories, and system configurations.

Organizations should immediately implement the available security patches for Craft CMS 3.0.35 and later versions to address this vulnerability. The recommended mitigation strategies include applying the official security updates, implementing strict input validation for all user-controlled template fields, and establishing monitoring for unusual administrative activities that might indicate exploitation attempts. Additionally, organizations should review their administrative access controls and implement principle of least privilege principles to limit the number of users with administrative privileges. Regular security assessments of template processing systems and configuration management interfaces should be conducted to identify similar vulnerabilities in other applications. Network segmentation and database access controls should be strengthened to limit the potential impact of credential exposure, ensuring that even if database credentials are compromised, lateral movement within the network is restricted. The vulnerability also highlights the importance of proper template engine security configurations and the need for comprehensive security testing of all application components that process user input through template systems to prevent similar injection attacks from occurring in other software components.

Reservation

12/25/2018

Disclosure

12/25/2018

Moderation

accepted

CPE

ready

EPSS

0.00664

KEV

no

Activities

very low

Sources

Do you need the next level of professionalism?

Upgrade your account now!