CVE-2015-1340: LXD vulnerable to Race Condition
8.1
CVSS Score
3.0
Basic Information
CVE ID
GHSA ID
EPSS Score
0.5408%
CWE
Published
5/24/2022
Updated
9/29/2023
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| github.com/lxc/lxd | go | < 0.0.0-20151004155856-19c6961cc101 | 0.0.0-20151004155856-19c6961cc101 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the sequence of operations in doUidshiftIntoContainer's convert closure. The original code used os.Lchown followed by os.Chmod based on a previously obtained FileInfo object from filepath.Walk. This created a race condition where an attacker could replace a legitimate file with a symlink between the stat and chmod operations. The commit fixes this by replacing the vulnerable sequence with a ShiftOwner function that uses file descriptors (via O_PATH) to safely operate on the target file without this race window. The affected functions are clearly identified in the diff showing removal of the unsafe Chmod call and its replacement with the secure ShiftOwner implementation.