Back to skill

Security audit

Gpu Container Setup Flagos

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate GPU container setup purpose, but it can run web-discovered Docker images with host GPU and data access and then persistently add those sources to its own trusted list.

Install only if you are comfortable reviewing and approving each Docker image and docker run command yourself. Prefer trusted, digest-pinned and signed images; remove or disable the web-search auto-execution path and self-update rule; expose only the devices and host paths required for the workload; and do not run untrusted code or images with these GPU and data mounts.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (2)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:81
Finding
Execution of Untrusted Container Images Discovered Through Web Search## Vulnerability Details **File Location**: `SKILL.md:81-105`; additional guidance in `references/image-sources.md:211-231` and `references/image-sources.md:295-320` **Vulnerability Type**: Remote payload retrieval and supply-chain compromise **Risk Level**: Critical ### Vulnerable Code ```markdown #### Step 4.3: Web Search (fallback) Only if Steps 4.1 and 4.2 fail. Search for `"<vendor> pytorch docker official"`. #### Step 4.4: Local Images (fallback) Only if Steps 4.1-4.3 fail. Check `docker images | grep pytorch`. #### Test Before Use ```bash docker pull "${IMAGE}" && docker run --rm "${IMAGE}" python -c "import torch; print(torch.__version__)" ``` If test fails, try next source. If all fail, ask user for image. #### Step 4.5: Update Skill (self-improvement) **IMPORTANT**: If image found via Web Search (Step 4.3) passes all tests, update `references/image-sources.md` to add the newly discovered vendor hub as a primary source. ``` The corresponding image-discovery instructions state: ```markdown ### Extract and Verify From search results: 1. Find registry URL pattern 2. Test API endpoint 3. Query available tags 4. Select and pull image ``` ### Technical Analysis The Skill permits a container image found through unrestricted web search to be pulled and executed without enforcing: - A registry or repository allowlist - Publisher identity verification - Cryptographic image-signature verification - An immutable image digest - A trusted transparency record or software bill of materials - A controlled entrypoint - Network isolation during initial validation Running a command such as `python -c "import torch; ..."` does not prevent execution of an image-defined `ENTRYPOINT`. A malicious image can configure an entrypoint that executes attacker-controlled code before forwarding to, or impersonating, the requested Python process. Passing a basic PyTorch import or GPU test demonstrat ...[truncated 2319 chars]
Remediation
## Remediation Suggestions 1. Remove automatic execution of images discovered through general web search. 2. Restrict image selection to a centrally maintained allowlist of exact registries, namespaces, and repositories. 3. Require explicit, informed user approval before pulling any image outside the allowlist. 4. Resolve approved tags to immutable OCI digests and launch images as `repository@sha256:digest`. 5. Verify image signatures using a defined trust policy, such as Sigstore Cosign with pinned issuer and identity constraints or Notary v2. 6. Validate publisher ownership independently of search-result content. 7. Perform initial inspection without GPU devices, host data mounts, credentials, or other host directories. 8. Override the image entrypoint during inspection and verify the image configuration before execution. 9. Disable networking during validation where possible, for example with `--network=none`. 10. Apply container hardening controls such as a non-root user, `--read-only`, `--cap-drop=ALL`, `--security-opt=no-new-privileges`, resource limits, and a restrictive seccomp profile. 11. Scan the exact digest for known vulnerabilities and malware, and retain an audit record of the verified digest and signature. 12. Never treat a successful framework import or GPU test as proof that an image is trustworthy.

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:99
Finding
Persistent Trust-Source Poisoning Through Automatic Skill Modification## Vulnerability Details **File Location**: `SKILL.md:99-105`; duplicated and strengthened in `references/image-sources.md:232-246` and `references/image-sources.md:317-320` **Vulnerability Type**: Persistent agent-state and trust-policy poisoning **Risk Level**: High ### Vulnerable Code ```markdown #### Step 4.5: Update Skill (self-improvement) **IMPORTANT**: If image found via Web Search (Step 4.3) passes all tests, update `references/image-sources.md` to add the newly discovered vendor hub as a primary source. This makes future lookups faster. ```bash # After successful web search discovery: # 1. Verify image works (pull + pytorch test + GPU test) # 2. Extract registry URL pattern # 3. Update references/image-sources.md Step 1 section with new vendor hub ``` ``` The persistent update requirement is also expressed as: ```markdown ### IMPORTANT: Update Skill After Success If web search finds a working image that passes all tests (pull + PyTorch import + GPU detection), **you MUST update this file** to add the newly discovered registry as a primary vendor hub. **Update Steps:** 1. Confirm image passes all tests 2. Extract the registry base URL (e.g., `hub.newvendor.com`) 3. Identify the API pattern for querying tags 4. Add new entry to "Step 1: Primary Vendor Hub" section with: - Registry URL - API endpoint - Example query command - Image path pattern ``` ### Technical Analysis The Skill converts information obtained from an untrusted, externally controlled web-search result into persistent trusted configuration. A registry that is merely capable of serving a functional PyTorch image is promoted to the highest-priority source for future invocations. The prescribed tests only establish that the image can be pulled, import PyTorch, and access a GPU. They do not prove: - Registry or publisher ownership - Image integrity or provenance - Absence of hidden malicious behavior ...[truncated 1957 chars]
Remediation
## Remediation Suggestions 1. Remove the mandatory automatic update behavior from both `SKILL.md` and `references/image-sources.md`. 2. Treat newly discovered registries as untrusted candidates rather than trusted primary sources. 3. Record candidates in a separate review queue that is never consumed automatically by future runs. 4. Require manual security review and explicit maintainer approval before modifying the trusted-source list. 5. Protect trusted source configuration with repository review controls, signed commits, and branch protection. 6. Define a machine-readable trust policy containing approved registry domains, namespaces, signing identities, and immutable digests. 7. Reject changes that add wildcard registries, mutable tags, unauthenticated endpoints, or repositories outside approved namespaces. 8. Require independent verification of domain ownership and official vendor documentation. 9. Require signature and provenance validation for every image, even after a registry has been approved. 10. Log the source, approver, digest, signing identity, and review evidence for every trust-policy change. 11. Periodically review and revoke stale or compromised registries without relying on functional image tests.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (71)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The supplied code chunk implements only the GPU detection portion of the declared description. It probes for NVIDIA, AMD/ROCm, Ascend, Metax, and Iluvatar devices using command-line tools and filesystem checks, then prints a JSON result. The declared purpose, however, describes a broader skill that also finds the correct PyTorch container image, launches it with proper mounts, and validates GPU functionality. None of those container-selection, container-launch, or GPU-validation behaviors appear in this code chunk. There are no obvious undeclared harmful capabilities, but the behavior shown is materially narrower than the declared end-to-end container setup functionality, so this is a description/behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description is about GPU/container setup orchestration: detecting GPU vendor, choosing a PyTorch container, launching it, and validating GPU access. The supplied code does none of that. It only inspects local filesystem mounts, excludes system/special mounts, scores remaining mount points by path and free space, and returns the best candidate as a data disk. While mount discovery could be a supporting subcomponent of container setup, the declared purpose does not mention a standalone data-disk detection utility, and the code lacks any GPU detection, container management, or validation behavior. Therefore the code chunk materially differs from the declared primary purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description presents a container setup skill whose core functions are GPU vendor detection, container image selection, container launch, mount configuration, and validation. The supplied code only covers the validation portion: it probes available PyTorch backends (CUDA/NPU/MUSA/CoreX/ROCm), checks device availability, runs simple tensor and matrix operations, and reports results. There is no code for discovering container images, invoking Docker/container runtimes, setting mounts, or orchestrating container startup. Because major primary capabilities in the description are absent from the actual code, this is a material description-behavior mismatch.

