CVE-2023-38501: copyparty vulnerable to reflected cross-site scripting via k304 parameter
6.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.98896%
CWE
Published
7/25/2023
Updated
9/13/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
copyparty | pip | <= 1.8.6 | 1.8.7 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper input sanitization in cookie generation. The commit diff shows:
- A new control character check was added to query parameters (ptn_cc regex)
- The set_k304 function was modified to sanitize input (lowercasing and restricting values)
- 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.