Monday, March 17, 2025
HomeCVE/vulnerabilityWazuh SIEM Vulnerability Enables Remote Malicious Code Execution

Wazuh SIEM Vulnerability Enables Remote Malicious Code Execution

Published on

SIEM as a Service

Follow Us on Google News

A critical vulnerability, identified as CVE-2025-24016, has been discovered in the Wazuh Security Information and Event Management (SIEM) platform.

This vulnerability affects versions 4.4.0 to 4.9.0 and allows attackers with API access to execute arbitrary Python code remotely, potentially leading to complete system compromise.

The flaw stems from the unsafe deserialization of Distributed API (DAPI) parameters, which are used for communication between Wazuh components, as per the report by CVE reports.

Vulnerability Details

The following table highlights the key details about the CVE-2025-24016 vulnerability and the affected Wazuh products:

CVE IDAffected SoftwareVersionsVulnerability TypeSeverity (CVSSv3.1)Patch Version
CVE-2025-24016Wazuh SIEM Platform4.4.0 to 4.9.0Remote Code Execution (RCE)9.9 (Critical)4.9.1

The vulnerability resides in the as_wazuh_object function within the framework/wazuh/core/cluster/common.py file.

This function is responsible for deserializing JSON data received through the Distributed API. The problematic code snippet before the patch is shown below:

def as_wazuh_object(dct: Dict):
    try:
        if '__wazuh_datetime__' in dct:
            return datetime.datetime.fromisoformat(dct['__wazuh_datetime__'])
        elif '__unhandled_exc__' in dct:
            exc_data = dct['__unhandled_exc__']
            return eval(exc_data['__class__'])(*exc_data['__args__'])
        return dct
    except (KeyError, AttributeError):
        return dct

This code uses the eval function to execute arbitrary Python code based on data provided in the __class__ and __args__ fields, making it a prime target for exploitation.

Impact and Exploitation

An attacker can exploit this vulnerability by sending a malicious JSON payload to the Wazuh server through the API.

The payload must contain the __unhandled_exc__ key, along with the __class__ and __args__ values that specify the code to be executed. For example:

{
    "__unhandled_exc__": {
        "__class__": "os.system",
        "__args__": ["touch /tmp/pwned"]
    }
}

When processed by the as_wazuh_object function, this payload would execute the command os.system(“touch /tmp/pwned”), creating a file named /tmp/pwned on the Wazuh server.

Patch and Mitigation

The vulnerability was patched in Wazuh version 4.9.1 by replacing the unsafe eval function with ast.literal_eval.

The latter safely evaluates a string containing a Python literal, preventing arbitrary code execution. Here’s the modified code snippet:

def as_wazuh_object(dct: Dict):
    try:
        if '__wazuh_datetime__' in dct:
            return datetime.datetime.fromisoformat(dct['__wazuh_datetime__'])
        elif '__unhandled_exc__' in dct:
            exc_data = dct['__unhandled_exc__']
            exc_dict = {exc_data['__class__']: exc_data['__args__']}
            return ast.literal_eval(json.dumps(exc_dict))
        return dct
    except (KeyError, AttributeError):
        return dct

Mitigation Strategies

To mitigate the risk of CVE-2025-24016, organizations should:

  • Upgrade to Wazuh version 4.9.1 or later.
  • Restrict API access to authorized users and systems.
  • Implement strong authentication mechanisms, such as multi-factor authentication.
  • Monitor API traffic for suspicious activity.
  • Regularly review and update security configurations.
  • Implement network segmentation to limit the impact of a successful attack.

Using a Web Application Firewall (WAF) can also help detect and block malicious requests before they reach the Wazuh server.

The exploitation of CVE-2025-24016 can have severe consequences, including:

  • Complete control of the Wazuh server: Allowing attackers to access sensitive data and modify configurations.
  • Compromise of the entire Wazuh cluster: By gaining control of the master server.
  • Disruption of security monitoring: Enabling attackers to carry out further attacks undetected.
  • Theft of sensitive data: Accessing logs, alerts, and other data stored on the server.
  • Using the Wazuh server for further attacks: Serving as a launching pad for lateral movement within the network.

Ensuring timely patching and implementing robust security measures are crucial in preventing such attacks.

Are you from SOC/DFIR Teams? – Analyse Malware Incidents & get live Access with ANY.RUN -> Start Now for Free. 

Divya
Divya
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Latest articles

Hackers Rapidly Adopt ClickFix Technique for Sophisticated Attacks

In recent months, a sophisticated social engineering technique known as ClickFix has gained significant...

Supply Chain Attack Targets 23,000 GitHub Repositories

A critical security incident has been uncovered involving the popular GitHub Action tj-actions/changed-files, which...

Beware! Malware Hidden in Free Word-to-PDF Converters

The FBI has issued a warning about a growing threat involving free file conversion...

MassJacker Clipper Malware Targets Users Installing Pirated Software

A recent investigation has uncovered previously unknown cryptojacking malware, dubbed MassJacker, which primarily targets...

Supply Chain Attack Prevention

Free Webinar - Supply Chain Attack Prevention

Recent attacks like Polyfill[.]io show how compromised third-party components become backdoors for hackers. PCI DSS 4.0’s Requirement 6.4.3 mandates stricter browser script controls, while Requirement 12.8 focuses on securing third-party providers.

Join Vivekanand Gopalan (VP of Products – Indusface) and Phani Deepak Akella (VP of Marketing – Indusface) as they break down these compliance requirements and share strategies to protect your applications from supply chain attacks.

Discussion points

Meeting PCI DSS 4.0 mandates.
Blocking malicious components and unauthorized JavaScript execution.
PIdentifying attack surfaces from third-party dependencies.
Preventing man-in-the-browser attacks with proactive monitoring.

More like this

Hackers Rapidly Adopt ClickFix Technique for Sophisticated Attacks

In recent months, a sophisticated social engineering technique known as ClickFix has gained significant...

Supply Chain Attack Targets 23,000 GitHub Repositories

A critical security incident has been uncovered involving the popular GitHub Action tj-actions/changed-files, which...

Beware! Malware Hidden in Free Word-to-PDF Converters

The FBI has issued a warning about a growing threat involving free file conversion...