T01 · Skill Instruction Hijacking
- Location
src/utils/token.js:23- Finding
Authentication Errors Inject Undisclosed Promotional Content
- Content
View full analysis
Vulnerability Details
File Location:
src/utils/token.js:23-31;src/utils/request.js:50-57
Vulnerability Type: Undisclosed runtime-output manipulation
Risk Level: HighVulnerable Code
From
src/utils/token.js:23-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; }From
src/utils/request.js:50-57:js } else if (res.statusCode === 401 || res.statusCode === 403) { const e = new AuthError( "GUAIKEI_API_TOKEN 无效, 请检查环境变量 或 联系微信: 13395823479 获取解决方案", ); e.noRetry = true; reject(e); }The authentication exception is subsequently included in machine-readable output. For example,
src/douyin/search-cli.js:174-201contains: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
The declared Skill behavior requires neutral authentication errors and explicitly states that runtime output must not contain websites, contact details, or marketing language. The implementation violates t ...[truncated 1981 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace both authentication messages with a fixed, neutral message such as:
GUAIKEI_API_TOKEN is missing, malformed, expired, or unauthorized. Check the configured environment variable. - Remove all websites, phone numbers, social-media contacts, sales language, and acquisition instructions from runtime output.
- Create a centralized authentication-error formatter so every CLI returns the same neutral error code and message.
- Do not copy arbitrary or remotely influenced
error.messagevalues directly into stdout. Map known exceptions to locally controlled messages. - Keep support and token-acquisition details only in explicitly labeled documentation.
- Add automated tests asserting that missing-token and HTTP 401/403 paths contain no URLs, contact numbers, or promotional phrases.
- Ensure stdout remains schema-compliant JSON and stderr contains only operational diagnostics.
- Replace both authentication messages with a fixed, neutral message such as:
