T09 · Insecure Skill Coding Practices
- Location
scripts/token_manager.py:204- Finding
TLS Certificate Verification Disabled for Credential and Token Traffic
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This media-search skill is mostly purpose-aligned, but it handles API credentials and tokens with unsafe transport, logging, and local persistence practices that users should review before installing.
Install only if you trust the media API integration and can accept local token/result storage. Before production use, enable normal TLS certificate verification, stop logging token-bearing headers, enforce owner-only permissions for the token cache, and narrow activation to explicit user-directed media searches.
scripts/token_manager.py:204TLS Certificate Verification Disabled for Credential and Token Traffic
scripts/media_search.py:199Bearer Access Token Exposed in INFO-Level Logs
scripts/token_manager.py:130Persisted Bearer Token File Does Not Enforce Restrictive Permissions
The documented purpose is media/news search, but the detected behavior includes credential reading, token acquisition, and local persistence/locking that are not clearly tied to user-visible search functionality. Description-behavior mismatch is dangerous because it can hide sensitive operations behind a benign-looking skill, reducing operator scrutiny and enabling secret handling or remote access beyond user expectations.
The trigger conditions are extremely broad, covering common phrases like '查一下' or '搜一下' that overlap with ordinary conversation. Overbroad activation can cause the skill to run in unintended contexts, leading to unnecessary network access, secret usage, data retention, or disclosure of search results when the user did not clearly request this specific capability.
The skill includes shell-based file deletion guidance (rm sources/result.json) as part of routine workflow. Even though the example uses a fixed path, normalizing deletion as a follow-up action in a skill that handles file paths raises the risk of unsafe command construction or path manipulation in downstream implementations, especially if future variants substitute user-controlled paths.
python3 search.py --json-input '{"keywords": "test"}' --output-file sources/result.json
rm sources/result.json # 删除临时JSON文件
## Examples
The request sends both search content and the API token over HTTPS while explicitly disabling certificate verification with verify=False. That makes the connection vulnerable to man-in-the-middle interception or impersonation, allowing an attacker on the network path to capture tokens, read search queries, or tamper with responses. Because this skill handles potentially sensitive research and monitoring queries, the disabled TLS verification is especially risky.
The module suppresses insecure-request warnings and elsewhere performs HTTPS requests with certificate verification disabled, creating a silent trust bypass. This allows man-in-the-middle interception of API credentials and tokens without operators seeing the normal warning signals, which is especially dangerous in an authentication component.
The request sends appid and secret over HTTPS with verify=False, meaning the client does not authenticate the server certificate. An attacker positioned on the network could impersonate the API endpoint, capture credentials, and issue or replay tokens, compromising downstream media-platform access.
Automatically saving all search queries and results to local files without a prominent warning creates privacy and confidentiality risk. Search terms and collected articles may reveal internal investigations, competitive monitoring, or sensitive subjects, and local markdown files can later be accessed by other users, tools, or backup systems.
Persisting authentication tokens on disk without a prominent warning can expose long-lived or refreshable credentials to local compromise, backups, or accidental sharing. Even with restrictive file permissions, users should be clearly informed because disk persistence changes the threat model compared with in-memory-only authentication.
Disabling HTTPS certificate verification by default undermines transport security and can allow man-in-the-middle interception or tampering of API requests and responses, including credentials and returned media data. This is especially risky for a tool that fetches remote content and uses authenticated API access.
The skill documentation describes capabilities that require network access, environment-variable secret access, and file write/read behavior, but it does not declare any tool scope or permission boundaries. In an agent environment, this weakens least-privilege controls and makes it easier for the skill to access secrets, persist data locally, or exfiltrate content without explicit policy review.
该文件的描述与使用说明整体以中文固定表达技能适用方式,但未说明这是仅面向特定中文业务场景的受限技能,也未给出语言选择或用户确认。按照语言/locale 政策,强制单一语言而无 opt-in 可能构成自然语言策略问题。
The skill documents automatic saving and detailed console output of search results but does not warn about the privacy and confidentiality risks of persisting or displaying potentially sensitive queries and retrieved content. In an agent setting, this can expose research topics, sources, or retrieved data to local storage, logs, or later consumers without user awareness.
The integration notes claim '所有搜索结果自动保存到sources文件夹' and '支持JSON文件、控制台、Markdown三种输出', but earlier usage and output sections say file saving happens only when --output-file is specified and describe only JSON and console output. This is an active documentation contradiction about whether persistence is automatic and whether Markdown output exists.
The module docstring and command-line help strings are written exclusively in Chinese, which effectively fixes the skill's interaction language without indicating that the user can choose another language. Under the policy, forcing a specific language without opt-in is a natural-language policy concern.
The code logs the full request headers, which include the authentication token. Any user or service with access to application logs could recover that token and reuse it to access the upstream media API, causing credential leakage outside the skill's intended purpose. In this skill context, tokens protect access to an external media-search backend, so exposing them materially increases the risk of unauthorized API use and data access.
Using verify=False disables server certificate validation, defeating a core HTTPS security control. An attacker could present a forged certificate, intercept the token and query contents, or alter API responses without being detected. In a networked search skill that depends on a remote authenticated service, this unsafe default meaningfully increases exposure.
data=encoded_data,
headers=headers,
timeout=timeout,
verify=False,
)
response.raise_for_status()
The module docstring and user-facing messages are presented in Chinese, and the file does not indicate that this language choice is optional or required by a region-specific constraint. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.
The manifest describes using the skill for web-wide media article retrieval, event background lookup, and related research tasks. This file creates and manages a local .mbd_token_cache.json file and later deletes it, introducing filesystem persistence/cleanup behavior that is not reflected in the manifest's user-facing description.
Using verify=False establishes an unsafe default in a component that handles secrets and bearer tokens. Because token acquisition is foundational to all later API access, compromise here can enable credential theft, unauthorized API usage, and exposure of sensitive platform data.
data=urllib.parse.urlencode(data),
headers=headers,
timeout=30,
verify=False,
)
response.raise_for_status()
result = response.json()
The manifest describes a skill for media/news search and background research, but this file implements credential handling by reading NEWS_BIGDATA_API_KEY and NEWS_BIGDATA_API_SECRET from environment variables. Accessing process environment secrets is a separate capability from performing media retrieval and is not explicitly justified by the stated purpose.
The module docstring presents the tool entirely in Chinese, and the command-line descriptions, examples, and runtime messages are also Chinese-only throughout the file. This creates a natural-language locale constraint without any opt-in or indication that the skill is intentionally limited to a Chinese-language environment.
The skill is described as a media search tool, but it also persistently stores full search results, including summaries and article content, into a local sources directory. This creates an unnecessary data retention surface that can expose sensitive research topics, copyrighted material, or internal investigation context to other local users, later processes, or unintended uploads.
The --output-file argument allows writing results to an arbitrary path supplied by the caller, which exceeds the narrow search-only purpose of the skill and enables file write side effects. In an agent context, this can be abused to overwrite or plant files in sensitive locations accessible to the process, potentially altering local state, poisoning downstream workflows, or causing data leakage.
The README content is wholly Chinese-language and does not indicate that the skill supports multiple languages or that use is intentionally limited to a Chinese-speaking or region-specific context. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.
The README shows that the skill does more than simple media search: it persistently stores authentication material and automatically writes search outputs to disk. In a research or newsroom workflow, queries and results may contain sensitive investigative topics, and silent retention increases the chance of local disclosure, over-collection, or unintended reuse.