Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessGain local low-privilege access to ms-swift host
-
DeliveryStage or inject two PIL images with identical tobytes() output but different dimensions
-
ExploitTrigger Template._save_pil_image for the first image to populate cache
-
ExecutionSubmit second image to same cache lookup
-
PersistCache collision returns first image's file path
-
ImpactWrong image silently used as model input, corrupting inference integrity
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A04:2025 - Cryptographic Failures
ASVS 5.0
V11 - Cryptography Irreversible hash functions
|
| Exploitation Conditions | Exploitation requires local system access with at least low-privileged credentials (CVSS PR:L) - remote unauthenticated exploitation is not possible. High attack complexity (AC:H) is required: the attacker must specifically construct or stage PIL images whose raw pixel byte buffers (as returned by image.tobytes()) are identical despite differing in dimensions or color mode, which requires deliberate image crafting, not incidental input. The vulnerable code path is triggered when Template._save_pil_image is invoked during multimodal template processing in ms-swift; this requires the PIL image caching feature to be active in the deployment. Exploitation is limited to versions up to 4.2.0 of ms-swift. There is no user interaction required (UI:N) once the attacker can supply or stage crafted images. The limiting factors - local-only access, high complexity, and the need to control image content entering the cache - significantly constrain realistic exploitation to insider-threat or post-compromise scenarios in ML pipeline environments. |
| Impact | The overall risk is very low. The CVSS 4.0 base score of 1.1 reflects an attack vector of Local (AV:L), high attack complexity (AC:H), and low privileges required (PR:L), with confidentiality impact of None (VC:N) and only limited integrity (VI:L) and availability (VA:L) impacts in the vulnerable system. There is no scope change to downstream systems (SC:N, SI:N, SA:N). The exploit maturity modifier E:P confirms a publicly available proof-of-concept, but this does not elevate the practical risk substantially given the local-only attack surface and high complexity requirement. No EPSS data was provided in the intelligence sources, so exploitation probability cannot be quantified. The vulnerability is not listed in the CISA KEV catalog, indicating no confirmed active exploitation. The attack requires an adversary who already has local, authenticated access to the host and must craft or stage image files specifically designed to collide - this is not a scenario that lends itself to opportunistic, automated exploitation. The primary real-world impact is incorrect image retrieval from cache, which could silently corrupt multimodal LLM inference inputs, a subtle but potentially meaningful data integrity concern in fine-tuning or inference pipelines. |
| Exploit ScenarioDerived | A local, low-privileged user on a system running ms-swift fine-tuning or inference pipelines crafts two PIL images with identical raw pixel byte buffers but different dimensions - for example, 120×80 and 80×120 - so that image.tobytes() produces the same byte sequence for both. When the first image is processed and cached via Template._save_pil_image, the second image resolves to the same cache key and is served the first image's cached file instead of its own, silently corrupting the multimodal model input. A proof-of-concept demonstrating this collision is publicly available at https://github.com/modelscope/ms-swift/issues/9360. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jun 04, 2026
Cache key collision in modelscope ms-swift up to 4.2.0 allows a local, low-privileged attacker to cause PIL image integrity failures via the Template._save_pil_image function in swift/template/base.py. The root cause is that the image cache key was computed by hashing only raw pixel bytes (image.tobytes()), without incorporating image metadata such as dimensions or color mode - meaning two structurally different images (e.g., 120×80 vs 80×120) sharing identical byte payloads produce the same SHA-256 cache key and thus collide to the same cached file path. No public exploit identified at time of analysis beyond the publicly disclosed proof-of-concept; no active exploitation confirmed (not listed in CISA KEV).
RemediationAI
Upstream fix available via GitHub pull request #9359 (https://github.com/modelscope/ms-swift/pull/9359); a released patched version is not independently confirmed as the PR awaits acceptance. Users should monitor the ms-swift release feed and upgrade to the first version released after PR #9359 is merged. As a compensating control, operators can disable or bypass the PIL image caching path in swift/template/base.py by patching the Template._save_pil_image method locally to prepend image metadata (mode, width, height) to the hash input before the official fix is available - the exact corrected logic is visible in the PR diff: img_meta = f'{image.mode}:{image.width}:{image.height}:'.encode(); img_hash = hashlib.sha256(img_meta + image.tobytes()).hexdigest(). This local patch carries the trade-off of diverging from upstream and requiring re-application on each update. Restricting write access to the PIL image cache directory to trusted processes only will reduce the blast radius but will not eliminate the collision condition.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
ms-swift is a scalable lightweight fine-tuning framework from ModelScope (Alibaba DAMO). The affected code path is Template._save_pil_image in swift/template/base.py, which caches PIL Image objects on disk using a SHA-256 hash as the filename. CWE-328 (Use of Weak Hash) applies here not because SHA-256 is cryptographically weak, but because the hash input is structurally incomplete: the pre-patch code hashed only image.tobytes() - raw pixel data - without including the image mode (e.g., RGB, RGBA), width, or height. Python's PIL/Pillow tobytes() returns a flat byte buffer; two images with different dimensions but the same total pixel count and same raw buffer content (or identical buffers reinterpreted across different shapes) are indistinguishable to the hash function. The fix, visible in PR #9359, prepends a metadata string formatted as 'mode:width:height:' before hashing, ensuring geometric and color-space properties are reflected in the cache key. Affected CPE: cpe:2.3:a:modelscope:ms-swift:*:*:*:*:*:*:*:*.
Know when Modelscope gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:L/AC:H/AT:N/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N/E:P
Primary rating from Vendor (VulDB) · only source for this CVE.
CVSS VectorVendor: VulDB
Lifecycle Timeline
1DescriptionCVE.org
A security vulnerability has been detected in modelscope ms-swift up to 4.2.0. This affects the function Template._save_pil_image of the file swift/template/base.py of the component PIL Image Cache Key Handler. The manipulation leads to use of weak hash. An attack has to be approached locally. A high degree of complexity is needed for the attack. It is indicated that the exploitability is difficult. The exploit has been disclosed publicly and may be used. The pull request to fix this issue awaits acceptance.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
More in Modelscope
View allIn agentscope <=v0.0.4, the file agentscope\web\workstation\workflow_utils.py has the function is_callable_expression. R
A path traversal vulnerability exists in the modelscope/agentscope application, affecting all versions. Rated critical s
A path traversal vulnerability exists in the save-workflow and load-workflow functionality of modelscope/agentscope vers
An arbitrary file download vulnerability exists in the rpc_agent_client component of modelscope/agentscope version v0.0.
A directory traversal vulnerability exists in modelscope/agentscope version 0.0.4. Rated high severity (CVSS 7.5), this
A path traversal vulnerability exists in modelscope/agentscope version v.0.0.4. Rated high severity (CVSS 7.5), this vul
Remote code execution in ModelScope AgentScope up to version 1.0.18 allows unauthenticated network attackers to inject a
Modelscope AgentScope versions up to 1.0.18 contain a server-side request forgery (SSRF) vulnerability in the _process_a
Server-side request forgery in ModelScope AgentScope up to version 1.0.18 allows remote unauthenticated attackers to man
Server-side request forgery (SSRF) in ModelScope AgentScope up to version 1.0.18 allows remote unauthenticated attackers
Unsafe PyYAML deserialization in ModelScope through v1.40.0 enables remote code execution when users load model configur
Server-side request forgery in ms-swift 4.5.2 allows unauthenticated remote attackers to weaponize the server's multimod
EUVD-2026-34242
GHSA-prfw-69r3-wqxf
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB