Back to skill

Security audit

Chanjing Tts

Security checks for vulnerabilities and agentic risk

Overview

This TTS skill appears purpose-aligned, but it needs review because stored credentials can be sent to an environment-selected endpoint and an adjacent login helper can be executed automatically.

Review before installing. Use it only in an environment where CHANJING_API_BASE is unset or pinned to the official HTTPS Chanjing API, protect ~/.chanjing/credentials.json with owner-only permissions, and inspect any adjacent chanjing-credentials-guard installation before allowing this skill to run. Do not automatically download returned audio URLs unless the destination is validated as an expected Chanjing media host.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_auth.py:13
Finding

Credentials, access tokens, and user content can be redirected to an arbitrary endpoint

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/_auth.py:61
Finding

Plaintext credential storage does not enforce restrictive filesystem permissions

Content
View full analysis
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/_auth.py:33
Finding

Unverified Python code from an adjacent Skill is executed automatically

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/poll_task.py:24
Finding

Task polling has no attempt limit or overall deadline

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/poll_task.py:50
Finding

API-controlled audio URL is exposed for downstream fetching without validation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (33)

Tainted flow: 'req' from os.environ.get (line 82, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
95% confidence
Finding

The destination for the token request is derived from CHANJING_API_BASE, and the request body contains app_id and secret_key. If an attacker can control the environment, they can redirect this authentication request to an arbitrary server and exfiltrate stored credentials.

Content

Scanner excerpt · scripts/_auth.py (reported line 89)May include surrounding context.

python
method="POST",
    )
    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            body = json.loads(resp.read().decode("utf-8"))
    except Exception as e:
        return None, str(e)

Credential Access

High
Category
Privilege Escalation
Confidence
84% confidence
Finding

The skill states it will execute open_login_page.py and open the default browser when credentials are missing. Triggering an auxiliary script and browser launch from a credential failure path expands the attack surface and can surprise users, especially in automated or high-trust agent environments where shell execution and external navigation should be explicit and tightly constrained.

Content

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

md
## How to Use This Skill

**前置条件(权限验证)**:执行本 Skill 前,必须先通过 **chanjing-credentials-guard** 完成 AK/SK 与 Token 校验。本 Skill 与 guard 使用同一套凭证(`~/.chanjing/credentials.json`);脚本在无凭证时会**执行 `open_login_page.py` 脚本**,在默认浏览器打开 AK/SK 注册/登录页,并提示配置命令。

### Reviewer Q&A (four items)

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

This section explicitly says the skill reads and writes credentials.json, may open a browser, and downloads audio from URLs returned by the API, asking the operator to trust those links. Downloading and following response-supplied URLs without documented allowlisting or validation can enable SSRF-like outbound access, unintended data exfiltration targets, or delivery of malicious content if the API or its responses are compromised.

Content

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

md
| # | Topic | Answer |
|---|-------|--------|
| **1** | **Purpose vs implementation; primary credential in registry text** | **Aligned**. This skill is a **Chanjing TTS** API client (list voices, create speech task, poll, fetch audio from **URLs in responses**). **`CHANJING_API_BASE` is not required** (default base URL). **Primary credential** is **`credentials.json`** (`app_id` / `secret_key`, refreshed **`access_token`**); stated in **`description`**, top English summary, and **Security & credentials** below. **`primaryEnv` omitted** (file-based dual keys). **No** `ffmpeg`/`ffprobe` in `metadata`. |
| **2** | **Runtime scope: secrets, arbitrary URLs** | **In scope**. Reads/writes **`CHANJING_CONFIG_DIR/credentials.json`**; may open **browser** / **`open_login_page.py`**; **HTTPS** to Open API; **downloads audio using URLs returned by the API**—**you must trust** the API host and those links. |
| **3** | **Env vars vs file-stored secrets** | **`CHANJING_CONFIG_DIR` / `CHANJING_API_BASE`** are optional. **AK/SK and token persist on disk**—sensitive; do not commit secrets; avoid echoing full keys in chat. |
| **4** | **Persistence & privilege** | Default **`always: false`**; **does not** modify other skills or global agent config. |

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The documented runtime scope includes reading/writing persistent credentials and downloading from API-returned links, with no mention of output validation or network restrictions. In an agent setting, that combination is risky because secrets and network egress are both in scope, and a compromised or misconfigured API could direct the skill to retrieve attacker-controlled resources.

Content

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

md
| # | Topic | Answer |
|---|-------|--------|
| **1** | **Purpose vs implementation; primary credential in registry text** | **Aligned**. This skill is a **Chanjing TTS** API client (list voices, create speech task, poll, fetch audio from **URLs in responses**). **`CHANJING_API_BASE` is not required** (default base URL). **Primary credential** is **`credentials.json`** (`app_id` / `secret_key`, refreshed **`access_token`**); stated in **`description`**, top English summary, and **Security & credentials** below. **`primaryEnv` omitted** (file-based dual keys). **No** `ffmpeg`/`ffprobe` in `metadata`. |
| **2** | **Runtime scope: secrets, arbitrary URLs** | **In scope**. Reads/writes **`CHANJING_CONFIG_DIR/credentials.json`**; may open **browser** / **`open_login_page.py`**; **HTTPS** to Open API; **downloads audio using URLs returned by the API**—**you must trust** the API host and those links. |
| **3** | **Env vars vs file-stored secrets** | **`CHANJING_CONFIG_DIR` / `CHANJING_API_BASE`** are optional. **AK/SK and token persist on disk**—sensitive; do not commit secrets; avoid echoing full keys in chat. |
| **4** | **Persistence & privilege** | Default **`always: false`**; **does not** modify other skills or global agent config. |

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 3)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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 35)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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 47)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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 87)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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 105)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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 116)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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 117)May include surrounding context.

