Miggo Logo

CVE-2014-4657: Ansible Remote Code Execution

9.8

CVSS Score
3.1

Basic Information

EPSS Score
0.83845%
Published
5/17/2022
Updated
9/6/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
ansiblepip< 1.5.41.5.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from Ansible's safe_eval function in versions <1.5.4. The pre-patch code (CVE-2014-4657) used insecure regex checks (e.g., checking for 'import' or 'method()' patterns) instead of proper AST validation. The commit 998793f replaced this with an AST-based approach, adding a whitelist of allowed nodes (SAFE_NODES) and blocking dangerous functions (INVALID_CALLS). The original function's lack of these safeguards allowed attackers to craft expressions that bypassed regex checks and execute arbitrary code via unsafe Python constructs.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T** `s***_*v*l` *un*tion in *nsi*l* ***or* *.*.* *o*s not prop*rly r*stri*t t** *o** su*s*t, w*i** *llows r*mot* *tt**k*rs to *x**ut* *r*itr*ry *o** vi* *r**t** instru*tions.

Reasoning

T** vuln*r**ility st*ms *rom *nsi*l*'s `s***_*v*l` *un*tion in v*rsions <*.*.*. T** pr*-p*t** *o** (*V*-****-****) us** ins**ur* r***x ****ks (*.*., ****kin* *or 'import' or 'm*t*o*()' p*tt*rns) inst*** o* prop*r *ST v*li**tion. T** *ommit ******* r*