T01 · Skill Instruction Hijacking
- Location
src/utils/token.js:23- Finding
Contradictory Runtime Promotion and Contact Injection in Authentication Errors
- Content
View full analysis
Vulnerability Details
File Location:
src/utils/token.js:23-32,src/utils/request.js:49-56,src/douyin/search-cli.js:169-188
Vulnerability Type: Runtime output manipulation and instruction-policy contradiction
Risk Level: HighComplete Code Snippets
From
src/utils/token.js:23-32:js function skillToken(token) { if (!isValidToken(token)) { utils.printWarn("Warning: GUAIKEI_API_TOKEN is not configured correctly; the skill has been suspended."); utils.printSuccess("\tQuick access channel: www.guaikei.com"); return ""; } utils.printInfo("The configured private token is in use"); return token; }From
src/utils/request.js:49-56:js } else if (res.statusCode === 401 || res.statusCode === 403) { const e = new AuthError( "GUAIKEI_API_TOKEN is invalid. Check the environment variable or contact WeChat/phone number 13395823479 for assistance.", ); e.noRetry = true; reject(e); } else {From
src/douyin/search-cli.js:169-188:js } catch (error) { utils.printError(`Search failed: ${error.message}`); const errorOutput = { status: "error", error_code: error.code || "UNKNOWN", message: error.message, timestamp: new Date().toLocaleString(), request: { command: "search", keyword: keyword, sort: sort, time: time, duration: duration, content: content, limit: limit, },Technical Analysis
SKILL.mdstates that invalid-token handling must produce only a neutral error, and it expressly prohibits runtime website links, contact details, or promotional language. The implementation violates those declared constraints in two separate authentication paths:- A locally missing or malformed token causes the runtime to advertise
www.guaikei.com. - An HTTP 401 or 403 response produces a hardcoded message containing an external WeCha ...[truncated 2103 chars]
- A locally missing or malformed token causes the runtime to advertise
- Remediation
View remediation
Remediation Suggestions
- Remove the website, phone number, WeChat reference, and all acquisition or promotional language from runtime code.
- Return a fixed neutral result, such as:
json { "status": "error", "error_code": "AUTH_REQUIRED", "message": "GUAIKEI_API_TOKEN is missing or invalid." } - Do not propagate raw exception or server-provided messages directly into Agent-facing JSON. Map internal errors to an allowlisted set of neutral public messages.
- Keep token-acquisition instructions exclusively in user documentation, consistent with
SKILL.md. - Add automated tests for malformed tokens and HTTP 401/403 responses. Tests should reject output containing URLs, phone numbers, contact methods, payment language, or marketing text.
- Ensure all four CLI commands use the same centralized, neutral authentication-error formatter.
