CVE-2026-87874 in Ansible Community General Collectioninfo

Summary

by MITRE • 09/09/2026

A flaw was found in the memcached cache plugin of the community.general Ansible collection. Although its documentation states that records are stored in JSON format, the plugin performs no explicit serialization and relies on python-memcached, which pickles values on write and unpickles them on read. Because memcached is unauthenticated and cache keys are predictable, an attacker able to reach a network-exposed or shared memcached instance can write a crafted pickle payload that is deserialized and executed on the Ansible controller when the poisoned fact cache is next read, leading to remote code execution.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 09/09/2026

The vulnerability identified in the community.general Ansible collection involves a critical security flaw within its memcached cache plugin implementation. The core issue stems from a discrepancy between documented behavior and actual technical execution regarding data serialization. While official documentation indicates that records are stored using JSON format, which is inherently safe for untrusted environments due to being a simple text-based interchange format, the underlying code relies on the python-memcached library without implementing explicit JSON serialization or deserialization logic. Instead, the plugin defaults to Python's native pickle protocol when writing and reading data from the memcached server. This reliance on pickle introduces severe risks because the pickle module is not secure against maliciously constructed payloads; it allows for arbitrary object instantiation during the unpickling process, which can be exploited to execute arbitrary code on the host system where the deserialization occurs.

The operational impact of this vulnerability is significant due to the specific characteristics of memcached deployments and Ansible's architecture. Memcached instances are frequently deployed without authentication mechanisms by default, making them accessible to any client that can reach the network segment or shared infrastructure hosting the cache. Furthermore, Ansible often uses predictable patterns for cache keys based on hostnames or inventory groups. This predictability allows an attacker who has access to the memcached instance to craft specific pickle payloads and inject them into known key locations within the cache. When the Ansible controller subsequently attempts to read these cached facts to optimize playbook execution, it triggers the unpickling process. Because the data was maliciously crafted by the attacker rather than generated internally by a trusted source, the Python interpreter processes the payload as executable code, resulting in remote code execution on the Ansible control node with the privileges of the user running the ansible command or service.

From a classification perspective, this vulnerability aligns closely with CWE-502, which describes Deserialization of Untrusted Data. The flaw represents a classic case where an application assumes that data stored in an external store is safe to deserialize without validation or sanitization. In terms of offensive security frameworks, the exploitation path maps directly to MITRE ATT&CK technique T1059, specifically Command and Scripting Interpreter sub-techniques such as Python (T1059.006). The attacker leverages the deserialization mechanism not merely for data theft but for initial code execution, which can serve as a foothold for further lateral movement within the infrastructure. This is particularly dangerous in DevOps environments where Ansible controllers often possess high-level privileges to manage servers and deploy configurations across multiple nodes.

Mitigation strategies must address both the immediate technical flaw and broader architectural risks. The most effective remediation is to upgrade the community.general collection to a version that explicitly implements JSON serialization for memcached cache storage, thereby eliminating the use of pickle entirely. If upgrading is not immediately feasible, administrators should disable the memcached fact cache plugin in favor of safer alternatives such as file-based caching or Redis with proper authentication and encryption enabled. Additionally, network segmentation policies must be enforced to ensure that memcached instances are never exposed to untrusted networks or public internet interfaces. Access control lists on firewall rules should restrict connectivity to only authorized Ansible controller IPs. Regular auditing of cache plugins and strict adherence to secure coding practices regarding data serialization in external storage systems are essential preventive measures against similar deserialization vulnerabilities in automation infrastructure.

Responsible

Redhat

Reservation

09/09/2026

Disclosure

09/09/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

low

Sources

Interested in the pricing of exploits?

See the underground prices here!