CVE-2012-5577
📋 TL;DR
Python keyring library versions before 0.10 created keyring files with world-readable permissions (0666), allowing any user on the system to read stored passwords and credentials. This affects any system using vulnerable versions of python-keyring to store sensitive data.
💻 Affected Systems
- python-keyring
📦 What is this software?
Keyring by Python
⚠️ Risk & Real-World Impact
Worst Case
Full credential compromise of all users on the system, leading to privilege escalation, data theft, and lateral movement within the environment.
Likely Case
Unauthorized users reading stored passwords and API keys, potentially compromising associated services and accounts.
If Mitigated
Limited impact if proper file permissions are manually set or if keyring files contain no sensitive data.
🎯 Exploit Status
Exploitation requires local user access to read the world-readable keyring files. No special tools or techniques needed beyond standard file reading.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 0.10 and later
Vendor Advisory: https://bitbucket.org/kang/python-keyring-lib/commits/049cd181470f1ee6c540e1d64acf1def7b1de0c1
Restart Required: No
Instructions:
1. Upgrade python-keyring to version 0.10 or later using pip: 'pip install --upgrade keyring>=0.10' 2. Verify the new version creates keyring files with proper permissions (0600).
🔧 Temporary Workarounds
Manual permission fix
linuxManually set proper permissions on existing keyring files
chmod 600 ~/.local/share/python_keyring/keyring_pass.cfg
chmod 600 ~/.local/share/python_keyring/keyring.cfg
Alternative storage backend
allUse a different keyring backend that doesn't create world-readable files
pip install keyrings.alt
Configure to use SecretService, KWallet, or other secure backend
🧯 If You Can't Patch
- Manually set file permissions on all keyring files to 0600
- Move keyring files to a directory with restricted access permissions
🔍 How to Verify
Check if Vulnerable:
Check keyring file permissions: 'ls -la ~/.local/share/python_keyring/*.cfg' - if files show -rw-rw-rw- (0666), system is vulnerable
Check Version:
python -c "import keyring; print(keyring.__version__)"
Verify Fix Applied:
After upgrade, verify new keyring files are created with -rw------- (0600) permissions
📡 Detection & Monitoring
Log Indicators:
- Unusual file access patterns to keyring configuration files
Network Indicators:
- None - this is a local file system vulnerability
SIEM Query:
File monitoring for read access to ~/.local/share/python_keyring/keyring*.cfg from non-owner users
🔗 References
- http://www.openwall.com/lists/oss-security/2012/11/27/3
- https://bitbucket.org/kang/python-keyring-lib/commits/049cd181470f1ee6c540e1d64acf1def7b1de0c1
- https://bitbucket.org/kang/python-keyring-lib/issue/67/set-go-rwx-on-keyring_passcfg
- https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-5577
- https://security-tracker.debian.org/tracker/CVE-2012-5577
- http://www.openwall.com/lists/oss-security/2012/11/27/3
- https://bitbucket.org/kang/python-keyring-lib/commits/049cd181470f1ee6c540e1d64acf1def7b1de0c1
- https://bitbucket.org/kang/python-keyring-lib/issue/67/set-go-rwx-on-keyring_passcfg
- https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-5577
- https://security-tracker.debian.org/tracker/CVE-2012-5577