T09 · Insecure Skill Coding Practices
- Location
scripts/query.py:24- Finding
API Key Exposure Through Unsanitized HTTP Exception Logging
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent Hunter API client, but it needs Review because its documentation and error handling can expose the API key and sensitive uploaded or downloaded asset data.
Install only if you are comfortable sending Hunter search queries and any selected CSV targets to hunter.qianxin.com. Do not copy the documented curl -k commands, avoid sharing logs or terminal output that may contain authenticated URLs, review CSVs before upload, and store downloaded result files as sensitive data. Prefer the actual script syntax shown by --help: use search for immediate queries and batch submit/status/download for export workflows.
scripts/query.py:24API Key Exposure Through Unsanitized HTTP Exception Logging
references/api.md:27Documentation Disables TLS Certificate Verification for Authenticated API Requests
The example uses curl with the -k flag, which disables TLS certificate verification. That trains users to accept insecure HTTPS connections and enables man-in-the-middle interception or tampering, especially on hostile networks. Combined with an API key in the same request, an attacker could capture credentials or alter search responses.
BASH请求格式:
curl -X GET -k "https://hunter.qianxin.com/openApi/search?api-key={api-key}&search={search}&page=1&page_size=10&is_web=1&start_time=2021-01-01&end_time=2021-03-01"
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
方式一:传文件
curl -X POST -k -F "file=@C:/Users/{user}/Desktop/batch_file_template.csv" "https://hunter.qianxin.com/openApi/search/batch?api-key={api-key}&is_web=1&start_time=2021-01-01&end_time=2021-03-01"
The skill explicitly requires an API key and describes remote Hunter API queries and exports, but it does not declare an explicit tool scope such as permissions or allowed-tools. This creates a documentation and governance gap: consumers may not realize the skill can access environment secrets and perform outbound network operations, increasing the chance of unintended data disclosure or misuse.
The command examples and the declared subcommand structure are inconsistent: the table says search and batch are global subcommands, but examples invoke submit directly as python3 scripts/query.py submit ... while status/download use batch status and batch download. This mismatch can cause users or agents to invoke the wrong operation, misunderstand whether an action is local or remote, and accidentally trigger batch exports or uploads.
The batch-export documentation allows submitting a local CSV file to the remote Hunter API, but it does not clearly warn that file contents leave the local environment and are uploaded to a third-party service. This is dangerous because users may include sensitive targets, internal domains, customer data, or proprietary asset inventories without informed consent or data-handling review.
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
### 查询参数
| 长参数 | 说明 |
|:--------------|:------------------------------------------------------------------------------------------------|
| `--search` | Hunter 查询语法(原始字符串),用于即时查询或批量查询/导出任务 |
| `--page` | 页码,默认 `1` |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
| 长参数 | 说明 |
|:--------------|:------------------------------------------------------------------------------------------------|
| `--search` | Hunter 查询语法(原始字符串),用于即时查询或批量查询/导出任务 |
| `--page` | 页码,默认 `1` |
| `--page_size` | 每页条数,默认 `10` |
| `--start` | 开始时间 (格式: `2021-01-01`) |
| `--end` | 结束时间 (格式: `2021-03-01`) |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
|:--------------|:------------------------------------------------------------------------------------------------|
| `--search` | Hunter 查询语法(原始字符串),用于即时查询或批量查询/导出任务 |
| `--page` | 页码,默认 `1` |
| `--page_size` | 每页条数,默认 `10` |
| `--start` | 开始时间 (格式: `2021-01-01`) |
| `--end` | 结束时间 (格式: `2021-03-01`) |
| `--is_web` | 资产类型:`1` (Web), `2` (非Web), `3` (全部),默认为全部。 |
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
| `--fields` | 返回字段,以逗号分隔(如 `ip,port,domain`),默认返回权限内所有可导出字段。 |
| `--file` | 上传的CSV文件路径,用于批量查询 |
| `--type` | 上传文件的类型,即检索类型:`all` (混合ip/domain/company), `ip`(批量ip), `domain`(批量域名), `company`(批量企业名称),用于批量查询 |
| `--limit` | 最大导出资产数 |
| `--task_id` | 任务 ID,用于查看进度或下载文件 |
| `--output` | 下载的输出文件名,用于下载文件命名 |
The documentation instructs users to place the API key in the URL query string of a GET request. Query-string credentials are commonly exposed through browser history, shell history, reverse proxies, server logs, monitoring systems, and copy/paste sharing, which increases the chance of credential leakage. In a security-data API skill, that exposure can directly enable unauthorized use of the Hunter account and quota.
The documentation places the API key directly in the URL query string in curl examples. Query-string credentials are commonly exposed through shell history, process listings, logs, proxies, and browser or terminal tooling, which increases the chance of accidental credential leakage even when the API itself is legitimate.
The file’s instructional content, warnings, and examples are all presented in Chinese, which effectively forces a specific language for users of the skill. Under the policy, language constraints should either provide user choice or be clearly documented as a justified region-specific limitation.
This code opens a user-specified CSV file and sends it to the Hunter remote API via an HTTP POST request. While the operation is part of the feature, there is no visible print/log message, confirmation, or inline warning in this file disclosing that local file contents will be transmitted off-host.
The file presents all user-facing instructions and examples exclusively in Chinese. Under the stated policy, forcing a specific language without offering a user choice or documenting a justified locale constraint is a natural-language policy issue.
The download section tells users to save exported results to output.csv, but it does not mention that exported asset/search results may contain sensitive operational data and will be written to local storage. For markdown skills/docs, user warnings are expected when behavior can affect user data or privacy.
The download path retrieves data from the remote API and writes it to a local file chosen by the user or a default filename. Although it prints after saving, there is no prior user-facing warning, comment, or descriptive help text in this file indicating that running this action will create or overwrite a local file.
No suspicious patterns detected.