T09 · Insecure Skill Coding Practices
- Location
SKILL.md:188- Finding
Unvalidated configuration values are interpolated into shell commands and Python source
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is explicit about building a proxy VPS, but it automates sensitive SSH and server changes with weak safety controls.
Install only if you intentionally want an agent to administer a VPS for proxy deployment. Before using it, verify SSH host keys yourself, avoid storing passwords in project files, review every command before execution, pin and verify downloaded binaries, and plan how to remove the injected SSH key, generated secrets, and systemd service if you stop using it.
SKILL.md:188Unvalidated configuration values are interpolated into shell commands and Python source
SKILL.md:188SSH host identity verification is explicitly disabled during credential use and key installation
SKILL.md:67SSH passwords, upstream credentials, and generated private keys are handled as unprotected plaintext
SKILL.md:195Mutable, unpinned dependencies and executable releases are installed without integrity verification
SKILL.md:319Persistent sing-box service is granted broader network capabilities than the demonstrated configuration requires
SKILL.md:617Troubleshooting content can be persistently rewritten from incident-derived input
The trigger phrases are broad enough to activate on common user requests about connectivity or VPNs, causing the agent to enter a high-risk workflow that automates SSH access, deployment, credential handling, and local file creation. In this context, accidental invocation is especially dangerous because the skill is designed to manipulate sensitive infrastructure and secrets, not just provide informational guidance.
The activation text uses many broad trigger phrases such as VPN, proxy, blocked services, and product names, making accidental invocation likely during ordinary conversation. Because this skill performs credential handling, remote SSH actions, package installation, and config generation, overbroad activation materially increases the chance of high-risk actions being suggested or started in the wrong context.
The skill automates appending a locally generated SSH public key into the remote user's authorized_keys, creating persistent access to the VPS from the local machine. In context, this is intended for convenience, but it is still sensitive credential modification that can outlive the session and could be abused if the local key or workspace is later compromised.
cmd = (
f"mkdir -p ~/.ssh && chmod 700 ~/.ssh && "
f"echo '{pubkey}' >> ~/.ssh/authorized_keys && "
f"chmod 600 ~/.ssh/authorized_keys && "
f"echo 公钥注入成功"
)
The YARA match is justified by behavior that appends a new key into authorized_keys, a classic persistence mechanism also used by malware and unauthorized admins. In this skill’s context the action is framed as automation for setup, but because it silently establishes durable SSH access, it remains security-sensitive and dangerous if triggered in the wrong environment or by a compromised agent.
D}" pubkey_path = "~/.ssh/proxy_expert_ed25519.pub"
import os pubkey_path = os.path.expanduser(pubkey_path) with open(pubkey_path) as f: pubkey = f.read().strip()
client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(host, port=port, username=user, password=password, timeout=15)
cmd = ( f"mkdir -p ~/.ssh && chmod 700 ~/.ssh && " f"echo '{pubkey}' >> ~/.ssh/authorized_keys && " f"chmod 600 ~/.ssh/authorized_keys && " f"echo 公钥注入成功" ) stdin, stdout, stderr = client.exec_command(cmd) print(stdout.read().decode()) err = stderr.read().decode() if err: print("STDERR:", err, file=sys.stderr) client.close() PYEOF
看到 "公钥注入成功" 则继续。
3. 验证密钥可用(无论用哪种方式注入,最后都验证一次):
```bash
ssh -i ~/.ssh/proxy_expert_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=10 -p {SSH_PORT} {SSH_USER}@{VPS_IP} "echo 密钥登录成功"
看到 "密
Changing permissions on authorized_keys is part of a workflow that modifies remote authentication state. In this context the danger is not the chmod itself but the fact that the skill is directly managing login persistence on the server, which expands long-term access and attack surface if done without strong approval and lifecycle controls.
cmd = (
f"mkdir -p ~/.ssh && chmod 700 ~/.ssh && "
f"echo '{pubkey}' >> ~/.ssh/authorized_keys && "
f"chmod 600 ~/.ssh/authorized_keys && "
f"echo 公钥注入成功"
)
stdin, stdout, stderr = client.exec_command(cmd)
The command combines --resolve with -k to force TLS to a user-supplied IP while disabling certificate verification, effectively normalizing a trust-bypass pattern. Even though used here for protocol testing, teaching or automating insecure curl invocations can mask MITM or endpoint mismatch issues and may be reused in less controlled contexts.
# Mac/Linux(关闭系统代理后执行)
curl -sI --resolve "www.apple.com:443:{VPS_IP}" https://www.apple.com/ -k 2>&1 | head -5
Windows 用 curl.exe(加 .exe 后缀)。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
},
{
"id": 2,
"prompt": "我已经填好 proxy-setup-info.txt 了,文件内容是:\n\nVPS_IP=192.168.1.100\nSSH_PORT=22\nSSH_USER=root\nSSH_AUTH=key\nSSH_PASSWORD=\nSSH_KEY_PATH=~/.ssh/id_ed25519\nUPSTREAM_IP=10.0.0.1\nUPSTREAM_PORT=1080\nUPSTREAM_USER=testuser\nUPSTREAM_PASS=testpass\nPLAN=C\nSNI_DOMAIN=www.apple.com\n\n请读取这个配置,给我展示一下即将部署的方案摘要,然后生成 clash-verge-config.yaml(假设密钥已经生成:UUID=fake-uuid-1234, PublicKey=fakePubKey5678, ShortID=abcd1234)",
"expected_output": "1) 展示方案摘要:VPS 192.168.1.100:22、方案 C(混合路由)、SNI www.apple.com、上游 10.0.0.1:1080;2) 在当前目录生成 clash-verge-config.yaml,包含正确的 server/uuid/public-key/short-id 字段、VPS IP 直连规则、udp:false、client-fingerprint:chrome;3) 文件顶部有导入说明注释",
"files": []
},
This command deliberately overrides DNS resolution with curl --resolve and disables TLS certificate validation with -k, causing the client to connect to an arbitrary IP while suppressing normal identity checks. In a proxy-circumvention skill, this normalizes unsafe TLS practices and could train users to accept man-in-the-middle conditions or trust spoofed endpoints during diagnosis.
Mac/Linux(关闭系统代理后执行):
curl -sI --resolve "www.apple.com:443:{VPS_IP}" https://www.apple.com/ -k | head -5
Windows:
The README describes creation of files containing VPS information, SSH credentials, and generated keys, but the warning is not prominent and action-oriented at the point where users are told to start the workflow. Users may proceed without understanding that sensitive secrets will be stored locally in plaintext-style working files, increasing the chance of accidental exposure through backups, sync tools, shared directories, or source control.
The manifest description and the rest of the skill are written to operate in Chinese and instruct specific Chinese phrasing, but there is no option for the user to choose another language. This can violate language or locale policy when the skill is invoked for users who did not opt into Chinese-only behavior.
The skill directs creation of local files containing VPS IPs, SSH passwords, key paths, and proxy credentials, but does not prominently warn about local secret-at-rest risk. Those files may be left in project directories, synced to cloud storage, captured in backups, or accidentally committed, exposing infrastructure and upstream proxy accounts.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
client.connect(host, port=port, username=user, password=password, timeout=15)
cmd = (
f"mkdir -p ~/.ssh && chmod 700 ~/.ssh && "
f"echo '{pubkey}' >> ~/.ssh/authorized_keys && "
f"chmod 600 ~/.ssh/authorized_keys && "
f"echo 公钥注入成功"
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
cmd = (
f"mkdir -p ~/.ssh && chmod 700 ~/.ssh && "
f"echo '{pubkey}' >> ~/.ssh/authorized_keys && "
f"chmod 600 ~/.ssh/authorized_keys && "
f"echo 公钥注入成功"
)
stdin, stdout, stderr = client.exec_command(cmd)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
ssh -i ~/.ssh/proxy_expert_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=10 -p {SSH_PORT} {SSH_USER}@{VPS_IP} "echo 密钥登录成功"
看到 "密钥登录成功" 则继续。失败时常见原因:authorized_keys 权限不对(重新用密码登 chmod 600)、VPS 禁用了密码认证(检查 `/etc/ssh/sshd_config` 的 `PasswordAuthentication`)。
> **注意**:整个过程用户不需要打开 VPS 的 Web 终端或自己执行任何命令,全部由本地 AI 自动完成。
The skill performs extensive remote administrative changes—system updates, package installs, service creation, network tuning, and security tooling setup—without an explicit warning that these actions are persistent and may affect system stability, connectivity, or existing services. In a high-privilege SSH context, lack of a safety gate raises the risk of unintended destructive or availability-impacting changes.
The skill retrieves release metadata and binaries from external services at runtime, which is expected for installation but still introduces a supply-chain and data-exposure surface. If upstream content is compromised, rate-limited, or replaced, the agent may install malicious or unverified software onto the target VPS.
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
SB_VER=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest | grep tag_name | cut -d '"' -f4 | sed 's/v//')
cd /tmp
wget -q "https://github.com/SagerNet/sing-box/releases/download/v${SB_VER}/sing-box-${SB_VER}-linux-${ARCH}.tar.gz"
tar -xzf "sing-box-${SB_VER}-linux-${ARCH}.tar.gz"
Enabling a systemd service creates persistence across reboots, which is expected for a proxy server but still a meaningful security-relevant state change. In the context of a skill that can run unattended SSH commands, persistent background services increase the impact of misconfiguration or malicious package substitution.
mkdir -p /var/lib/sing-box
systemctl daemon-reload
systemctl enable sing-box
systemctl start sing-box
sleep 3
systemctl status sing-box --no-pager
The manifest presents the skill as a deployment/config/testing workflow, but these lines add persistent self-maintenance of the skill’s own assets. That mismatch increases risk because a user may authorize one-time system setup while the skill also changes installed skill content, creating unreviewed long-term behavior changes.
The skill tells the agent to modify its own installed reference documentation during troubleshooting, which breaks the boundary between using skill assets and mutating them. This creates a persistence/tampering path where operational data from one run can silently alter future behavior, potentially poisoning later sessions or broadening the skill beyond what was reviewed.
The eval prompts explicitly exercise setup of censorship-circumvention infrastructure using euphemistic language like '搭梯子' and '翻墙', but the technical outputs requested are concrete deployment steps for VLESS+Reality and client configs. In this skill context, that is not merely descriptive discussion: it operationalizes anti-censorship evasion and tests the agent’s ability to help users bypass network controls.
This troubleshooting eval is framed symptomatically, but it specifically teaches recognition of GFW active probing and temporary port blocking, along with diagnostic and corrective steps. That materially improves a user's ability to maintain censorship-evasion infrastructure against detection, making the skill more dangerous than a generic networking troubleshooter.
The entire skill document is written in Chinese, including headings, instructions, field explanations, and error guidance, with no indication that the language is optional or that the skill is intended only for a Chinese-speaking or region-specific audience. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.
The configuration explicitly enables logging to /var/log/sing-box/sing-box.log but the documentation does not warn that connection metadata, errors, and possibly operational details may be written to persistent storage. In the context of a censorship-circumvention/proxy deployment skill, retained logs can materially increase user risk if the host is inspected, compromised, or seized, because they may reveal service usage patterns and infrastructure details.
The entire troubleshooting guide is written in Chinese and does not indicate that users may choose another language or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Mac:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
No suspicious patterns detected.