T09 · Insecure Skill Coding Practices
- Location
get_feishu_token.sh:4- Finding
Hard-Coded Feishu Application Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill’s Feishu upload purpose is clear, but it needs review because it bundles credentials, exposes tokens, stores them insecurely, and can perform network side effects during installation.
Review before installing. Only use this with a Feishu app you control, rotate the bundled secret if it is real, remove token/log disclosure, store credentials in a proper secret store, and disable installation-time token retrieval or upload tests unless the user explicitly opts in.
get_feishu_token.sh:4Hard-Coded Feishu Application Credentials
get_feishu_token.sh:17Bearer Tokens Disclosed Through Logs and Insecure Local Storage
feishu_upload_simple.sh:53Bearer Token and File Forwarded to an Unvalidated Upload URL
simple_feishu_upload.js:47Undeclared and Unpinned Runtime Dependency
install.sh:78Installer Can Perform an Undocumented Authenticated File Upload
The script reads a bearer token from disk and then echoes part of it to stdout. Even partial credential disclosure is sensitive because logs, terminals, CI output, or shell history can expose enough information to aid token theft correlation or reveal secrets to unintended viewers.
The line prints the access token prefix directly to stdout. Console output is commonly captured by logs, orchestration systems, remote terminals, and transcripts, so this creates a straightforward credential exposure path.
The script explicitly exposes sensitive authentication material in user-visible output via echo "使用访问令牌: ${ACCESS_TOKEN:0:30}...". Bearer tokens are secrets; exposing even a large prefix materially increases risk of token leakage through logs, screenshots, terminal scrollback, and monitoring systems.
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
# 获取访问令牌
echo -e "\n获取访问令牌..."
RESPONSE=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json; charset=utf-8" \
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}")
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
# 测试使用令牌访问API
echo -e "\n测试API访问..."
TEST_RESPONSE=$(curl -s -X GET \
"https://open.feishu.cn/open-apis/drive/v1/files" \
-H "Authorization: Bearer $TOKEN")
The README explicitly promotes uploading arbitrary local files and sending them to Feishu chats, including examples like memory archives, but provides no warning that this transmits local data to a third-party service. In an agent-skill context, this increases the risk of accidental exfiltration of sensitive workspace data, credentials, logs, or memory artifacts by users who may treat the skill as a routine utility.
The skill is explicitly designed to upload a local file to Feishu cloud storage and optionally send it into a chat, but the description presents this as a convenience feature without a prominent warning about external data transmission. In an agent or tool ecosystem, this increases the risk that a user or downstream caller triggers exfiltration of sensitive local files without fully understanding that data leaves the local environment and is delivered to a third-party service and chat recipients.
This JavaScript example presents its title, comments, and console-facing instructional output in Chinese, which effectively forces a specific language for users. The file does not offer any user opt-in, alternative locale, or justification that the skill is intentionally region-specific.
The script reads an arbitrary local file and uploads its full contents to Feishu, but provides no explicit consent prompt, destination confirmation, or safeguards against accidental exfiltration of sensitive data. In an agent-skill context, this is risky because a caller may trigger external transmission of workspace files using a stored access token with little user awareness beyond console output.
This code performs a network POST to Feishu with file data and an authorization token, creating a direct external data transmission path. While the functionality appears intended, it is still a real security concern because it enables exporting local data to a third-party service without validation of whether the file contents are appropriate to leave the local environment.
console.log(' 正在上传...');
// 上传文件
const response = await fetch('https://open.feishu.cn/open-apis/im/v1/files', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`
The script performs an HTTP file upload to Feishu using curl, transmitting the specified local file and related metadata to an external service. While the script prints operational status, it does not clearly warn the user that local file contents will be sent off-host, which is a privacy-relevant action.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# 对于小文件,可能只需要一个块
echo -e "\n3. 上传文件块..."
# 这里简化处理,假设文件小于块大小
UPLOAD_PART_RESPONSE=$(curl -s -X PUT \
"https://open.feishu.cn/open-apis/drive/v1/files/upload_part" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: $MIME_TYPE" \
The script reads a bearer token from disk and prints the first 30 characters to stdout. Even partial bearer-token disclosure is dangerous because terminal logs, CI output, shell history captures, or shared sessions can expose enough secret material to aid credential theft or correlate the exact token in use.
All user-facing messages, usage instructions, and status output are written in Chinese, with no indication that the skill is region-specific or that users may select another language. This can violate language/locale policy when a skill imposes a single language without opt-in or justification.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
fi
PAYLOAD="${PAYLOAD}}"
PREPARE_RESPONSE=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/drive/v1/files/upload_prepare" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
fi
PAYLOAD="${PAYLOAD}}"
PREPARE_RESPONSE=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/drive/v1/files/upload_prepare" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
echo "第二步:上传文件内容..."
MIME_TYPE=$(file --mime-type -b "$FILE_PATH" || echo "application/octet-stream")
UPLOAD_RESPONSE=$(curl -s -X PUT \
"$UPLOAD_URL" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: $MIME_TYPE" \
These lines send the selected local file to a remote upload URL using curl, which transmits user data off-system. Although the script logs progress, it does not clearly warn the user that file contents and related metadata will be sent to Feishu, and the skill purpose is not otherwise documented here.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# 第三步:完成上传
echo "第三步:完成上传..."
FINISH_RESPONSE=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/drive/v1/files/upload_finish" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
This curl command sends sensitive authentication material to an external network endpoint. While contacting Feishu's auth API is expected for token retrieval, the operation still constitutes external transmission of credentials and becomes dangerous because the secrets are hardcoded and the action occurs automatically.
# 获取访问令牌
echo -e "\n获取访问令牌..."
RESPONSE=$(curl -s -X POST \
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json; charset=utf-8" \
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}")
The script transmits hardcoded application credentials to an external service without any interactive warning, confirmation, or secure secret handling. Because the APP_ID and APP_SECRET are embedded directly in the script, anyone with access to the file can recover and reuse them, and execution immediately sends them over the network to obtain a tenant token.
The script persists the bearer token to a predictable local file path in plaintext, creating a reusable credential artifact on disk. Any local user, process, backup system, or later workflow that can read that file may reuse the token to access Feishu resources until it expires or is revoked.
After obtaining a valid tenant access token, the script performs an additional authenticated Feishu Drive API request unrelated to mere token retrieval. This expands the script's behavior from credential acquisition to active use of the token against another service, which increases the risk of unintended data access and normalizes post-authentication probing without user consent.
When no cached token file exists, the installer automatically runs get_feishu_token.sh, which obtains credentials without asking the user for confirmation. Triggering credential acquisition during installation can unexpectedly access secrets, initiate network authentication flows, or persist sensitive tokens on disk without the operator knowingly approving that behavior.
The script states that it will only test the upload tool without uploading, but its fallback branch actually invokes the uploader on a real file and treats "上传成功" as a valid outcome. This is dangerous because installers are expected to be side-effect-minimal; here the install process may silently send data to an external Feishu destination, causing unintended data transmission and violating user expectations.
Detected: suspicious.dangerous_exec, suspicious.potential_exfiltration