Back to skill

Security audit

Apicheck

Security checks for vulnerabilities and agentic risk

Overview

The API helper is mostly low-risk, but the package includes an under-disclosed, purpose-mismatched workflow script that writes persistent local history.

Review this before installing because the visible API assistant behavior is mostly documentation-oriented, but the package also contains an unrelated apicheck workflow script that can write command arguments to a persistent local history file. Avoid passing secrets or tokens to its commands, and prefer installation only after the publisher removes or documents the extra workflow script and its local logging.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:5
Finding
Persistent Plaintext Logging of Unsanitized Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh`, lines 5-7, 31, and 34-77 **Vulnerability Type**: Plaintext sensitive-data exposure and log injection **Risk Level**: Medium ### Vulnerable Code ```bash DATA_DIR="${APICHECK_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/apicheck}" DB="$DATA_DIR/data.log" mkdir -p "$DATA_DIR" ``` ```bash _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; } ``` ```bash cmd_init() { echo " Project initialized in $(pwd)" _log "init" "${1:-}" } cmd_check() { echo " Running lint + type check + tests..." _log "check" "${1:-}" } cmd_build() { echo " Building..." _log "build" "${1:-}" } cmd_test() { echo " Running test suite..." _log "test" "${1:-}" } cmd_deploy() { echo " Deploy: build -> test -> stage -> prod" _log "deploy" "${1:-}" } cmd_config() { echo " Config: $DATA_DIR/config.json" _log "config" "${1:-}" } cmd_status() { echo " Status: checking project health..." _log "status" "${1:-}" } cmd_template() { echo " Template for: $1" _log "template" "${1:-}" } cmd_docs() { echo " Generating docs..." _log "docs" "${1:-}" } cmd_clean() { echo " Cleaned build artifacts" _log "clean" "${1:-}" } ``` ### Technical Analysis The script creates a persistent data directory and writes the first argument supplied to each operational command directly to `history.log`. The argument is not redacted, validated, length-limited, or escaped before it is stored. If a caller supplies an API token, password, internal URL containing credentials, customer data, or another secret as the first command argument, that value will be retained in plaintext. The script does not set a restrictive `umask` or explicitly assign `0700` permissions to the directory and `0600` permissions to the log. Effective access therefore depends on the invoking environment's existing umask and filesystem controls. The direct use of `echo` ...[truncated 2065 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove command-argument logging if it is not essential to the documented Skill functionality. 2. If logging is required, record only an explicit allowlist of non-sensitive metadata, such as the command name and result status. Do not log arbitrary user-provided arguments. 3. Redact known secret formats and fields, including authorization headers, bearer tokens, passwords, API keys, cookies, and credential-bearing URLs. 4. Reject or escape control characters before logging. Use a structured format and safe serialization rather than concatenating untrusted text into a line-oriented log. 5. Create local state with restrictive permissions: ```bash umask 077 mkdir -p -m 700 "$DATA_DIR" touch "$DATA_DIR/history.log" chmod 600 "$DATA_DIR/history.log" ``` 6. Add retention limits and provide a documented mechanism for inspecting and deleting stored history. 7. Disclose all persistent state creation and logging behavior in `SKILL.md`. 8. Add tests verifying that secrets are not retained and that embedded newlines or other control characters cannot forge log records. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description centers on API-focused assistance: request construction, curl generation, mock data, API docs/help, and HTTP status/header reference. The supplied code does not implement any of those functions. Instead, it is a generic developer workflow shell tool that prints placeholder messages for project lifecycle commands and records activity in a local data directory. This is a materially different primary purpose and includes undeclared capabilities such as project automation commands and filesystem logging/persistence.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The script's actual behavior is a generic developer workflow CLI with commands like init, build, test, deploy, and clean, which materially differs from the manifest describing an API request/curl/mock/documentation helper. This mismatch is dangerous because users or automated systems may grant the skill trust, permissions, or execution in contexts intended for low-risk API assistance, while it exposes unrelated operational workflow actions and creates room for deceptive repackaging or abuse.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
application/octet-stream                 # 二进制
```

## curl 常用参数
```bash
-X METHOD        # 指定HTTP方法
-H "header"      # 添加请求头
Confidence
60% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
application/octet-stream                 # 二进制
```

