Back to skill

Security audit

huawei-cloud-cloudrobo-model-adapt-workflow

Security checks for vulnerabilities and agentic risk

Overview

This model-adaptation skill needs review because its checks automatically trust model-supplied code and its test client can expose images outside the chosen folder.

Before running, require explicit control over model-supplied code, restore TLS verification, and constrain image paths to the selected folder. Until corrected, use a trusted loopback server with synthetic images and an isolated project environment without unrelated secrets. Verify the sources of ocms and the four external sub-skills, whose implementations were unavailable here. Check actual dataset loading independently. Training runs in the background by default; use --foreground or the recorded PID to control it.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/test_client.py
Finding

Server-controlled image keys escape the selected image directory

Content
View full analysis

Impact

Disclosure of readable image content outside the authorized directory. Images are converted and resized before transmission; this does not establish arbitrary non-image file disclosure.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/test_client.py
Finding

TLS verification is unconditionally disabled

Content
View full analysis

Impact

Interception of prompts and user-selected image pixels, manipulation of inference responses, and injection of malicious image metadata that can trigger the directory-escape finding.

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (14)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/iam-policies.md (reported line 35)May include surrounding context.

md
- Read AK/SK from environment variables or a local credentials file — never hardcode them
  in `SKILL.md`, scripts, or `migrate_to_cloudrobo/` templates.
- Prefer temporary credentials (STS) with a short expiry for CI/agent runs.
- Keep the ocms access token / signed download link out of version control.
- Rotate AK/SK when a training container or notebook is destroyed or shared.

## What This Workflow Never Needs

Tokenizer and processor checks enable execution of model-supplied Python code without disclosing that behavior.

High
Category
Output Handling
Confidence
98% confidence
Finding

Both availability checks automatically authorize execution of model-supplied tokenizer or processor code through trust_remote_code=True. Attacker-controlled model artifacts can execute arbitrary Python with the agent's privileges before the checks return, and catching exceptions does not reverse those side effects.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 20)May include surrounding context.

python
# Directory/file exclusions
    # =========================================================================
    exclude_dirs: set[str] = field(default_factory=lambda: {
        'venv', '.venv', 'env', '.env', 'site-packages',
        '__pycache__', '.git', 'build', 'dist', 'node_modules',
    })

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · templates/migrate_to_cloudrobo/env_npu.sh (reported line 36)May include surrounding context.

sh
egments:True"

# Performance (critical — do not remove)
export TASK_QUEUE_ENABLE=2        # pipeline optimization
export COMBINED_ENABLE=1          # operator fusion
export CPU_AFFINITY_CONF=1        # core binding
export ACLNN_CACHE_LIMIT=100000   # operator cache
export ACL_OP_INIT_MODE=0         # lazy initialization

# tcmalloc (10-20% speedup)
[[ -f /usr/lib64/libtcmalloc.so.4 ]] && export LD_PRELOAD=/usr/lib64/libtcmalloc.so.4

export MULTI_STREAM_MEMORY_REUSE=1        # multi-stream memory reuse
export HOST_CACHE_CAPACITY=20             # dynamic shape cache
export HCCL_OP_BASE_FFTS_MODE_ENABLE=TRUE # HCCL FFTS+ optimization
export ASCEND_ENHANCE_enable=1            # Ascend enhancement mode

# Logging (suppress verbose output)
export ASCEND_SLOG_PRINT_TO_STDOUT=0
export ASCEND_GLOBAL_LOG_LEVEL=3
export ASCEND_GLOBAL_EVENT_ENABLE=0

# HCCL distributed training
export HCCL_WHITELIST_DISABLE=1
export HCCL_IF_IP="${HCCL_IF_IP:-$(hostname -I | awk '{print $1}')}"
export HCCL_CONNE

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Tokenizer loading permits model-supplied Python code to run without disclosing that behavior.

Medium
Category
Output Handling
Confidence
98% confidence
Finding

Unconditionally enabling trust_remote_code allows a model's tokenizer configuration to select Python code that executes during verification. A malicious model artifact can therefore run with the verifier's filesystem, credential, and network privileges, even when the user expects only a data-loading check.

Content

No source excerpt is available for this finding.

The documented data-loading verification only tokenizes synthetic text; it never loads a dataset.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

This check can report success without opening the configured dataset or exercising image, state, action, and normalization processing, although the workflow uses it as a real-data verification gate. That creates false assurance and permits downstream training on an unverified data pipeline; this is a validation-integrity weakness rather than direct code execution.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · templates/migrate_to_cloudrobo/train.sh (reported line 83)May include surrounding context.

sh
# =============================================================================
# Start training (pass through "$@")
#   --foreground: run in the foreground (logs straight to the terminal)
#   default: nohup background run; logs tee'd to OUTPUT_DIR/train.log AND
#            streamed to this terminal in real time
# =============================================================================
cd "${PROJECT_ROOT}"

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · templates/migrate_to_cloudrobo/train.sh (reported line 94)May include surrounding context.

sh
# are written to train.log AND echoed to the terminal. `$!` is the
    # training process PID (not tee's), so `kill $(cat train.pid)` still
    # stops training.
    nohup "$@" > >(tee "${OUTPUT_DIR}/train.log") 2>&1 &

    PID=$!
    echo "${PID}" > "${OUTPUT_DIR}/train.pid"

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/checks/build.py (reported line 47)May include surrounding context.

python
model_class_name = cfg.get('model', '').get('type', '') if isinstance(cfg.get('model'), dict) else ''
        if model_class_name:
            module = importlib.import_module(cfg.get('model', {}).get('module', ''))
            model_class = getattr(module, model_class_name)
            model = model_class(**cfg.get('model', {}).get('args', {}))
            return model

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/runtime_patches.py (reported line 320)May include surrounding context.

python
def _unpickle_dtype(name):
    return getattr(torch, name)


def _safe_from_numpy(arr, *args, **kwargs):

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/scanners/__init__.py (reported line 63)May include surrounding context.

python
def _collect_scanners(module) -> list:
    return [
        getattr(module, name)
        for name in dir(module)
        if name.startswith('scan_p_')
    ]

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/verify_adapter.py (reported line 46)May include surrounding context.

python
f"class '{class_name}' not found in {adapter_path}. "
            f"available: {[k for k in dir(mod) if not k.startswith('_')]}"
        )
    return getattr(mod, class_name)


def verify_obs_conversion(adapter_class, constructor_kwargs=None,

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · templates/migrate_to_cloudrobo/runtime_patches.py (reported line 320)May include surrounding context.

python
def _unpickle_dtype(name):
    return getattr(torch, name)


def _safe_from_numpy(arr, *args, **kwargs):