Self-Modification

High
Category
Rogue Agent
Content
If test fails, try next source. If all fail, ask user for image.

#### Step 4.5: Update Skill (self-improvement)

**IMPORTANT**: If image found via Web Search (Step 4.3) passes all tests, update `references/image-sources.md` to add the newly discovered vendor hub as a primary source. This makes future lookups faster.
Confidence
97% confidence
Finding
This is explicit self-modification: the skill instructs itself to change repository documentation based on externally discovered information. Persistent self-modification is dangerous because it can silently alter future trust decisions, introduce malicious registries or guidance into the repo, and create a supply-chain style persistence mechanism beyond the immediate run.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
**AMD/ROCm:**
```bash
docker run -d \
  --device=/dev/kfd --device=/dev/dri \
  --group-add video --group-add render \
  --name pytorch-gpu \
  --shm-size=16g \
Confidence
95% confidence
Finding
Passing /dev/kfd and /dev/dri into a container grants direct access to GPU-related host device nodes and expands the attack surface beyond a standard container. If a malicious or compromised image is run, device passthrough can enable host interference, data exposure, or exploitation of kernel/driver vulnerabilities; this skill makes that risk worse by sourcing images dynamically.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
**Ascend:**
```bash
docker run -d \
  --device=/dev/davinci0 --device=/dev/davinci1 ... \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
