Miggo Logo

CVE-2023-38501: copyparty vulnerable to reflected cross-site scripting via k304 parameter

6.3

CVSS Score
3.1

Basic Information

EPSS Score
0.98896%
Published
7/25/2023
Updated
9/13/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
copypartypip<= 1.8.61.8.7

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from improper input sanitization in cookie generation. The commit diff shows:

  1. A new control character check was added to query parameters (ptn_cc regex)
  2. The set_k304 function was modified to sanitize input (lowercasing and restricting values)
  3. Header validation was added to prevent control characters in responses

Before patching, set_k304 used raw user input from the 'k304' parameter to create cookies via gencookie(), allowing attackers to inject newlines (%0D%0A) to break HTTP headers and inject malicious HTML/JS into the response body. The PoC demonstrates this by injecting <img> tags through newline-separated headers.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Summ*ry T** *ppli**tion *ont*ins * r**l**t** *ross-sit* s*riptin* vi* URL-p*r*m*t*r `?k***=...` *n* `?s*t*k=...` ### **t*ils * r**l**t** *ross-sit* s*riptin* (XSS) vuln*r**ility *xists in t** w** int*r**** o* t** *ppli**tion t**t *oul* *llow *n

Reasoning

T** vuln*r**ility st*ms *rom improp*r input s*nitiz*tion in *ooki* **n*r*tion. T** *ommit *i** s*ows: *. * n*w *ontrol ***r**t*r ****k w*s ***** to qu*ry p*r*m*t*rs (ptn_** r***x) *. T** s*t_k*** *un*tion w*s mo*i*i** to s*nitiz* input (low*r**sin* *