CVE-2018-4041
An exploitable privilege escalation vulnerability exists in the helper service of Clean My Mac X, version 4.04, due to improper input validation. An attacker with local access could exploit this vulnerability to modify the file system as root.
Clean My Mac X 4.04
7.1 - CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N
CWE-19: Improper Input Validation
CleanMyMac X is an all-in-one cleanup and optimization tool for the Mac operating system. The application is able to scan the system and user directories, looking for unused and leftover files and applications. The applications also markets the ability to help detect and prevent viruses and malware on OS X. The software utilizes a privilege helper tool running as root to get this work done faster. This allows the application to remove and modify system files.
The vulnerability lies in the enableLaunchdAgentAtPath
function of the helper protocol. The code for this function is:
user_input = objc_retain(arg_3);
v9 = +[CMLaunchdManager enableAgentAtPath:](&OBJC_CLASS___CMLaunchdManager, "enableAgentAtPath:", user_input, ret); [0]
objc_release(user_input);
At location [0], the process passes user input directly into enableAgentAtPath
, which simply calls launchtl
and loads the script from the provided location. To be properly loaded, an agent must be run from a root configuration file. However, the ability to launch any root configuration file on the system still crosses a privilege boundary. There is no validation of the calling application, therefore, any application is able to access this function. This crosses a privilege boundary, allowing non-root users to install launchd
scripts as root.
Included with this advisory is an Xcode project, as well as a Python script. The Python script needs an administrator’s password to set up some root files on the system to demonstrate the vulnerabilities. The Xcode project contains the proof of concept.
2018-11-20 - Vendor Disclosure
2018-12-27 - Vendor Patched
2019-01-02 - Public Release
Discovered by Tyler Bohan of Cisco Talos.