T09 · Insecure Skill Coding Practices
- Location
scripts/feishu_wiki_sync.sh:13- Finding
Unvalidated Feishu API Base URL Can Expose Credentials and Uploaded File Content
- Content
View full analysis
&2 exit 1 fi # 2. Read file content CONTENT=$(cat "$FILE") # 3. Create or update Wiki document # This is a simplified example — production use should convert Markdown # to Feishu Docx blocks via the docx API. PAYLOAD=$(jq -n \ --arg title "Common Responses" \ --arg content "$CONTENT" \ '{title: $title, content: $content}') HTTP_CODE=$(curl -s -o /tmp/feishu_resp.json -w "%{http_code}" \ -X POST "${FEISHU_BASE_URL}/wiki/v2/spaces/${SPACE_ID}/nodes/${NODE_TOKEN}/docs" \ -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" \ -d "$PAYLOAD") ``` ### Technical Analysis The script accepts `FEISHU_BASE_URL` directly from the execution environment without validating its scheme or hostname. It subsequently sends the Feishu application ID and secret to a token endpoint derived from that value. After receiving a response, the script extracts `.tenant_access_token` without verifying that the response originated from an approved Feishu domain. It then sends that token and the complete contents of the user-selected file to another endpoint under the same configurable base URL. Consequently, any party capable of influencing the environment used to execute the script can redirect both requests to an attacker-controlled service. HTTPS alone does not prevent this atta ...[truncated 1694 chars]- Remediation
View remediation