## curl 常用参数
```bash
-X METHOD        # 指定HTTP方法
-H "header"      # 添加请求头
Confidence
60% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
GET    /api/v1/users/{id}     # 详情
PUT    /api/v1/users/{id}     # 全量更新
PATCH  /api/v1/users/{id}     # 部分更新
DELETE /api/v1/users/{id}     # 删除

# 子资源
GET    /api/v1/users/{id}/orders
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill invokes a shell script (`bash scripts/api.sh <command>`) and appears capable of shell and likely network activity, but it does not declare any `permissions` or `allowed-tools` scope. This creates an authorization gap where an agent may run code with broader capabilities than users or platform policy can easily inspect, increasing the risk of unintended command execution or external requests.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger keywords are very broad (`api`, `http`, `curl`, `请求`, `headers`, etc.) and overlap with ordinary technical discussion, making accidental invocation likely. In a skill that can launch shell commands, overbroad triggering increases the chance that the agent executes the skill in contexts where the user only wanted explanation, not code generation or script execution.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This shell skill embeds all user-facing instructions and examples in Chinese, but nowhere indicates that the user may choose another language or that the skill is intentionally limited to a Chinese-speaking context. The policy requires flagging language or locale constraints when they are forced without user opt-in or clear justification.

External Transmission

Medium
Category
Data Exfiltration
Content
━━━━━━━━━━

方法: POST
URL:  https://api.example.com/v1/users
Headers:
  Content-Type: application/json
  Authorization: Bearer xxx
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
━━━━━━━━━━

方法: POST
URL:  https://api.example.com/v1/users
Headers:
  Content-Type: application/json
  Authorization: Bearer xxx
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
━━━━━━━━━━

方法: POST
URL:  https://api.example.com/v1/users
Headers:
  Content-Type: application/json
  Authorization: Bearer xxx
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
━━━━━━━━━━

方法: POST
URL:  https://api.example.com/v1/users
Headers:
  Content-Type: application/json
  Authorization: Bearer xxx
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
━━━━━━━━━━

方法: POST
URL:  https://api.example.com/v1/users
Headers:
  Content-Type: application/json
  Authorization: Bearer xxx
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
💻 代码示例:

curl:
  curl -X POST 'https://api.example.com/v1/users' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer xxx' \
    -d '{"name":"张三","email":"zhangsan@example.com"}'
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
Python (requests):
  import requests
  resp = requests.post(
      'https://api.example.com/v1/users',
      headers={'Authorization': 'Bearer xxx'},
      json={'name': '张三', 'email': 'zhangsan@example.com'}
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
Python (requests):
  import requests
  resp = requests.post(
      'https://api.example.com/v1/users',
      headers={'Authorization': 'Bearer xxx'},
      json={'name': '张三', 'email': 'zhangsan@example.com'}
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
)

JavaScript (fetch):
  fetch('https://api.example.com/v1/users', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
curl -s -X POST ... | jq .

# 带状态码输出
curl -s -o /dev/null -w "%{http_code}" -X POST ...

# 保存响应到文件
curl -o response.json -X POST ...
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The inline comments and help output explicitly present the tool as a 'Developer workflow automation tool,' contradicting the manifest's API-helper description. This inconsistency increases the risk of social engineering and misclassification during review, because operators may rely on manifest metadata while the file itself advertises a different purpose and command set.

External Transmission

Medium
Category
Data Exfiltration
Content
application/octet-stream                 # 二进制
```

## curl 常用参数
```bash
-X METHOD        # 指定HTTP方法
-H "header"      # 添加请求头
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The documentation recommends curl's -k option, which disables TLS certificate validation and enables man-in-the-middle interception or connection to spoofed endpoints. In an API testing skill, users may copy commands directly into real environments, so presenting this flag without a strong warning normalizes an unsafe practice.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
Most user-facing instructions, command descriptions, and trigger guidance are presented in Chinese, while the file does not state that the skill is region-specific or offer the user a language/locale choice. This can amount to a locale-policy issue because it implicitly assumes a specific language for interaction without opt-in.

Static analysis

No suspicious patterns detected.