Miggo Logo

CVE-2021-3702: ansible-runner vulnerable to Race Condition

6.3

CVSS Score
3.1

Basic Information

EPSS Score
0.11913%
Published
8/24/2022
Updated
11/26/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
ansible-runnerpip>= 2.0.0, < 2.1.02.1.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from insecure temporary directory handling. The pre-patch code in StreamWorker's init method used tempfile.TemporaryDirectory().name, which creates a directory that is immediately deleted when the TemporaryDirectory object is garbage collected. This created a race condition window where an attacker could replace the directory. The fix in commit 93e95a3 replaced this with mkdtemp() (which creates persistent unique directories) and removed the unsafe cleanup pattern. The GitHub PR #742/commits explicitly references this race condition fix in the StreamWorker initialization logic.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

* r*** *on*ition *l*w w*s *oun* in *nsi*l*-runn*r, w**r* *n *tt**k*r *oul* w*t** *or r*pi* *r**tion *n* **l*tion o* * t*mpor*ry *ir**tory, su*stitut* t**ir *ir**tory *t t**t n*m*, *n* t**n **v* ****ss to *nsi*l*-runn*r's priv*t*_**t*_*ir t** n*xt tim

Reasoning

T** vuln*r**ility st*ms *rom ins**ur* t*mpor*ry *ir**tory **n*lin*. T** pr*-p*t** *o** in Str**mWork*r's __init__ m*t*o* us** t*mp*il*.T*mpor*ry*ir**tory().n*m*, w*i** *r**t*s * *ir**tory t**t is imm**i*t*ly **l*t** w**n t** T*mpor*ry*ir**tory o*j**t