Load/Mine malicious Qwen2 models on Hugging Face
Malicious Qwen2 test models uploaded to Hugging Face (e.g. MENXIANGYU/qwen2-tiny) and mirrored on ModelScope. config.json auto_map field points to modeling_evil2.EvilModel which executes on…
What happened
Malicious Qwen2 test models uploaded to Hugging Face (e.g. MENXIANGYU/qwen2-tiny) and mirrored on ModelScope. config.json auto_map field points to modeling_evil2.EvilModel which executes on trust_remote_code=True and vLLM versions before 0.14.0 without that flag (CVE-2026-22807). Payload runs fileless peakminer cryptominer via memfd_create, establishes .bashrc persistence, deploys reverse shells, and achieves GPUStack container escape. Models appear as legitimate Qwen2 variants for testing purposes.
How it happened
Read the flow as text & sources
A catalog reconstruction of the supplied source account. Unknown steps remain explicit; an edge describes the reported relationship between steps.
- 01 · Malicious models uploaded to repositories
Attacker uploaded trojanized Qwen2 test models to Hugging Face and ModelScope with malicious config.json auto_map fields
Source for step 1 - 02 · Victim loads malicious model
User loads model with trust_remote_code=True or via vulnerable vLLM <0.14.0 (CVE-2026-22807)
Hunt: An unexpected script, implant or local model client communicates with a model service near command execution, collection or file modification.
Connecting to a legitimate model domain does not establish malicious use or reveal returned code. Local / in-process models can evade network-only hunts.
Source for step 2 - 03 · Malicious code executes during model load
modeling_evil2.EvilModel runs from config.json auto_map field during model initialization
Hunt: A program delivered by the reported lure executes, establishes access or contacts infrastructure outside the approved software baseline.
A program name alone is not a signature. This normalized template requires the relevant platform collector and does not assert Windows-only policy coverage.
Source for step 3 - 04 · Fileless cryptominer deployed
peakminer runs via memfd_create for fileless execution; establishes .bashrc persistence
Hunt: A Linux process executes from a memfd or /proc file-descriptor path, or stages an executable in a transient directory, consistent with fileless payload or miner execution.
Updaters, runtimes, and security tools can legitimately execute anonymous files. Process collectors differ in how they represent memfd paths, so absence of a match is not proof of absence.
Source for step 4 - 05 · Additional payloads and container escape
Reverse shells deployed; GPUStack container escape achieved
Hunt: A container or Kubernetes pod is created with privileged execution or a host-directory mount that can expose the underlying node and enable container escape.
Infrastructure, storage, observability, and security workloads may legitimately require elevated access. Docker and Kubernetes use different audit schemas, and creation does not prove escape.
Source for step 5
Why it matters
Reported entry point: User loads malicious model from Hugging Face or ModelScope with trust_remote_code=True or vulnerable vLLM version. Reported impact: peakminer runs via memfd_create for fileless execution; establishes .bashrc persistence; Reverse shells deployed; GPUStack container escape achieved; reported targets include ML researchers, AI developers, organizations using Hugging Face models; applicability to your setup has not been assessed, so verify affected versions, permissions, and configuration in the original report.
What you can do
Protection & prevention
Pin and verify model checksums; avoid trust_remote_code=True; update vLLM to 0.14.0 or later; monitor memfd_create usage; scan .bashrc for unauthorized changes; detect outbound cryptocurrency mining traffic; review model config.json auto_map fields; use model scanning tools
Catalog defensive guidance based on the reported behavior. Confirm scope and current mitigations in the original source.
Detection queries
Draft query starters grouped by the attack stages where they apply.
Start with the logs you collect. Each hunt identifies its required visibility, field mapping and limits. Queries are catalog-authored drafts using reusable behavior profiles; test with known activity and your normal baseline before alerting.
02Victim loads malicious modelUnexpected process → model serviceCustom schema · Draft
User loads model with trust_remote_code=True or via vulnerable vLLM <0.14.0 (CVE-2026-22807)
What to look for
An unexpected script, implant or local model client communicates with a model service near command execution, collection or file modification.
Visibility: Defender-side logs where collected
Required logs
- Per-process network / DNS records
- AI-service request logs where available
- Process and file behavior on the calling host
Coverage limit. Connecting to a legitimate model domain does not establish malicious use or reveal returned code. Local / in-process models can evade network-only hunts.
Custom-schema candidates, not out-of-box detectors. Map your application / cloud / platform logs to EventType, Actor, Asset, Action, Target and CorrelationId. KQL uses a custom OpenAttacksAudit_CL table; SPL uses openattacks:audit. EventType values are proposed normalization names, not native vendor event names. Correlation and environment-specific alert logic remain to be built.
Sigma
title: Hunt - Unexpected process → model service
id: 8560daf7-ecd1-4f2b-ad09-b794bb56a394
status: experimental
description: An unexpected script, implant or local model client communicates
with a model service near command execution, collection or file modification.
author: MagicSword OpenAttacks catalog
date: 2026-10-23
falsepositives:
- Authorized activity matching this broad hunt; baseline and investigate
before alerting.
level: low
logsource:
category: application
product: openattacks_audit
definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
Target and CorrelationId from the required source logs first.
detection:
selection:
EventType:
- model.connection
- model.invoke
condition: selection
KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("model.connection", "model.invoke")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("model.connection", "model.invoke")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Join the network connection to the process tree and the actions before and after the response.
- Compare with approved AI integrations; inspect local model listeners for PoCs that do not use a hosted API.
03Malicious code executes during model loadUnexpected payload / remote-access behaviorCustom schema · Draft
modeling_evil2.EvilModel runs from config.json auto_map field during model initialization
What to look for
A program delivered by the reported lure executes, establishes access or contacts infrastructure outside the approved software baseline.
Visibility: Defender-side logs where collected
Required logs
- Platform-specific process and file provenance
- Signer / hash and software inventory
- Per-process network and remote-session records
Coverage limit. A program name alone is not a signature. This normalized template requires the relevant platform collector and does not assert Windows-only policy coverage.
Custom-schema candidates, not out-of-box detectors. Map your application / cloud / platform logs to EventType, Actor, Asset, Action, Target and CorrelationId. KQL uses a custom OpenAttacksAudit_CL table; SPL uses openattacks:audit. EventType values are proposed normalization names, not native vendor event names. Correlation and environment-specific alert logic remain to be built.
Sigma
title: Hunt - Unexpected payload / remote-access behavior
id: 998d4263-6e73-4472-a74d-cb4d61c28544
status: experimental
description: A program delivered by the reported lure executes, establishes
access or contacts infrastructure outside the approved software baseline.
author: MagicSword OpenAttacks catalog
date: 2026-10-23
falsepositives:
- Authorized activity matching this broad hunt; baseline and investigate
before alerting.
level: low
logsource:
category: application
product: openattacks_audit
definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
Target and CorrelationId from the required source logs first.
detection:
selection:
EventType:
- process.unapproved.exec
- remote.session.start
condition: selection
KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("process.unapproved.exec", "remote.session.start")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("process.unapproved.exec", "remote.session.start")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Confirm the payload's operating system, origin and execution context before choosing a platform-specific rule.
- Correlate the launched program with child processes, persistence and network activity; verify authorization.
04Fileless cryptominer deployedLinux fileless or anonymous-file executionNative logs · Draft
peakminer runs via memfd_create for fileless execution; establishes .bashrc persistence
What to look for
A Linux process executes from a memfd or /proc file-descriptor path, or stages an executable in a transient directory, consistent with fileless payload or miner execution.
Visibility: Linux process and audit telemetry where collected
Required logs
- Linux process creation with executable paths and command lines
- Audit or EDR telemetry for memfd_create and execve where available
- Network and persistence activity from the resulting process
Coverage limit. Updaters, runtimes, and security tools can legitimately execute anonymous files. Process collectors differ in how they represent memfd paths, so absence of a match is not proof of absence.
Linux process candidates whose image or command line exposes a memfd or procfs descriptor. Tune known runtimes and require supporting behavior before alerting.
MCP reference matches: Potential Fileless Execution via Unusual memfd Create Call (Elastic detection-rules). The query below is a catalog adaptation, not a verbatim upstream rule.
Sigma
title: Hunt - Linux Anonymous File Execution
id: afc1e20b-3eae-46fd-b736-e14b639f3a66
status: experimental
description: Detects process paths or command lines associated with memfd and procfs file-descriptor execution.
author: MagicSword OpenAttacks catalog
date: 2026-11-06
references:
- https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_fileless_execution_via_unusual_memfd_create.toml
falsepositives:
- Legitimate runtimes, updaters, and security software using anonymous files
level: medium
logsource:
category: process_creation
product: linux
detection:
selection_image:
Image|contains:
- /memfd:
- /proc/self/fd/
- /proc/thread-self/fd/
selection_command:
CommandLine|contains:
- memfd:
- /proc/self/fd/
- /proc/thread-self/fd/
condition: 1 of selection_*
KQL
DeviceProcessEvents
| where Timestamp > ago(7d)
| where OSPlatform =~ "Linux"
| where FolderPath has_any ("/memfd:", "/proc/self/fd/", "/proc/thread-self/fd/")
or ProcessCommandLine has_any ("memfd:", "/proc/self/fd/", "/proc/thread-self/fd/")
| project Timestamp, DeviceName, AccountName, FolderPath, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, SHA1
| order by Timestamp descSPL
| tstats count min(_time) as firstTime max(_time) as lastTime
from datamodel=Endpoint.Processes
where Processes.process IN ("*memfd:*", "*/proc/self/fd/*", "*/proc/thread-self/fd/*")
by Processes.dest Processes.user Processes.process_name Processes.process
Processes.parent_process_name Processes.parent_process
| `drop_dm_object_name(Processes)`
| sort - lastTimeInvestigation steps
- Capture the process memory or recovered executable, parent tree, user, container, and destination.
- Correlate the execution with downloads, persistence changes, mining traffic, or reverse shells.
05Additional payloads and container escapePrivileged container or pod with host accessNative logs · Draft
Reverse shells deployed; GPUStack container escape achieved
What to look for
A container or Kubernetes pod is created with privileged execution or a host-directory mount that can expose the underlying node and enable container escape.
Apply this only to the reported GPUStack/container branch; reverse-shell activity needs endpoint process and network correlation.
Visibility: Container orchestration and runtime audit logs where collected
Required logs
- Kubernetes API audit or Docker daemon events
- Container runtime process and mount telemetry
- Cloud control-plane identity and admission-controller decisions
Coverage limit. Infrastructure, storage, observability, and security workloads may legitimately require elevated access. Docker and Kubernetes use different audit schemas, and creation does not prove escape.
Kubernetes audit candidates for privileged pods or hostPath volumes. The KQL and SPL examples need the respective Kubernetes audit sources and local field extraction.
MCP reference matches: Privileged Container Deployed (SigmaHQ), Linux Suspicious Privileged Container Execution (Splunk Security Content). The query below is a catalog adaptation, not a verbatim upstream rule.
Sigma
title: Hunt - Privileged Kubernetes Pod or Host Mount
id: 5a3e19f4-3f1f-46e9-974f-4985b4692d30
status: experimental
description: Detects pod creation requests containing privileged containers or hostPath volumes.
author: MagicSword OpenAttacks catalog
date: 2026-11-06
references:
- https://github.com/SigmaHQ/sigma/blob/master/rules/application/kubernetes/audit/kubernetes_audit_privileged_pod_creation.yml
falsepositives:
- Approved infrastructure, storage, observability, and security workloads
level: high
logsource:
category: application
product: kubernetes
service: audit
detection:
selection_create:
verb: create
objectRef.resource: pods
selection_privileged:
requestObject.spec.containers.securityContext.privileged: true
selection_hostpath:
requestObject.spec.volumes.hostPath.path|startswith: /
condition: selection_create and 1 of selection_privileged, selection_hostpath
KQL
AzureDiagnostics
| where TimeGenerated > ago(7d)
| where Category in ("kube-audit", "kube-audit-admin")
| where log_s has '"verb":"create"' and log_s has '"resource":"pods"'
| where log_s has '"privileged":true' or log_s has '"hostPath"'
| project TimeGenerated, Resource, ResourceGroup, SubscriptionId, log_s
| order by TimeGenerated descSPL
sourcetype="kube:apiserver-audit" verb=create objectRef.resource=pods
(requestObject.spec.containers{}.securityContext.privileged=true
OR requestObject.spec.volumes{}.hostPath.path="*")
| table _time user.username sourceIPs{} objectRef.namespace objectRef.name
requestObject.spec.containers{}.image requestObject.spec.volumes{}.hostPath.path
| sort - _timeInvestigation steps
- Identify the creating principal, image digest, namespace, security context, host mounts, and admission result.
- Compare with approved workloads, then inspect node-level file access, processes, and credentials.
Technical detailsTooling, impact & MITRE ATLAS
Attack context
- AI's role
- Agent / MCP as target
- Additional role
- LLM-generated malware
- Initial access
- User loads malicious model from Hugging Face or ModelScope with trust_remote_code=True or vulnerable vLLM version
Tooling as reported
AI products, models and artifacts
- Hugging Face model repository
- ModelScope mirror
- Qwen2 model format
- vLLM <0.14.0 (CVE-2026-22807)
- Transformers library (trust_remote_code execution)
Other tooling
- peakminer cryptominer
- memfd_create (fileless execution)
- .bashrc persistence
- Reverse shell
- GPUStack container escape
Targets and reported impact
- Targets / sectors
- ML researchers, AI developers, organizations using Hugging Face models
- Reported scale / exposure
- Multiple malicious models uploaded including MENXIANGYU/qwen2-tiny; exact victim count unknown
- Target geography
- Multiple regions
Multiple regions reflects global Hugging Face and ModelScope user base
Source defensive notes
Pin and verify model checksums; avoid trust_remote_code=True; update vLLM to 0.14.0 or later; monitor memfd_create usage; scan .bashrc for unauthorized changes; detect outbound cryptocurrency mining traffic; review model config.json auto_map fields; use model scanning tools
MITRE ATLAS
AI-specific catalog annotations based on the reported behavior; these are not MITRE case-study assignments.
Attackers poisoned publicly available ML models on Hugging Face and ModelScope platforms Source
Malicious code injected via model config.json auto_map field executes during model loading Source
Cryptominer achieves persistence through .bashrc modification Source
Fileless peakminer cryptominer runs via memfd_create to evade detection Source
Indicators of compromise
domains
ips
hashes
urls
https://huggingface.co/MENXIANGYU/qwen2-tiny
Sources & research credit
1 sourceResearch by Shaked Chen, Eitan Chassid, Yotam Perkal · Pluto Security
Relevant detection rules: - Sigma: Suspicious Cron File Created (persistence via .bashrc) (https://github.com/SigmaHQ/sigma/blob/master/rules/linux/file_event/file_event_lnx_susp_cron_file_created.yml) - Sigma: Audio Capture via memfd_create (fileless execution pattern, can detect suspicious memfd_create usage) (https://github.com/SigmaHQ/sigma/blob/master/rules/linux/auditd/lnx_auditd_audio_capture.yml) - Note: Cryptominer detection typically requires network traffic analysis (cryptocurrency pool connections) and process monitoring for mining-specific CPU/GPU patterns. Container escape detection depends on specific container runtime audit logs.
Record & downloads
- Source record name
- Load/Mine malicious Qwen2 models on Hugging Face
- Entry ID
- pluto-loadmine-qwen2-malware-2026
- Catalog review
- November 4, 2026
- AI-role confidence
- high