Skip to main content

CVE-2021-22945: Double Free (CWE-415) in https://github.com/curl/curl

Critical
VulnerabilityCVE-2021-22945cvecve-2021-22945cwe-415
Published: Thu Sep 23 2021 (09/23/2021, 00:00:00 UTC)
Source: CVE Database V5
Vendor/Project: n/a
Product: https://github.com/curl/curl

Description

When sending data to an MQTT server, libcurl <= 7.73.0 and 7.78.0 could in some circumstances erroneously keep a pointer to an already freed memory area and both use that again in a subsequent call to send data and also free it *again*.

AI-Powered Analysis

AILast updated: 07/10/2025, 19:05:27 UTC

Technical Analysis

CVE-2021-22945 is a critical double free vulnerability (CWE-415) found in libcurl versions 7.73.0 through 7.78.0. Libcurl is a widely used client-side URL transfer library supporting numerous protocols, including MQTT, which is a lightweight messaging protocol often used in IoT and messaging applications. This vulnerability arises when libcurl sends data to an MQTT server: under certain conditions, the library erroneously retains a pointer to a memory area that has already been freed. Subsequently, libcurl attempts to use this stale pointer to send data again and also frees the memory a second time. This double free can lead to undefined behavior, including memory corruption, application crashes, or potentially arbitrary code execution if exploited. The vulnerability does not require any privileges or user interaction and can be triggered remotely by sending crafted data to an MQTT server that a vulnerable client connects to. The CVSS v3.1 base score is 9.1, indicating a critical severity with network attack vector, low attack complexity, no privileges required, no user interaction, and high impact on confidentiality and availability. Although no known exploits are reported in the wild, the nature of the vulnerability and the widespread use of libcurl make it a significant threat. The absence of patch links suggests users should upgrade to versions beyond 7.78.0 where this issue is fixed. Given libcurl’s extensive use in many software products and IoT devices, this vulnerability could be leveraged to disrupt services or compromise systems that rely on MQTT communications.

Potential Impact

For European organizations, the impact of CVE-2021-22945 can be substantial, especially for those utilizing MQTT-based messaging in IoT deployments, industrial control systems, or cloud services that incorporate libcurl for data transfer. Exploitation could lead to denial of service through application crashes or potentially allow attackers to execute arbitrary code, compromising confidentiality and availability of critical systems. This is particularly concerning for sectors such as manufacturing, energy, healthcare, and telecommunications, where MQTT is commonly used for device telemetry and control. Disruption or compromise of these systems could result in operational downtime, data breaches, or safety risks. Additionally, since libcurl is embedded in many software products, the vulnerability could propagate through supply chains, affecting a broad range of applications and services across Europe. The critical CVSS score underscores the urgency for organizations to assess their exposure and remediate promptly to prevent exploitation.

Mitigation Recommendations

European organizations should take the following specific actions to mitigate CVE-2021-22945: 1) Inventory all software and devices that use libcurl, focusing on versions 7.73.0 through 7.78.0, especially those handling MQTT communications. 2) Upgrade libcurl to the latest stable version beyond 7.78.0 where the vulnerability is patched. 3) For embedded or third-party products that incorporate libcurl, coordinate with vendors to obtain patched versions or apply vendor-provided mitigations. 4) Implement network-level controls to monitor and restrict MQTT traffic to trusted sources, reducing exposure to malicious MQTT servers or crafted payloads. 5) Employ runtime protections such as memory corruption mitigations (e.g., ASLR, DEP) to reduce exploitation success. 6) Conduct targeted penetration testing and fuzzing on MQTT communication components to identify residual vulnerabilities. 7) Maintain robust incident detection capabilities to identify unusual crashes or memory corruption events that may indicate exploitation attempts. These steps go beyond generic patching advice by emphasizing supply chain awareness, network segmentation, and proactive detection tailored to MQTT and libcurl usage contexts.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
hackerone
Date Reserved
2021-01-06T00:00:00.000Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 68487f5e1b0bd07c3938feff

Added to database: 6/10/2025, 6:54:22 PM

Last enriched: 7/10/2025, 7:05:27 PM

Last updated: 8/15/2025, 3:23:55 AM

Views: 16

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats