CVE-2020-35512 Overview
A use-after-free vulnerability was discovered in D-Bus, the inter-process communication (IPC) system widely used in Linux and Unix-like operating systems. This flaw affects systems where multiple usernames share the same UID, allowing policy rules referencing these usernames to trigger improper memory handling. When exploited, D-Bus may prematurely free heap memory that remains in use by data structures associated with other usernames sharing the UID, potentially leading to system crashes or other undefined behaviors including possible code execution.
Critical Impact
Local attackers with low privileges can exploit this use-after-free condition on systems with shared UIDs to cause denial of service or potentially achieve privilege escalation through memory corruption.
Affected Products
- D-Bus Development branch versions 1.13.16 and earlier
- D-Bus 1.12.x stable branch versions 1.12.18 and earlier
- D-Bus 1.10.x and older branches versions 1.10.30 and earlier
Discovery Timeline
- 2021-02-15 - CVE CVE-2020-35512 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2020-35512
Vulnerability Analysis
This vulnerability is classified as CWE-416 (Use After Free), representing a critical memory safety issue in the D-Bus daemon's handling of policy rules. The flaw specifically manifests when a Linux system is configured with multiple usernames that share the same User ID (UID)—a configuration sometimes used for service accounts or specialized access control scenarios.
When D-Bus processes policy rules that reference usernames with shared UIDs, it incorrectly manages the lifecycle of associated memory structures. The daemon may free heap memory that is still being referenced by data structures tied to other usernames sharing the same UID. This creates a classic use-after-free condition where subsequent operations attempt to access deallocated memory.
The vulnerability requires local access to exploit but does not require user interaction. An attacker with low-level privileges on an affected system could craft specific D-Bus messages or trigger policy rule evaluations that exploit this memory corruption. The potential impacts include confidentiality, integrity, and availability compromises, as successful exploitation could lead to information disclosure from freed memory, arbitrary code execution through controlled memory corruption, or denial of service through system crashes.
Root Cause
The root cause lies in D-Bus's memory management logic when handling policy rules that reference multiple usernames mapped to the same UID. The code fails to properly track reference counts or ownership of shared memory structures, leading to premature deallocation while other components still hold references to the freed memory.
This design flaw stems from an assumption that username-to-UID mappings are one-to-one, which does not account for legitimate configurations where multiple usernames resolve to the same UID. When policy rules iterate through affected usernames, the cleanup logic may free memory associated with what it considers a "duplicate" reference, not recognizing that distinct data structures depend on that memory.
Attack Vector
The attack vector is local, requiring an attacker to have some level of authenticated access to the target system. Exploitation involves:
- Identifying a system configured with multiple usernames sharing the same UID
- Triggering D-Bus policy rule evaluations that reference these shared-UID usernames
- Manipulating the timing or sequence of D-Bus operations to cause the use-after-free condition
- Potentially leveraging the freed memory for further exploitation through heap manipulation techniques
The vulnerability exploits the D-Bus daemon's internal memory handling during policy evaluation. When the daemon processes access control decisions, it iterates through applicable policy rules. On systems with shared UIDs, this iteration can trigger the premature memory deallocation, leaving dangling pointers that subsequent operations may dereference.
For detailed technical analysis, refer to the GitLab DBus Issue Note which documents the specific memory handling flaw.
Detection Methods for CVE-2020-35512
Indicators of Compromise
- Unexpected D-Bus daemon crashes or segmentation faults, particularly on systems with shared UID configurations
- Core dumps from dbus-daemon showing heap corruption or invalid memory access patterns
- System log entries indicating D-Bus service restarts or failures during policy evaluation operations
- Memory corruption errors in audit logs associated with IPC communication failures
Detection Strategies
- Monitor system logs for D-Bus daemon crashes using patterns like dbus-daemon.*segfault or dbus-daemon.*SIGABRT
- Implement file integrity monitoring on D-Bus configuration files to detect policy manipulation attempts
- Deploy memory corruption detection tools such as AddressSanitizer on development or staging systems to identify exploitation attempts
- Use endpoint detection solutions to monitor for unusual D-Bus message patterns or policy evaluation anomalies
Monitoring Recommendations
- Configure centralized logging for all D-Bus daemon events, including service starts, stops, and policy evaluations
- Establish baseline behavior for D-Bus resource usage and alert on anomalous memory consumption patterns
- Review system configurations periodically to identify shared UID mappings that may expose the vulnerability
- Enable kernel audit rules for execve and ptrace system calls associated with D-Bus processes
How to Mitigate CVE-2020-35512
Immediate Actions Required
- Update D-Bus to version 1.12.20 or later for the stable branch, or 1.13.18 or later for the development branch
- Review /etc/passwd and related user databases for configurations where multiple usernames share the same UID
- Where possible, reconfigure systems to eliminate shared UID mappings as a defense-in-depth measure
- Restart the D-Bus daemon after applying patches to ensure the updated code is loaded
Patch Information
Security patches addressing this vulnerability have been released by the freedesktop.org D-Bus project. System administrators should apply updates through their distribution's package management system. For tracking patch availability across distributions, refer to:
Workarounds
- Eliminate shared UID configurations by assigning unique UIDs to each username where operationally feasible
- Review and simplify D-Bus policy rules to minimize references to usernames with potentially shared UIDs
- Implement network segmentation and access controls to limit local access to systems running vulnerable D-Bus versions
- Consider containerization or sandboxing for services dependent on D-Bus to limit exploitation impact
# Check for shared UID configurations
awk -F: '{uid[$3]++; users[$3]=users[$3]" "$1} END {for(u in uid) if(uid[u]>1) print "Shared UID " u ":" users[u]}' /etc/passwd
# Verify installed D-Bus version
dbus-daemon --version | head -1
# After patching, restart D-Bus daemon (distribution-specific)
# systemctl restart dbus
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


