Miggo Logo

CVE-2022-48174: There is a stack overflow vulnerability in ash.c:6030 in busybox before 1.35. In the environment...

9.8

CVSS Score
3.1

Basic Information

EPSS Score
0.62751%
Published
8/22/2023
Updated
11/29/2024
KEV Status
No
Technology
-

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The analysis started by fetching content from the BusyBox bug tracker URL provided in the references. This revealed an ASAN stack trace and a patch for the vulnerability (CVE-2022-48174).

  1. The ASAN trace clearly indicated a dynamic-stack-buffer-overflow in the evaluate_string function in shell/math.c. It also showed that evaluate_string was called by ash_arith in shell/ash.c at line 6030.
  2. The CVE description explicitly states the vulnerability is in ash.c:6030.
  3. The fetched patch content (attachment 9446 from the bug report, corresponding to an early fix attempt bf35d8bd) showed a modification to evaluate_string in shell/math.c. Specifically, it changed the alloca size for numstack. The line removed by this patch, var_or_num_t *const numstack = alloca((expr_len / 2) * sizeof(numstack[0]));, represents the vulnerable code that inadequately allocated space, leading to the overflow.
  4. A later comment in the bug report mentioned a different commit (d417193cf) as the final fix, which further modified the allocation in evaluate_string to alloca(expr_len * sizeof(numstack[0])), confirming the allocation size was the core issue.

Based on this, evaluate_string is identified as the function containing the direct memory corruption vulnerability (insufficient alloca). ash_arith is identified as the function in ash.c that processes the potentially malicious input (the arithmetic expression from the shell) and calls evaluate_string, thereby triggering the vulnerability. Both functions would appear in a runtime profile during exploitation.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T**r* is * st**k ov*r*low vuln*r**ility in *s*.*:**** in *usy*ox ***or* *.**. In t** *nvironm*nt o* Int*rn*t o* V**i*l*s, t*is vuln*r**ility **n ** *x**ut** *rom *omm*n* to *r*itr*ry *o** *x**ution.

Reasoning

T** *n*lysis st*rt** *y **t**in* *ont*nt *rom t** *usy*ox *u* tr**k*r URL provi*** in t** r***r*n**s. T*is r*v**l** *n *S*N st**k tr*** *n* * p*t** *or t** vuln*r**ility (*V*-****-*****). *. T** *S*N tr*** *l**rly in*i**t** * `*yn*mi*-st**k-*u***r-ov