T09 · Insecure Skill Coding Practices
- Location
scripts/bt_api.py:42- Finding
TLS Certificate and Hostname Verification Disabled for Privileged API Requests
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a disclosed server-administration skill, but it exposes very broad BT-Panel control with unsafe credential, tunnel, TLS, and raw-API handling.
Install only if you understand that this gives the agent broad administrative control over BT-Panel-managed servers. Before use, remove or tightly gate raw mode, enable normal TLS verification, avoid public tunnels that collapse all callers to 127.0.0.1, do not print tokens into transcripts or logs, rotate any exposed token, and require enforced confirmation for every write, file, task, Docker, certificate, database, or site-changing action.
scripts/bt_api.py:42TLS Certificate and Hostname Verification Disabled for Privileged API Requests
scripts/enable_api.py:15Public Tunnel Configuration Defeats the Panel Source-IP Allowlist
scripts/enable_api.py:23Privileged Setup Script Decrypts and Prints the Panel API Token in Plaintext
scripts/bt_api.py:91Unrestricted Raw API Mode Permits Arbitrary Privileged Panel and File Operations
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
设白名单 + 取明文 token |
| SKILL.md | 龙虾 skill:触发词 + 用法 |
| baota.json.example | 配置模板(拷到 ~/.huo15/baota.json 填真值) |
| references/endpoints.md | 宝塔常用 API 端点速查 |
sysinfo -> 20核 / 内存30.7GB 已用12.8GB ✅ 本地 + 经隧道远程都通
disk -> / 914.8GB 已用66.3GB ✅
crontab -> [续签Let's Encrypt证书, ...] ✅ 通用 raw 调用
sites -> [](gjb-ssh 的服务都是 docker,非宝塔站)✅
If the underlying skill/code enables BT-Panel API access, modifies whitelist settings, or retrieves plaintext tokens while presenting itself as a normal operations wrapper, that is a serious trust-boundary violation. Exposing or manipulating API credentials and security configuration can grant full administrative control of internet-reachable server panels, especially given the skill text explicitly states the token is the 'only defense' and that 127.0.0.1 whitelisting enables remote use via the tunnel.
If the underlying skill/code enables BT-Panel API access, modifies whitelist settings, or retrieves plaintext tokens while presenting itself as a normal operations wrapper, that is a serious trust-boundary violation. Exposing or manipulating API credentials and security configuration can grant full administrative control of internet-reachable server panels, especially given the skill text explicitly states the token is the 'only defense' and that 127.0.0.1 whitelisting enables remote use via the tunnel.
The trigger phrases are broad ('管一下服务器', 'bt panel', '宝塔面板') and can cause this high-privilege remote administration skill to be selected for vague requests. In this context the danger is elevated because the skill can perform write actions against production infrastructure and even invoke arbitrary BT-Panel API endpoints via the raw interface.
TLS certificate verification and hostname checks are fully disabled, enabling man-in-the-middle interception of authenticated BT-Panel API traffic. Because this tool manages production infrastructure using panel credentials, an attacker on the network path could steal auth material, observe administrative actions, or modify requests and responses to take over servers.
The script silently enables the API, updates whitelist settings, and emits the plaintext token without any interactive warning, confirmation, or secondary authorization. This combination turns a convenience helper into a high-risk privilege-escalation and secret-exfiltration mechanism, especially in an agent skill context where actions may be triggered indirectly or wrapped by automation.
The code decrypts or directly reads the BT-Panel API token and prints the plaintext token to stdout, creating an explicit credential-extraction path. Plaintext admin API tokens are highly sensitive secrets; once exposed through logs, terminal history, wrappers, or other tooling, they can be reused to fully control the panel and potentially all managed infrastructure.
The README explicitly broadens the operational model from BT-Panel API control to SSH-based arbitrary command execution. In a server-administration skill, that materially increases capability from structured panel actions to unrestricted remote execution, which can enable destructive actions, persistence, or full host compromise if the skill or its credentials are abused.
The documented setup requires running a local script with sudo against BT-Panel's internal Python environment to enable the API and reveal the plaintext token. While privileged administration is sometimes necessary, embedding a root-required bootstrap path in a skill increases the blast radius of mistakes or abuse, especially when it changes authentication state and exposes credentials.
set_token 里 if 'request_token' in get: return '不能通过API接口配置API' —— 不能用 API 去开 API(鸡生蛋)。panelApi.set_token。本目录 enable_api.py 就干这个(用面板 pyenv python 跑):
sudo /www/server/panel/pyenv/bin/python3 enable_api.py <白名单IP,逗号分隔>
# 输出 open=true / limit_addr / token_plain(签名用的明文token)
The documentation recommends exposing panel access remotely through FRP/Nginx while relying on a localhost whitelist because traffic arrives as 127.0.0.1. That effectively defeats source-IP access control and makes the token the sole barrier for a publicly reachable administrative interface, substantially increasing exposure if the token leaks or the tunnel/proxy is misconfigured.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- **token 是唯一防线**(隧道公网可达,白名单全 127.0.0.1 等于不限来源)。务必保密、定期轮换。
- 想收紧:在 .121 的 nginx 给 `gjbserver.huo15.com` 加 IP 白名单/BasicAuth,或不走公网隧道、让龙虾跑在 gjb-ssh 本机走 localhost。
- token 只放 `~/.huo15/baota.json`(chmod 600),**绝不入库**。本仓库只有 `baota.json.example` 占位。
- 写操作(停站/删库/续证书)龙虾要先确认再执行。
## 五、文件清单
The skill performs privileged network-based server administration but does not declare any tool scope or permission boundaries. In practice this leaves a powerful remote-control skill under-specified, increasing the chance that an agent invokes network access and administrative actions without explicit governance or user-visible restriction.
This reference doc exposes highly sensitive file and log access endpoints, including arbitrary file read and write capabilities, but only labels them as '谨慎' without clearly warning about privacy, credential exposure, or full-host compromise risk. In the context of a server administration skill with stored panel credentials and support for arbitrary BT API calls, this materially lowers the barrier to reading secrets, modifying configs, or implanting persistence.
The comment suggests writes require explicit invocation, but the 'raw' mode lets callers hit any BT-Panel endpoint with arbitrary parameters, including destructive administrative actions. In this skill context, that mismatch is especially dangerous because users or higher-level agents may rely on the comment and assume the tool is mostly read-only when it is actually a full privileged control surface.
The file defines write-effecting operations that can change service availability by stopping or starting sites. Although a comment notes that write operations require explicit calls, there is no user-facing confirmation prompt, warning message, or CLI disclosure before executing these potentially disruptive actions.
This helper script programmatically enables the BT-Panel API, modifies the IP whitelist, and then retrieves credential material from the panel configuration. In an ops skill, this expands access beyond routine administration into security-boundary reconfiguration and secret handling, which is dangerous because anyone able to invoke or reuse the script can widen API exposure and obtain reusable access to the panel.
The title and surrounding documentation are entirely in Chinese, which implies a fixed language for operating the skill. Under the stated policy, locale or language constraints should either offer user opt-in or be clearly justified as region-specific; this file does neither.
Documenting immediate task execution as a routine endpoint without a prominent warning can encourage unsafe invocation of scheduled jobs whose side effects may be disruptive, destructive, or externally visible. Because this skill is designed for live multi-panel operations on production servers, triggering a cron task on demand could execute backups, deployment hooks, cleanup jobs, or custom scripts at unsafe times.
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
if a.cmd == "raw":
out = bt.call(a.endpoint, json.loads(a.params))
elif a.cmd in ("site_stop", "site_start"):
out = getattr(bt, a.cmd)(a.id, a.name)
else:
out = getattr(bt, a.cmd)()
print(json.dumps(out, ensure_ascii=False, indent=2))
This getattr(bt, a.cmd)() call allows any attribute name provided on the command line to be invoked as a zero-argument method on the BtPanel object. In the skill context, this is more dangerous because the tool wraps administrative server controls and reads credentials from a local config, so unexpected method exposure or crashes can affect privileged infrastructure operations.
elif a.cmd in ("site_stop", "site_start"):
out = getattr(bt, a.cmd)(a.id, a.name)
else:
out = getattr(bt, a.cmd)()
print(json.dumps(out, ensure_ascii=False, indent=2))
Detected: suspicious.insecure_tls_verification