Back to skill

Security audit

Modelscope Api

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its ModelScope API purpose, but it includes risky install and credential-handling instructions that could expose tokens or run unverified code if followed.

Install only if you are comfortable reviewing ModelScope install commands yourself. Avoid the curl-to-bash installer, use least-privilege short-lived tokens, do not place real tokens in Git URLs or shell commands, and treat Studio deploy/delete/secret operations as account-changing actions that need explicit confirmation each time.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:130
Finding

Unverified Remote Installation Script Executed Directly by Bash

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:130
Finding

Unpinned Third-Party Package and Skill Installations

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:445
Finding

Authentication Tokens Exposed Through Command Arguments and Git URLs

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:481
Finding

Persistent Authentication Cookies Conflict with the Session-Only Credential Policy

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (42)

Tainted flow: 'url' from os.environ.get (line 129, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/modelscope_helper.py (reported line 60)May include surrounding context.

python
headers = {}
    if token:
        headers["Authorization"] = f"Bearer {token}"
    r = requests.get(url, headers=headers, timeout=15, **kwargs)
    r.raise_for_status()
    d = r.json()
    # 兼容 /api/v1/(PascalCase)和 /openapi/v1/(snake_case)

Tainted flow: 'url' from os.environ.get (line 129, credential/environment) → requests.put (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/modelscope_helper.py (reported line 76)May include surrounding context.

python
headers = {"Content-Type": "application/json"}
    if token:
        headers["Authorization"] = f"Bearer {token}"
    r = requests.put(url, headers=headers, json=body, timeout=15)
    r.raise_for_status()
    d = r.json()
    if "Data" in d:

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 · README.md (reported line 23)May include surrounding context.

md
需要一个 ModelScope API Token:
1. 访问 https://www.modelscope.cn/my/overview 注册登录
2. 点右上角头像 → 「访问令牌」(Access Token) → 新建令牌
3. 复制生成的 Token(格式:`ms-xxxxxx`)

### 在 WorkBuddy 中使用

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 · SKILL.md (reported line 69)May include surrounding context.

md
需要一个 ModelScope API Token:
1. 访问 https://www.modelscope.cn/my/overview 注册登录
2. 点右上角头像 → 「访问令牌」(Access Token) → 新建令牌
3. 复制生成的 Token(格式:`ms-xxxxxx`)

### 在 WorkBuddy 中使用

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 · scripts/modelscope_helper.py (reported line 40)May include surrounding context.

python
需要一个 ModelScope API Token:
1. 访问 https://www.modelscope.cn/my/overview 注册登录
2. 点右上角头像 → 「访问令牌」(Access Token) → 新建令牌
3. 复制生成的 Token(格式:`ms-xxxxxx`)

### 在 WorkBuddy 中使用

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个可与 ModelScope 生态交互的 API 技能,核心能力应包括调用远程接口进行搜索、查询、下载,甚至在确认后执行部署/安装等变更操作。但提供的代码块只是 generate_screenshots.py:它创建图片画布、绘制静态文本并保存为 PNG 截图。代码中出现的 API 路径、安装命令和部署步骤都只是写入图片的展示内容,不会被实际执行,也没有网络访问、命令执行、用户确认或资源管理逻辑。因此该代码块的实际主要用途是生成文档/展示截图,而非实现所声明的技能功能,属于明显不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

整体上,这段代码确实与 ModelScope API 辅助相关,主方向与声明部分一致,但声明明显比实际实现更广。代码只实现了只读查询能力的一部分:技能、MCP、模型,以及底层的数据集查询函数;没有实现下载,也没有实现 Studio 相关接口。虽然声明包含“数据集”支持,但当前 CLI 入口没有 datasets 命令,因此对外可用能力与描述不完全一致。另一个小的未声明能力是可获取用户运行中的 MCP 服务器列表(list_operational_mcp),不过这不是主要偏差。综合来看,属于描述与实际行为存在实质性不一致。

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 87)May include surrounding context.

1.1 搜索/列出技能

bash
curl -s "https://www.modelscope.cn/openapi/v1/skills?page_number=1&page_size=10&search=股票" | python -m json.tool

Query 参数:

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 123)May include surrounding context.

1.2 获取技能详情(含安装命令)

bash
curl -s "https://www.modelscope.cn/openapi/v1/skills/@Alipay/alipay-payment-integration" | python -m json.tool

返回额外字段 install_command(3 种安装方式):

External Script Fetching

High
Category
Supply Chain
Confidence
98% confidence
Finding

