CVE-2022-1804

5.5 MEDIUM

📋 TL;DR

CVE-2022-1804 is a privilege escalation vulnerability in accountsservice where the service fails to drop elevated permissions when writing to .pam_environment files. This allows local attackers to write arbitrary content to user-specific environment files, potentially leading to privilege escalation. Affected systems are Linux distributions using accountsservice, particularly Ubuntu.

💻 Affected Systems

Products:
  • accountsservice
Versions: Versions before 22.07.5-2ubuntu1.3 (Ubuntu 22.04), before 0.6.55-0ubuntu12~20.04.5 (Ubuntu 20.04), and other distributions with vulnerable versions.
Operating Systems: Linux distributions using accountsservice, particularly Ubuntu
Default Config Vulnerable: ⚠️ Yes
Notes: Requires accountsservice to be running and accessible to local users.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Local attacker gains root privileges by manipulating environment files to execute arbitrary code with elevated permissions.

🟠

Likely Case

Local user modifies another user's environment configuration to gain unauthorized access or disrupt operations.

🟢

If Mitigated

Attack limited to environment file manipulation without direct privilege escalation if proper file permissions are enforced.

🌐 Internet-Facing: LOW - Requires local access to the system.
🏢 Internal Only: MEDIUM - Internal users with local access could exploit this for privilege escalation.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires local access and understanding of pam_environment file manipulation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: accountsservice 22.07.5-2ubuntu1.3 for Ubuntu 22.04, 0.6.55-0ubuntu12~20.04.5 for Ubuntu 20.04

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

Restart Required: No

Instructions:

1. Update package: sudo apt update && sudo apt install accountsservice. 2. Verify version matches patched version.

🔧 Temporary Workarounds

Restrict accountsservice permissions

linux

Limit accountsservice access through systemd or permissions to reduce attack surface.

sudo systemctl mask accountsservice
sudo chmod 600 /etc/pam.d/*

🧯 If You Can't Patch

  • Monitor and audit .pam_environment file modifications for suspicious activity.
  • Implement strict user privilege separation and limit local user access where possible.

🔍 How to Verify

Check if Vulnerable:

Check accountsservice version: dpkg -l | grep accountsservice

Check Version:

dpkg -l | grep accountsservice

Verify Fix Applied:

Verify installed version matches patched version from vendor advisory.

📡 Detection & Monitoring

Log Indicators:

  • Unusual modifications to .pam_environment files in user home directories
  • Accountsservice process spawning unexpected file writes

Network Indicators:

  • None - local exploit only

SIEM Query:

source="syslog" AND "accountsservice" AND ("write" OR "modify") AND ".pam_environment"

🔗 References

📤 Share & Export