Back to skill

Security audit

知犀思维导图

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a legitimate Zhixi mind-map cloud integration, but it handles cloud credentials and uploads local files with under-scoped disclosure and a few security weaknesses users should review first.

Install only if you intend to connect Codex to your Zhixi cloud account. Prefer ZHIXI_API_KEY from a managed secret or environment variable rather than a token file, avoid importing sensitive local files unless you mean to upload them to Zhixi, and review cloud actions before allowing the skill to run them automatically.

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/zhixi-files.js:55
Finding

Unrestricted Fetch of an API-Supplied URL Enables Server-Side Request Forgery

Content
View full analysis

Vulnerability Details

File Location: scripts/zhixi-files.js, lines 55-58
Vulnerability Type: Server-Side Request Forgery through an unvalidated remote URL
Risk Level: Medium

Vulnerable Code

javascript
async getContent(fileId) {
  const api = `${CONFIG.baseUrl}/v1/file/details?file_guid=${fileId}`;
  const result = await this._fetch(api);
  if (result.code !== 0) return result;
  // console.debug(result.data?.content_url);
  const response = await fetch(result.data?.content_url);
  return response.json();
}

Technical Analysis

The getContent method obtains content_url from an API response and passes it directly to fetch. It does not validate the URL's protocol, hostname, port, resolved IP address, or redirect destination.

Node's fetch follows HTTP redirects by default. Consequently, validating only the initial URL would also be insufficient unless every redirect target is checked. If an attacker can influence a file record or the upstream API response, the URL could point to a loopback address, private network service, link-local endpoint, cloud instance metadata service, or another destination accessible from the host running this skill.

Exploitation depends on the attacker gaining influence over result.data.content_url, such as through malicious cloud-file metadata, an upstream service compromise, or another flaw in the remote service. The audited code does not independently establish that ordinary users can modify this field.

Attack Path

  1. An attacker gains the ability to influence the content_url returned for a requested file.
  2. The attacker supplies a URL targeting an internal resource, such as a loopback service, private-network endpoint, or metadata service. Alternatively, the URL points to an attacker-controlled server that redirects to such a resource.
  3. A user or agent invokes content <file_guid> for the affected file.
  4. The skill requests th ...[truncated 1198 chars]
Remediation
View remediation

Remediation Suggestions

  • Parse content_url with the standard URL class and reject malformed values.
  • Require HTTPS and enforce an explicit allowlist of documented Zhixi content-delivery hostnames.
  • Resolve the destination and reject loopback, private, link-local, multicast, unspecified, and reserved IPv4 and IPv6 ranges.
  • Disable automatic redirects with redirect: "manual", or validate the destination of every redirect before following it.
  • Protect against DNS rebinding by validating the address actually used for the connection, not only a preliminary DNS lookup.
  • Apply connection timeouts and strict response-size limits.
  • Require an expected content type before parsing the response as JSON.
  • Reject a missing content_url with an explicit error rather than passing it to fetch.

Example validation policy:

javascript
function validateContentUrl(value) {
  const url = new URL(value);
  const allowedHosts = new Set([
    // Populate with the provider's documented content hosts.
    'approved-content-host.example'
  ]);

  if (url.protocol !== 'https:' || !allowedHosts.has(url.hostname)) {
    throw new Error('Untrusted content URL');
  }

  return url.toString();
}

const contentUrl = validateContentUrl(result.data?.content_url);
const response = await fetch(contentUrl, {
  redirect: 'manual',
  signal: AbortSignal.timeout(10_000)
});

T09 · Insecure Skill Coding Practices

Note
Location
scripts/zhixi-files.js:13
Finding

Reusable API Token May Be Stored in an Unprotected Plaintext Project File

Content
View full analysis

Vulnerability Details

File Location: scripts/zhixi-files.js, lines 13-17; documented in SKILL.md, lines 17-24
Vulnerability Type: Insecure plaintext credential storage
Risk Level: Low

Vulnerable Code

javascript
const tokenPath = path.join(SKILL_DIR, 'token');
if (fs.existsSync(tokenPath)) {
  const token = fs.readFileSync(tokenPath, 'utf8').trim();
  if (token) return token;
}