Confidence
96% confidence
Finding
Mapping Ascend device nodes into the container gives code inside the container privileged access to accelerator interfaces on the host. Combined with remote image selection and host path mounts, this substantially increases the consequence of running an untrusted image.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run -d \
  --device=/dev/davinci0 --device=/dev/davinci1 ... \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
  -v /usr/local/Ascend:/usr/local/Ascend:ro \
Confidence
96% confidence
Finding
Additional Ascend management-related device mappings further broaden host interaction from within the container. Management interfaces are particularly sensitive because they may permit deeper control or telemetry access than simple compute-only paths.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
docker run -d \
  --device=/dev/davinci0 --device=/dev/davinci1 ... \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
  -v /usr/local/Ascend:/usr/local/Ascend:ro \
  -v /usr/local/sbin/npu-smi:/usr/local/sbin/npu-smi:ro \
Confidence
96% confidence
Finding
Exposing /dev/devmm_svm-like interfaces can provide low-level memory-management access pathways to containerized code. In the context of dynamically discovered images, this magnifies the blast radius of executing untrusted code.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
--device=/dev/davinci0 --device=/dev/davinci1 ... \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
  -v /usr/local/Ascend:/usr/local/Ascend:ro \
  -v /usr/local/sbin/npu-smi:/usr/local/sbin/npu-smi:ro \
  --name pytorch-gpu \
Confidence
95% confidence
Finding
Providing /dev/hisi_hdc and related device access, alongside mounted host vendor tooling, gives the container broad visibility into host accelerator infrastructure. This is acceptable only under strict trust assumptions, which are undermined here by dynamic web/registry-based image discovery.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
**Metax:**
```bash
docker run -d \
  --device=/dev/mx0 --device=/dev/mx1 ... \
  -v /opt/metax:/opt/metax:ro \
  --name pytorch-gpu \
  --shm-size=16g \
Confidence
94% confidence
Finding
Metax device passthrough similarly grants direct hardware access to whatever code runs in the container. In a workflow that may discover images via web search and run them after limited testing, this creates a high-risk path to host compromise or abuse of accelerator resources.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
**Iluvatar:**
```bash
docker run -d \
  --device=/dev/bi0 --device=/dev/bi1 ... \
  -v /opt/iluvatar:/opt/iluvatar:ro \
  --name pytorch-gpu \
  --shm-size=16g \
Confidence
94% confidence
Finding
Iluvatar device node mapping gives the container direct access to host accelerator devices, which is a privileged operation relative to normal containers. The danger is heightened because the skill also encourages pulling and testing images from external sources before full validation of trust.

Self-Modification

High
Category
Rogue Agent
Content
3. Query available tags
4. Select and pull image

### IMPORTANT: Update Skill After Success

If web search finds a working image that passes all tests (pull + PyTorch import + GPU detection), **you MUST update this file** to add the newly discovered registry as a primary vendor hub.
Confidence
99% confidence
Finding
The explicit 'Update Skill' instruction authorizes self-modification based on untrusted web-derived information. This creates a persistent compromise path where an attacker can influence future executions by shaping search results or registry metadata that becomes embedded into the skill.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
The document instructs the agent to modify its own source file based on web-search results, creating a self-modifying trust boundary. This is dangerous because untrusted external content can become persistent workflow logic, enabling prompt injection persistence, policy drift, or later execution of attacker-influenced instructions.

Self-Modification

High
Category
Rogue Agent
Content
│         ↓ fail → Step 3                                         │
├─────────────────────────────────────────────────────────────────┤
│ Step 3: Web Search for vendor registry                          │
│         ↓ success → use image → UPDATE SKILL with new hub       │
│         ↓ fail → Step 4                                         │
├─────────────────────────────────────────────────────────────────┤
│ Step 4: Check local images, test PyTorch                        │
Confidence
99% confidence
Finding
The summary flow repeats that success in web search should lead to updating the skill, confirming persistent self-modification as part of normal operation. In this context, that is a serious design flaw because the skill handles untrusted network content and then elevates it into future instructions.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/kfd \
  --device=/dev/dri \
  --group-add video \
  --group-add render \