md
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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/_auth.py (reported line 1)May include surrounding context.

python
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

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/_auth.py (reported line 12)May include surrounding context.

python
# 鉴权:与 chanjing-credentials-guard 使用同一配置文件(CONFIG_DIR/credentials.json)
# 实现:AK/SK 校验、Token 校验与刷新;无 AK/SK 时执行 open_login_page.py 打开注册/登录页
import json
import os

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill declares significant capabilities—environment access, reading and writing credential files, network access, and shell/browser invocation—but does not define an explicit permission or allowed-tools scope. That omission increases the chance an agent runtime grants broader access than users or reviewers expect, especially given the documented credential handling and external downloads.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

The skill explicitly states it will download audio from URLs contained in API responses and instructs reviewers to trust the returned URLs. Treating response-supplied URLs as trusted without documented validation is dangerous because it can turn the skill into an unrestricted fetcher, enabling attacker-controlled downloads, internal network probing, or retrieval of unexpected content if the upstream service is compromised.

Content

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

md
**Required vs optional**: **`CHANJING_API_BASE`** **optional** (default `https://open-api.chanjing.cc`). **`CHANJING_CONFIG_DIR`** optional. **No** `ffmpeg`/`ffprobe` in skill `metadata`.

**Purpose alignment**: **TTS** client—list voices, create task, poll, **download audio from URLs in API responses**. **Trust** the API host and returned URLs.

See **How to Use** → **Reviewer Q&A (four items)** → **Security & credentials (registry summary)**.

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

The documented workflow requires polling until success and then downloading the generated audio from a URL in the response, again without any stated restriction on the destination. In this skill context, the combination of persistent credentials, network access, and response-driven downloads makes the behavior more dangerous because a single compromised API response can direct outbound traffic to unintended hosts.

Content

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

md
1. Obtain an `access_token`, which is required for all subsequent API calls
2. List all voice IDs and select one to use
3. Call the Create Speech API, record `task_id`
4. Poll the Query Speech Status API until success, then download generated audio file using the url in response

### Obtain AccessToken

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes this skill as converting text to speech via the Chanjing TTS API, with credentials stored in credentials.json. This helper also launches a separate login/registration experience in the user's browser, which is a broader user-auth/onboarding behavior not reflected in the stated skill purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

A text-to-speech skill is expected to read credentials and call the TTS API, but invoking subprocesses to execute another skill's script introduces a separate execution capability. That behavior is not obviously required by the manifest's stated purpose, especially since the manifest only mentions credential files and optional configuration variables.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code automatically executes another script via subprocess and may open the user's default browser when credentials are missing or invalid. This is a system-affecting action, but the file provides no prompt, log, or other user-visible disclosure before triggering it; the returned message is only produced after the action has already occurred.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/_auth.py (reported line 36)May include surrounding context.

python
skills_dir = Path(__file__).resolve().parent.parent.parent
        script = skills_dir / "chanjing-credentials-guard" / "scripts" / "open_login_page.py"
        if script.exists():
            subprocess.run([sys.executable, str(script)], check=False, timeout=5)
        else:
            import webbrowser
            webbrowser.open(LOGIN_URL)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The function writes access tokens and related credentials to CONFIG_DIR/credentials.json, which affects user data on disk. Although comments describe authentication behavior, there is no user-facing prompt, log, print, or other disclosure at the point of writing to inform the user that secrets and refreshed tokens are being persisted locally.

Content

No source excerpt is available for this finding.

Tainted flow: 'CONFIG_FILE' from os.environ.get (line 12, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
84% confidence
Finding

The credential file path is influenced by CHANJING_CONFIG_DIR from the environment and is written without validation or permission hardening. In a hostile execution environment, an attacker could redirect writes to an unintended filesystem location, causing credential leakage or overwriting sensitive files accessible to the running user.

Content

Scanner excerpt · scripts/_auth.py (reported line 57)May include surrounding context.

python
def write_config(data):
    CONFIG_DIR.mkdir(parents=True, exist_ok=True)
    with open(CONFIG_FILE, "w", encoding="utf-8") as f:
        json.dump(data, f, indent=2, ensure_ascii=False)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The token refresh flow transmits app_id and secret_key to a remote API endpoint over HTTP(S). While this is plausibly part of the authentication purpose, this file contains no user-facing warning, prompt, or runtime disclosure that locally stored credentials will be sent to the service to obtain a token.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/create_task.py (reported line 16)May include surrounding context.

python
sys.path.insert(0, str(Path(__file__).resolve().parent))
from _auth import get_token

API_BASE = __import__("os").environ.get("CHANJING_API_BASE", "https://open-api.chanjing.cc")


def main():

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/list_voices.py (reported line 17)May include surrounding context.

python
sys.path.insert(0, str(Path(__file__).resolve().parent))
from _auth import get_token

API_BASE = __import__("os").environ.get("CHANJING_API_BASE", "https://open-api.chanjing.cc")


def main():