CVE-2021-36162 Overview
Apache Dubbo, a high-performance RPC framework, contains an insecure deserialization vulnerability in its YAML configuration parsing functionality. The framework supports various rules for configuration override and traffic routing that are stored in configuration centers such as Zookeeper and Nacos. When parsing these YAML rules, Dubbo consumers use the SnakeYAML library with default settings that enable calling arbitrary constructors, allowing attackers with access to the configuration center to achieve remote code execution on all consuming services.
Critical Impact
An attacker who gains access to the configuration center can poison routing rules, resulting in remote code execution across all Dubbo consumer services retrieving those configurations.
Affected Products
- Apache Dubbo versions prior to 2.7.13
- Apache Dubbo versions prior to 3.0.2
Discovery Timeline
- 2021-09-07 - CVE-2021-36162 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2021-36162
Vulnerability Analysis
This vulnerability is classified as an insecure deserialization flaw affecting Apache Dubbo's configuration handling mechanism. The root issue lies in how Dubbo consumers process YAML-based routing and configuration rules retrieved from centralized configuration stores.
Apache Dubbo's architecture relies on configuration centers (Zookeeper, Nacos, Apollo, etc.) to distribute routing rules and configuration overrides to service consumers. When a consumer retrieves these rules, it deserializes the YAML content using the SnakeYAML library. The vulnerability exists because SnakeYAML's default configuration permits the instantiation of arbitrary Java classes through YAML type tags, a feature that can be weaponized for remote code execution.
The attack requires network access and authenticated access to the configuration center. Once an attacker has write access to the configuration store, they can inject malicious YAML payloads that execute arbitrary code when parsed by any Dubbo consumer retrieving those rules.
Root Cause
The vulnerability stems from SnakeYAML's default behavior of allowing arbitrary constructor invocation through YAML type tags. When processing YAML documents, SnakeYAML supports a syntax like !!com.example.ClassName that instructs the parser to instantiate objects of the specified class. Without proper restrictions on which classes can be instantiated, an attacker can craft YAML payloads that trigger execution of dangerous constructors, such as those in javax.script.ScriptEngineManager or similar gadget chains.
Apache Dubbo's YAML parsing implementation did not implement a SafeConstructor or type filtering mechanism, leaving the deserialization process vulnerable to exploitation through poisoned configuration rules.
Attack Vector
The attack vector follows a supply-chain pattern targeting distributed systems infrastructure:
- Initial Access: The attacker gains access to the configuration center (Zookeeper, Nacos, etc.) through compromised credentials, network intrusion, or insider access
- Payload Injection: The attacker modifies existing routing rules or creates new ones containing malicious YAML type tags designed to instantiate dangerous Java classes
- Distributed Execution: When Dubbo consumers retrieve configuration updates from the configuration center, the malicious YAML is parsed and the exploit payload executes
- Mass Compromise: Since all consumers pulling from the same configuration source process the same rules, a single poisoned entry can compromise multiple service instances simultaneously
This attack is particularly dangerous in microservices environments where configuration centers serve hundreds or thousands of service instances, enabling rapid lateral movement and widespread compromise from a single point of entry.
Detection Methods for CVE-2021-36162
Indicators of Compromise
- Unexpected YAML type tags (e.g., !!javax.script.ScriptEngineManager) in configuration center entries
- Unusual process spawning or network connections from Dubbo consumer applications
- Modifications to routing rules in Zookeeper, Nacos, or other configuration stores by unauthorized accounts
- Java deserialization-related exceptions in application logs alongside suspicious constructor invocations
Detection Strategies
- Monitor configuration center audit logs for unauthorized write operations to Dubbo routing rules
- Implement content inspection for YAML documents containing !! type tag syntax in configuration entries
- Deploy runtime application self-protection (RASP) solutions to detect and block suspicious class instantiation
- Use SentinelOne's behavioral AI to identify anomalous process execution patterns from Java applications
Monitoring Recommendations
- Enable comprehensive audit logging on all configuration centers (Zookeeper ACLs, Nacos access logs)
- Implement alerting for any modifications to Dubbo routing or configuration override rules
- Monitor for outbound network connections or process spawning from Dubbo consumer service accounts
- Track SnakeYAML-related error messages and stack traces indicating potential exploitation attempts
How to Mitigate CVE-2021-36162
Immediate Actions Required
- Upgrade Apache Dubbo to version 2.7.13 or later for the 2.x branch
- Upgrade Apache Dubbo to version 3.0.2 or later for the 3.x branch
- Audit configuration center access controls and revoke unnecessary write permissions
- Review existing routing rules for suspicious YAML content containing type tags
Patch Information
Apache has addressed this vulnerability in Dubbo versions 2.7.13 and 3.0.2. The fix restricts SnakeYAML's class instantiation capabilities to prevent arbitrary constructor invocation during YAML parsing. Organizations should review the Apache Dubbo Development Thread for detailed information about the security update.
Workarounds
- Implement strict network segmentation to limit access to configuration centers
- Deploy authentication and authorization controls on Zookeeper/Nacos with least-privilege principles
- Consider implementing a configuration validation layer that rejects YAML documents containing type tags
- Use firewall rules to restrict which hosts can write to configuration center nodes
# Example: Restrict Zookeeper ACLs for Dubbo configuration paths
# Create a digest authentication scheme for Dubbo config paths
zkCli.sh -server localhost:2181
setAcl /dubbo/config digest:dubbo_user:encrypted_password:cdrwa
setAcl /dubbo/config ip:10.0.0.0/8:r
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

