Miggo Logo

CVE-2022-27815: Insecure Temporary File in SWHKD

9.1

CVSS Score
3.1

Basic Information

EPSS Score
0.46035%
Published
3/31/2022
Updated
1/27/2023
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
Simple-Wayland-HotKey-Daemonrust< 1.2.01.2.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the insecure use of /tmp/swhkd.pid path in the main() function of daemon.rs. The commit diff shows the PID file path was modified from '/tmp/swhkd.pid' to a user-specific '/etc/swhkd/runtime' location. The main() function's PID file handling (existence check, read/write operations) using a world-writable /tmp location made it vulnerable to race conditions and symlink attacks. The direct modification of this path in the patch confirms this was the vulnerable code section.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

SW*K* is * *ispl*y proto*ol-in**p*n**nt *otk*y ***mon m*** in Rust. In SW*K* v*rsions *.*.* *n* prior, SW*K* us*s t** /tmp/sw*k*.pi* p*t*n*m*. *s /tmp is ****ssi*l* to *ll us*rs, t**r* **n ** *n in*orm*tion l**k or **ni*l o* s*rvi**. No known work*ro

Reasoning

T** vuln*r**ility st*ms *rom t** ins**ur* us* o* `/tmp/sw*k*.pi*` p*t* in t** `m*in()` *un*tion o* `***mon.rs`. T** *ommit *i** s*ows t** PI* *il* p*t* w*s mo*i*i** *rom '/tmp/sw*k*.pi*' to * us*r-sp**i*i* '/*t*/sw*k*/runtim*' lo**tion. T** `m*in()`