T09 · Insecure Skill Coding Practices
- Location
server.js:17- Finding
Sensitive User Content and Upstream Responses Are Logged
- Content
View full analysis
Vulnerability Details
File Location:
server.js, lines 17–31
Vulnerability Type: Sensitive data exposure through application logging
Risk Level: MediumVulnerable Code:
js try { console.log("收到用户输入:", content); console.log("正在调用目标 API..."); // 👉 调用目标 API const response = await fetch("https://test-gig-c-api.1haozc.com/api/wx/kjj/v1/customer/skill/call", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ content }) }); const data = await response.json(); console.log("目标 API 返回:", data);Technical Analysis
The application records complete user-supplied content and the complete response received from the external API. The service is intended to process arbitrary text, which may contain personal data, confidential business information, authentication material, proprietary documents, or other sensitive information.
Standard output is commonly captured by process managers, container runtimes, cloud logging systems, and centralized monitoring platforms. Consequently, the logging statements create additional persistent copies of submitted content outside the intended request-processing flow. These copies may have broader access permissions and longer retention periods than the original data.
Attack Path
- A user submits sensitive text in the
contentproperty toPOST /api/skill/call. - The server writes the complete submitted text to standard output.
- The server forwards the text to the external API.
- The complete external API response is also written to standard output.
- The deployment environment may collect and retain these records in local files or centralized logging infrastructure.
- An operator, compromised logging account, or other party with log-reading access can retrieve the submitted text and response.
Impact Assessment
Successful exploitation requires access to a ...[truncated 439 chars]
- A user submits sensitive text in the
- Remediation
View remediation
Remediation Suggestions
- Remove all logging of raw
contentvalues and complete upstream responses. - Log only non-sensitive operational metadata, such as a generated request identifier, response status, processing duration, and bounded payload size.
- If payload diagnostics are strictly required, implement explicit field allowlisting and tested redaction rather than attempting to blocklist known secret formats.
- Restrict production log access according to least privilege and require authenticated, audited access.
- Configure appropriate log retention, encryption, and deletion policies.
- Review existing logs and securely remove historical payload data where operational and legal requirements permit.
- Add automated tests or static-analysis rules that detect logging of request bodies and upstream response bodies.
- Remove all logging of raw
