T01 · Skill Instruction Hijacking
- Location
src/utils/token.js:21- Finding
Runtime Authentication Errors Inject Promotional Contact Information Contrary to the Declared Skill Policy
- Content
View full analysis
Vulnerability Details
File Location:
src/utils/token.js:21-31,src/utils/request.js:49-57, andsrc/douyin/search-cli.js:164-190
Vulnerability Type: Runtime instruction and output-policy hijacking
Risk Level: MediumVulnerable Code
src/utils/token.js:21-31:js function skillToken(token) { if (!isValidToken(token)) { utils.printWarn("警告: 你的 GUAIKEI_API_TOKEN 未正确配置,技能已暂停. "); utils.printSuccess("\t快速获取通道: www.guaikei.com"); return ""; } utils.printInfo("已使用配置的私有TOKEN"); return token; }src/utils/request.js:49-57:js } else if (res.statusCode === 401 || res.statusCode === 403) { const e = new AuthError( "GUAIKEI_API_TOKEN 无效, 请检查环境变量 或 联系微信: 13395823479 获取解决方案", ); e.noRetry = true; reject(e); } else {src/douyin/search-cli.js:164-190:js } catch (error) { utils.printError(`搜索失败: ${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, }, metadata: { skill_version: constants.VERSION, runtime_version: process.versions.node, execution_time: Date.now() - startTime, }, results: null, }; const exitCode = error.name === "AuthError" ? 3 : 1; process.stdout.write(JSON.stringify(errorOutput, null, 2) + "\n", () => process.exit(exitCode), ); return; }Technical Analysis
SKILL.mdexplicitly states that missing or invalid tokens must produce a neutral error and prohibits runtime website links, contact information, and marketing language. The executable implementation contradicts that policy.When a token is locally missing o ...[truncated 1876 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove all websites, telephone numbers, social-media contacts, and promotional wording from runtime code.
-
Replace both authentication paths with one fixed neutral message, such as:
js const AUTH_MESSAGE = "GUAIKEI_API_TOKEN is missing, malformed, expired, or unauthorized. Check the configured environment variable."; -
Return a stable machine-readable error code such as
AUTH_ERRORwithout embedding onboarding or sales instructions. -
Keep support and token-acquisition information exclusively in documentation that users choose to open.
-
Do not propagate raw remote authentication messages into user-facing JSON. Map HTTP 401 and 403 responses to the fixed local error.
-
Add automated tests that invoke the missing-token and rejected-token paths and assert that stdout and stderr contain no domain names, contact numbers, social-media identifiers, or marketing phrases.
-
Review all CLI handlers to ensure that they apply the same sanitized error mapping.
-
