T09 · Insecure Skill Coding Practices
- Location
scripts/focusavatar.py:20- Finding
Authentication credentials can be transmitted to an arbitrary or insecure endpoint
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real FocusAvatar client, but it needs review because it can send API secrets and job data to any backend URL configured in the environment without host or HTTPS checks.
Install only if you trust the publisher and the FocusAvatar backend you will use. Leave FOCUSAVATAR_API unset unless you intentionally set it to a trusted HTTPS service, avoid storing accessKeySecret permanently in shell startup files, prefer a temporary session or secret manager, and rotate the key if it may have been exposed. Pin installer and Python dependency versions where possible.
scripts/focusavatar.py:20Authentication credentials can be transmitted to an arbitrary or insecure endpoint
SKILL.md:109Installation instructions use unpinned third-party dependencies and source revisions
The script sends user-supplied credentials in HTTP headers to an endpoint whose base URL is overridable via the FOCUSAVATAR_API environment variable. In an agent/runtime setting, an attacker who can influence environment variables can redirect requests to an attacker-controlled host and exfiltrate accessKeyId/accessKeySecret, making this a real secret-leak risk rather than a mere expected API call.
headers = make_auth_headers(access_key_id, access_key_secret)
try:
payload = {"mp3": mp3, "mp4": mp4, "text": text}
resp = requests.post(
API_ENDPOINT.rstrip("/") + "/skill/api/submit",
json=payload,
headers=headers,
The polling request reuses the same credential-bearing headers and posts to a status URL derived from the environment-controlled API_ENDPOINT. This means the same endpoint-redirection issue persists across repeated polling, potentially leaking secrets multiple times and increasing exposure if the host is malicious or misconfigured.
while True:
try:
poll_count += 1
r = requests.post(
status_url,
json={"orderNo": task_id},
headers=headers,
The query flow posts orderNo together with credential headers to a URL built from the same environment-controlled API base. If an attacker can set or influence FOCUSAVATAR_API, they can capture both the credentials and task identifiers, enabling unauthorized API use and possible access to generated content.
def query_result(order_no: str, key_id: str, key_secret: str):
url = API_ENDPOINT.rstrip("/") + "/skill/api/api/result"
h = make_auth_headers(key_id, key_secret)
r = requests.post(url, json={"orderNo": order_no}, headers=h, timeout=30)
r.raise_for_status()
# 处理返回:如果是字符串就解析,已经是 dict 直接用
raw = r.json()
The request destination is derived from the FOCUSAVATAR_API environment variable and is used directly in requests.post while authentication headers include access credentials. An attacker who can influence the environment can redirect the client to an arbitrary host and capture the X-Access-Key-Id and X-Access-Key-Secret values, turning this into a credential exfiltration/SSRF-style issue.
"""
headers = _auth_headers(access_key_id, access_key_secret)
payload = {"orderNo": order_no}
r = requests.post(RESULT_URL, json=payload, headers=headers, timeout=30)
r.raise_for_status()
raw = r.json()
return json.loads(raw) if isinstance(raw, str) else raw
The README instructs users to install and execute a remote package via npx skills without pinning an exact version or otherwise constraining what code is fetched. If the upstream package is updated, compromised, or subject to dependency hijacking, users may run unexpected code during installation or execution.
This installation guidance again relies on npx skills without a pinned version, which means the resolved package can change over time and may execute newly introduced or malicious code. Because this is an installation step, any compromise happens before users can meaningfully inspect the skill behavior.
The skill explicitly requires environment-variable access for credentials and outbound network access to a backend API, but the manifest does not declare any tool scope or permissions boundary. This weakens user review and enforcement, because operators cannot easily see or constrain the skill's actual capabilities before installation or execution.
The instructions recommend permanently storing accessKeySecret in shell startup files or persistent system environment variables, but do not clearly warn that this leaves long-lived credentials on disk and accessible to other local processes or future shell sessions. If the host is shared, backed up, or later compromised, the API secret may be recovered and abused.
The installation command uses npx skills without pinning an exact version, so users may fetch and execute whatever package version is current at install time. This creates supply-chain risk: a compromised or malicious future release could run code during installation with the user's privileges.
A second unpinned npx skills installation reference repeats the same supply-chain exposure later in the document. Repetition increases the chance users will follow the unsafe install path and execute an unintended package version.
The script collects accessKeyId/accessKeySecret from environment variables or interactive input and transmits them, but does not clearly warn users about exposure risks, endpoint trust assumptions, or the consequences of overriding the API host. In an agent context, this matters because users may provide secrets without realizing they are sent to a configurable remote service.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
while True:
try:
poll_count += 1
r = requests.post(
status_url,
json={"orderNo": task_id},
headers=headers,
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def query_result(order_no: str, key_id: str, key_secret: str):
url = API_ENDPOINT.rstrip("/") + "/skill/api/api/result"
h = make_auth_headers(key_id, key_secret)
r = requests.post(url, json={"orderNo": order_no}, headers=h, timeout=30)
r.raise_for_status()
# 处理返回:如果是字符串就解析,已经是 dict 直接用
raw = r.json()
The accessKeySecret is collected with input(), which echoes the secret to the terminal and may expose it to shoulder-surfing, terminal logging, shell session recording, or shared console history mechanisms. Because this script handles live API credentials, visible entry materially increases the chance of credential disclosure.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"""
headers = _auth_headers(access_key_id, access_key_secret)
payload = {"orderNo": order_no}
r = requests.post(RESULT_URL, json=payload, headers=headers, timeout=30)
r.raise_for_status()
raw = r.json()
return json.loads(raw) if isinstance(raw, str) else raw
The trigger list contains broad terms such as "数字人", "视频生成", and "语音合成" that can match many ordinary user requests beyond this skill’s narrow backend API purpose. This can cause the agent to invoke the skill unexpectedly, leading to unintended third-party API calls using configured credentials and possible leakage of user prompts or media URLs to the external service.
文档标题及全文均以中文呈现,未说明这是可选语言、区域限定,或提供其他语言入口。根据规则,若技能在自然语言层面强制特定语言而没有用户选择或明确正当性,属于语言/locale 策略问题。
The natural-language instructions and prompts are entirely in Chinese and direct the user to provide specific Chinese phrasing to the assistant for timeout handling. There is no indication that users may choose another language or that the language restriction is required for a documented regional purpose.
The file’s docstring and user-facing prompts are written only in Chinese, which imposes a specific language on users without any opt-in or alternative. The policy explicitly calls for flagging language or locale constraints when the skill forces a specific language without user choice.