T09 · Insecure Skill Coding Practices
- Location
index.js:52- Finding
Raw Internal Error Disclosure
- Content
View full analysis
Vulnerability Details
File Location:
index.js:52
Vulnerability Type: Unfiltered exception disclosure
Risk Level: LowVulnerable Code:
javascript } catch (error) { return { success: false, message: '计费校验失败:' + error.message }; }Technical Analysis
The main entry point concatenates
error.messagedirectly into its caller-visible response. Exceptions may originate from the billing SDK, filesystem operations, invalid arguments, or Node.js module loading. Their messages can contain internal file paths, package and module names, service details, or upstream diagnostic information.The project also invokes
require('./excel-handler'), while that module was absent from the audited package. If an entitled user reaches this code path, Node.js may generate a module-resolution error containing internal implementation and path information, which the catch block then returns without filtering.Attack Path
- An attacker invokes
mainusing an account that passes the permanent-purchase check, or supplies inputs that provoke a billing or processing exception. - Execution reaches
cleanExcel(fileParams.path)or another failing SDK operation. - The missing handler, malformed parameters, filesystem failure, or SDK failure raises an exception.
- The catch block reads the raw
error.message. - The application returns that message to the attacker, potentially disclosing internal paths or dependency and service details.
Impact Assessment
This issue does not directly grant code execution, elevated privileges, or unauthorized data access. It can disclose implementation details useful for reconnaissance and for refining subsequent attacks. The scope is limited to diagnostic information present in exceptions generated by reachable operations.
- An attacker invokes
- Remediation
View remediation
Remediation Suggestions
- Return a generic caller-facing error such as
The request could not be completed. - Record detailed diagnostics only in a restricted server-side logging system.
- Avoid logging secrets, payment details, access tokens, or unnecessary user data.
- Assign a correlation ID to each failure and return only that identifier to the caller.
- Validate
userId,fileParams, andfileParams.pathbefore invoking SDK or file-processing operations. - Add the required
excel-handlerimplementation before deployment and handle expected module and processing failures with predefined, non-sensitive messages.
Example hardening:
javascript } catch (error) { const incidentId = createIncidentId(); logger.error({ incidentId, error }, 'Excel skill execution failed'); return { success: false, message: `The request could not be completed. Reference: ${incidentId}` }; }- Return a generic caller-facing error such as