Confidence
78% confidence
Finding
Passing `/dev/kfd` into a container grants direct access to the host GPU compute device, significantly reducing hardware isolation. This is often necessary for ROCm workloads, but in a generic setup skill it still enlarges the attack surface if untrusted code runs inside the container.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/kfd \
  --device=/dev/dri \
  --group-add video \
  --group-add render \
  -v /path/to/data:/data \
Confidence
78% confidence
Finding
Mounting `/dev/dri` exposes host graphics/render devices to the container, which weakens isolation and may permit abuse of kernel driver interfaces. In a GPU-enablement skill this may be operationally required, but it remains a real security-sensitive permission grant.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/davinci0 \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
Confidence
83% confidence
Finding
Exposing `/dev/davinci0` gives the container direct access to an Ascend accelerator device and its driver interface. Combined with additional host-mounted vendor libraries, this creates a highly trusted container context where malicious code could abuse accelerator access or interact with kernel-facing device nodes.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/davinci0 \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
  -v /usr/local/Ascend/driver:/usr/local/Ascend/driver:ro \
Confidence
83% confidence
Finding
`/dev/davinci_manager` exposes a management interface to the container, which is more sensitive than data-path-only access because it may enable control-plane interactions with the accelerator stack. In this context, that increases the impact of a compromised container beyond ordinary application execution.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
docker run \
  --device=/dev/davinci0 \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
  -v /usr/local/Ascend/driver:/usr/local/Ascend/driver:ro \
  -v /usr/local/Ascend/ascend-toolkit:/usr/local/Ascend/ascend-toolkit:ro \
Confidence
80% confidence
Finding
Mounting `/dev/devmm_svm` provides shared memory-related accelerator functionality to the container and further reduces host/container isolation. While likely required for Ascend workloads, it grants low-level device interaction to code running inside the container.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
--device=/dev/davinci0 \
  --device=/dev/davinci_manager \
  --device=/dev/devmm_svm \
  --device=/dev/hisi_hdc \
  -v /usr/local/Ascend/driver:/usr/local/Ascend/driver:ro \
  -v /usr/local/Ascend/ascend-toolkit:/usr/local/Ascend/ascend-toolkit:ro \
  -v /usr/local/sbin/npu-smi:/usr/local/sbin/npu-smi:ro \
Confidence
80% confidence
Finding
Passing `/dev/hisi_hdc` gives containerized code additional access to host accelerator communication channels. This is a real security-sensitive permission because it exposes host device interfaces directly, even if operationally necessary.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/mxcd \
  --device=/dev/dri \
  --group-add video \
  --shm-size=16g \
Confidence
79% confidence
Finding
Exposing `/dev/mxcd` grants direct access to a Metax device interface from inside the container. That is a meaningful isolation reduction and could be abused by untrusted code to interact with the host driver stack.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/mxcd \
  --device=/dev/dri \
  --group-add video \
  --shm-size=16g \
  --ipc=host \
Confidence
78% confidence
Finding
This line mounts `/dev/dri` for Metax workloads, again exposing host render devices to the container. Even though common for GPU enablement, it is still a real security tradeoff and not a harmless example in a skill that automates container launch.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
--device=/dev/dri \
  --group-add video \
  --shm-size=16g \
  --ipc=host \
  -v /path/to/data:/data \
  cr.metax-tech.com/public-ai-release/maca/vllm-metax:latest
```
Confidence
84% confidence
Finding
Using `--ipc=host` shares the host IPC namespace with the container, reducing isolation and enabling inspection or interference with host or sibling container IPC objects. In a GPU-container setup skill that may run untrusted ML code, this broadens the blast radius and can expose sensitive shared-memory data.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/bi0 \
  --device=/dev/bi1 \
  -v /opt/iluvatar:/opt/iluvatar:ro \
  -v /path/to/data:/data \
Confidence
80% confidence
Finding
Mounting `/dev/bi0` grants direct access to an Iluvatar accelerator device from within the container. That weakens isolation and gives containerized code a path to interact with host hardware interfaces.

Privileged Container / Container Escape

High
Category
Privilege Escalation
Content
```bash
docker run \
  --device=/dev/bi0 \
  --device=/dev/bi1 \
  -v /opt/iluvatar:/opt/iluvatar:ro \
  -v /path/to/data:/data \
  hub.iluvatar.com/pytorch/iluvatar-pytorch:latest
Confidence
80% confidence
Finding
Mounting `/dev/bi1` extends the same privileged hardware access to an additional Iluvatar device, increasing exposure. In a setup skill, automating multi-device passthrough raises the consequences of running compromised or untrusted container code.

Static analysis

No suspicious patterns detected.