Miggo Logo

CVE-2021-36753: Uncontrolled Search Path Element in sharkdp/bat

7.8

CVSS Score
3.1

Basic Information

EPSS Score
0.41864%
Published
8/25/2021
Updated
2/3/2023
KEV Status
No
Technology
TechnologyRust

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stemmed from using Rust's std::process::Command::new with unvalidated paths. On Windows, this API searches the current working directory before system paths. The pre-patch code in both less.rs (retrieve_less_version) and output.rs (pager setup) directly passed paths to Command::new, making them vulnerable to DLL hijacking. The fix introduced grep_cli::resolve_binary to properly resolve paths, confirming these were the vulnerable points. The confidence is high as the patch directly modifies these functions and the commit message explicitly references this security fix.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

**t on win*ows ***or* *.**.* *x**ut*s pro*r*ms n*m** l*ss.*x* *rom t** *urr*nt workin* *ir**tory. T*is **n l*** to unint*n*** *o** *x**ution.

Reasoning

T** vuln*r**ility st*mm** *rom usin* Rust's st*::pro**ss::*omm*n*::n*w wit* unv*li**t** p*t*s. On Win*ows, t*is *PI s**r***s t** *urr*nt workin* *ir**tory ***or* syst*m p*t*s. T** pr*-p*t** *o** in *ot* l*ss.rs (r*tri*v*_l*ss_v*rsion) *n* output.rs (