T09 · Insecure Skill Coding Practices
- Location
scripts/video_face_change.js:77- Finding
Undeclared JSON Properties Are Transmitted to the WeryAI API
- Content
View full analysis
Vulnerability Details
File Location:
scripts/video_face_change.js:77-78, with the transmission sink atscripts/video_face_change.js:156-164and invocation atscripts/video_face_change.js:451-501
Vulnerability Type: Unrestricted outbound payload construction
Risk Level: MediumComplete Code Snippet
js function buildPayload(spec, input) { const payload = { ...spec.defaults, ...(input || {}) }; if (typeof spec.preparePayload === "function") spec.preparePayload(payload); if (payload.rect_vo_list != null) payload.rect_vo_list = normalizeRectList(payload.rect_vo_list); return payload; }The resulting object is serialized in full and sent to the remote service:
js async function httpJson(method, url, body, apiKey) { const headers = { "Content-Type": "application/json" }; if (apiKey) headers.Authorization = `Bearer ${apiKey}`; const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), 30000); try { const res = await fetch(url, { method, headers, body: body != null ? JSON.stringify(body) : undefined, signal: controller.signal, });Submission is performed after validation without rejecting unknown properties:
js const payload = buildPayload(spec, parseJsonInput(args.json)); const validationErrors = validatePayload(spec, payload); // ... const submitResult = await submitTool(spec, payload, apiKey);Technical Analysis
The documented input surface consists of
video_urlandimage_url. However,buildPayloaduses object spread on the complete parsed JSON input. This retains every caller-supplied property rather than constructing the outbound request from an explicit allowlist.validatePayloadverifies required fields and known URL fields, but it does not reject unknown keys.httpJsonthen serializes the entire object withJSON.stringify(body). As a ...[truncated 1658 chars]- Remediation
View remediation
Remediation Suggestions
Construct the outbound payload using an explicit allowlist:
js function buildPayload(spec, input = {}) { return { video_url: input.video_url, image_url: input.image_url, }; }Alternatively, define a complete
allowedFieldslist in the tool specification and reject unknown properties before submission:js const allowedFields = new Set(["video_url", "image_url"]); const unknownFields = Object.keys(input || {}).filter( (key) => !allowedFields.has(key) ); if (unknownFields.length > 0) { throw new Error(`Unsupported fields: ${unknownFields.join(", ")}`); }Additional hardening should include:
- Validate URLs with the standard
URLparser and require thehttps:protocol instead of relying only on a string prefix. - Keep dry-run previews limited to allowlisted fields.
- Add tests proving that unknown keys, especially secret-like fields, are rejected and never reach
fetch. - Add a required confirmation mechanism, such as
--confirmed, before paidsubmitorwaitoperations so the implementation enforces the mandatory confirmation gate documented inSKILL.md.
- Validate URLs with the standard
