CVE-2021-3939

7.8 HIGH

📋 TL;DR

This CVE describes a double-free memory corruption vulnerability in Ubuntu's accountsservice. Attackers can exploit this via the SetLanguage D-Bus function to potentially execute arbitrary code or crash the service. Only Ubuntu systems with specific versions of accountsservice are affected.

💻 Affected Systems

Products:
  • accountsservice
Versions: Ubuntu-specific versions before 0.6.55-0ubuntu12~20.04.5, 0.6.55-0ubuntu13.3, 0.6.55-0ubuntu14.1
Operating Systems: Ubuntu Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Ubuntu due to specific patch modifications. Requires D-Bus access to exploit.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with root privileges leading to complete system compromise.

🟠

Likely Case

Service crash causing denial of service and potential privilege escalation.

🟢

If Mitigated

Limited to denial of service if exploit fails or system has additional protections.

🌐 Internet-Facing: MEDIUM - Requires D-Bus access which may be exposed in some configurations.
🏢 Internal Only: HIGH - Internal attackers with D-Bus access can exploit this vulnerability.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploit requires D-Bus access. Public exploit code exists in Packet Storm references.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.6.55-0ubuntu12~20.04.5, 0.6.55-0ubuntu13.3, or 0.6.55-0ubuntu14.1

Vendor Advisory: https://ubuntu.com/security/notices/USN-5149-1

Restart Required: Yes

Instructions:

1. Update package: sudo apt update && sudo apt install accountsservice
2. Restart affected services: sudo systemctl restart accounts-daemon
3. Verify version with: dpkg -l accountsservice

🔧 Temporary Workarounds

Restrict D-Bus Access

linux

Limit D-Bus access to accountsservice to prevent exploitation

sudo systemctl edit accounts-daemon
Add: [Service]
RestrictRealtime=yes
NoNewPrivileges=yes

Disable SetLanguage Function

linux

Block the vulnerable D-Bus method via policy

Create /etc/dbus-1/system.d/accountsservice-block.conf with:
<policy context="default">
  <deny send_destination="org.freedesktop.Accounts"
        send_interface="org.freedesktop.Accounts.User"
        send_member="SetLanguage"/>
</policy>
sudo systemctl reload dbus

🧯 If You Can't Patch

  • Implement strict network segmentation to limit D-Bus access
  • Monitor for exploitation attempts via D-Bus logs and system crashes

🔍 How to Verify

Check if Vulnerable:

Check accountsservice version: dpkg -l | grep accountsservice

Check Version:

dpkg -l accountsservice | grep ^ii | awk '{print $3}'

Verify Fix Applied:

Verify version is 0.6.55-0ubuntu12~20.04.5 or higher for Ubuntu 20.04, 0.6.55-0ubuntu13.3 or higher for Ubuntu 21.10, or 0.6.55-0ubuntu14.1 or higher for Ubuntu 22.04

📡 Detection & Monitoring

Log Indicators:

  • Multiple free() calls in accountsservice logs
  • D-Bus SetLanguage method calls from unusual sources
  • accountsservice crashes or segmentation faults

Network Indicators:

  • Unusual D-Bus traffic to accounts-daemon
  • Multiple SetLanguage method calls

SIEM Query:

process.name="accounts-daemon" AND (event.action="segmentation fault" OR log.message="*free*" OR log.message="*corruption*")

🔗 References

📤 Share & Export