The corresponding documentation explicitly recommends the project-local file as a configuration option:

markdown
### Token Configuration (Choose one of two)(Token 配置 二选一)
1. **Environment Variable**: `export ZHIXI_TOKEN="your_token"`
2. **Local File**: Create a `token` file in the skill directory and write the Token inside.

Technical Analysis

The fallback credential mechanism reads a reusable API token from a plaintext file located directly in the skill directory. The implementation does not verify file ownership, reject symbolic links, or ensure restrictive permissions such as mode 0600. The documentation also does not instruct users to secure the file or exclude it from source control, archives, and packaged skill distributions.

A project-local secret is more likely to be copied into backups, shared archives, container build contexts, or source-control commits. On a multi-user system, permissive default file permissions may also make it readable by other local accounts.

There is an additional configuration inconsistency: SKILL.md documents ZHIXI_TOKEN, while the implementation reads ZHIXI_API_KEY. Users following the documented environment-variable instructions may therefore encounter a failure and resort to the less secure plaintext-file fallback.

Attack Path

  1. A user follows the documented configuration procedure and creates token in the skill directory.
  2. The file is created with permissive permissions, copied into an archive or backup, included in a build context, or acc ...[truncated 1034 chars]
Remediation
View remediation

Remediation Suggestions

  • Prefer an operating-system credential manager, orchestrator-managed secret, or environment-based secret injection.
  • Align the documented and implemented environment-variable name. For example, consistently use ZHIXI_API_KEY.
  • Store any fallback credential outside the project and source tree.
  • If file-based storage must remain, require the file to be owned by the current user and have mode 0600 on platforms that support POSIX permissions.
  • Use lstat and reject symbolic links or unexpected file types before reading the credential.
  • Add token and other secret-file patterns to .gitignore, packaging exclusions, container ignore files, and backup exclusions.
  • Warn clearly that the token must never be committed, shared, logged, or included in a distributable skill package.
  • Support token rotation and advise immediate revocation if accidental disclosure occurs.
  • Consider accepting a configurable secret path rather than forcing storage under SKILL_DIR.

A defensive permission check could resemble:

javascript
const stat = fs.lstatSync(tokenPath);

if (!stat.isFile() || stat.isSymbolicLink()) {
  throw new Error('Token path must be a regular, non-symbolic file');
}

if (process.platform !== 'win32' && (stat.mode & 0o077) !== 0) {
  throw new Error('Token file permissions must be 0600');
}
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/zhixi-files.js

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/zhixi-files.js

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/zhixi-files.js

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/zhixi-files.js

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/zhixi-files.js

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/zhixi-files.js

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

]

text

## Display Rules (展示规则)

### Formatted Output (格式化输出)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill documents use of environment variables/local token files and networked cloud-file operations, but the manifest does not declare any explicit tool scope or permissions boundary. This can cause the agent or reviewer to underestimate external access and credential handling, increasing the risk of unintended data access or token exposure in a cloud-integrated skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The activation trigger includes broad terms like 'Mind Map' and related ordinary phrases, which can cause the skill to activate in unrelated conversations. Over-broad triggering is risky for a skill with cloud file access because it may pull in external data or initiate sensitive operations without sufficiently specific user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill advertises browsing, viewing, and Markdown import against a cloud service without an explicit warning that it may access or modify external user data. Lack of upfront disclosure can mislead users about the sensitivity of the operation and increase the chance of unintended reads or writes to cloud-stored content.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation instructs the agent to go beyond the declared manifest scope by helping users create content directly and attaching editing links, while the manifest only covers browsing, searching, viewing, and Markdown import. Scope drift is dangerous because it can normalize actions with write/edit implications that users and security controls did not explicitly authorize.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The import path reads arbitrary local file content or stdin and uploads it to the Zhixi remote API, but the code provides no explicit warning, confirmation, or clear user-facing indication that local data will leave the machine. In an agent/skill context, this increases the risk of unintended exfiltration because a user may believe they are performing a local file operation when the content is actually transmitted to a third-party service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The client hard-codes the Accept-language header to zh-CN,zh;q=0.9, which imposes a specific locale for all requests. There is no indication in this file that the user can opt into this language setting or override it.

Content

No source excerpt is available for this finding.