The command curl -fsSL https://modelscope.cn/skills/install.sh | bash downloads a remote script and executes it immediately without verification. This is dangerous because any compromise of the server, CDN, TLS termination, or upstream script content results in arbitrary code execution on the user's machine.

Content

Scanner excerpt · SKILL.md (reported line 131)May include surrounding context.

md
{
  "install_command": [
    "npx skills add https://modelscope.cn/skills/@Alipay/alipay-payment-integration",
    "curl -fsSL https://modelscope.cn/skills/install.sh | bash -s -- @Alipay/alipay-payment-integration",
    "pip install --upgrade modelscope && modelscope skills add @Alipay/alipay-payment-integration"
  ]
}

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 181)May include surrounding context.

2.1 搜索/列出 MCP 服务器

bash
curl -s -X PUT "https://www.modelscope.cn/openapi/v1/mcp/servers" \
  -H "Content-Type: application/json" \
  -d '{"filter": {"category": "developer-tools"}, "page_number": 1, "page_size": 10, "search": ""}' | python -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 224)May include surrounding context.

2.2 获取 MCP 服务器详情(含配置)

bash
curl -s "https://www.modelscope.cn/openapi/v1/mcp/servers/@modelcontextprotocol/fetch?get_operational_url=true" | python -m json.tool

返回关键字段:

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 254)May include surrounding context.

2.3 获取用户运行中的 MCP 服务器(需 Token)

bash
curl -s "https://www.modelscope.cn/openapi/v1/mcp/servers/operational" \
  -H "Authorization: Bearer ms-xxxxxx" | python -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 286)May include surrounding context.

3.1 列出模型

bash
curl -s -X PUT "https://www.modelscope.cn/api/v1/models" \
  -H "Authorization: Bearer ms-xxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"page_number": 1, "page_size": 10, "search": "llama"}' | python -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 309)May include surrounding context.

3.2 获取模型详情

bash
curl -s "https://www.modelscope.cn/api/v1/models/{owner}/{name}" \
  -H "Authorization: Bearer ms-xxxxxx" | python -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 344)May include surrounding context.

4.1 列出数据集

bash
curl -s -X PUT "https://www.modelscope.cn/api/v1/datasets" \
  -H "Authorization: Bearer ms-xxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"page_number": 1, "page_size": 10, "search": "finance"}' | python -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 353)May include surrounding context.

4.2 获取数据集详情

bash
curl -s "https://www.modelscope.cn/api/v1/datasets/{namespace}/{name}" \
  -H "Authorization: Bearer ms-xxxxxx" | python -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 360)May include surrounding context.

4.3 获取数据集文件树

bash
curl -s "https://www.modelscope.cn/api/v1/datasets/{namespace}/{name}/repo/tree" \
  -H "Authorization: Bearer ms-xxxxxx" | python -m json.tool

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
83% confidence
Finding

The documentation recommends merge --allow-unrelated-histories, a flag that suppresses normal Git safety checks and can cause unrelated content to be merged into a repository. In a deployment workflow that uses tokens and push-based publication, this increases the risk of importing malicious or unintended history into a live project if followed blindly.

Content

Scanner excerpt · SKILL.md (reported line 446)May include surrounding context.

md
**Git 推送要点**:
- 默认分支 **`master`**(不是 `main`),禁止 force push
- 推送地址:`https://oauth2:${TOKEN}@www.modelscope.cn/studios/${owner}/${repo_name}.git`
- 首次推送前需 `fetch` + `merge --allow-unrelated-histories`

**Gradio 模式要求**:
- 入口文件:`app.py`(固定)

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README advertises deployment and management capabilities beyond the stated query/search/download-oriented scope, creating a scope mismatch that can mislead users and host systems about what actions the skill may attempt. In an agent environment, understated mutating capabilities increase the risk of unexpected state-changing operations being invoked without appropriate review or guardrails.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README highlights deployment and management functions but does not prominently warn users about the operational impact of those actions, such as creating cloud resources or changing remote state. In a skill catalog, missing user-facing warnings increases the chance that impactful actions are perceived as routine lookups and executed without adequate scrutiny.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Claiming access to the 'complete API' and full deployment/management features overstates the skill's authority and can cause users or orchestrators to trust it with broader privileges than intended. This is dangerous in tool-enabled agents because capability overclaiming undermines least-privilege assumptions and can normalize high-impact actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger keywords are broad and loosely scoped, making accidental invocation more likely when users discuss ModelScope-related topics casually. In an autonomous assistant context, broad triggers can activate external API interactions or capability discovery without sufficiently clear user intent.

Content

No source excerpt is available for this finding.