T09 · Insecure Skill Coding Practices
- Location
SKILL.md:59- Finding
Unquoted SSH Configuration Variables Permit Argument Injection and Invocation Manipulation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill openly enables AI-driven SSH control of remote computers, but its default setup grants persistent unrestricted access and understates the remaining risk.
Install only if you intend to let an AI agent operate a remote Mac or Linux account over SSH. Use a dedicated non-admin account and a dedicated key, restrict authorized_keys where possible, quote and validate SSH variables, keep the tunnel private or source-limited, log sessions, and document how to remove the key when finished.
SKILL.md:59Unquoted SSH Configuration Variables Permit Argument Injection and Invocation Manipulation
README.md:223Quick-Start Procedure Grants Persistent and Unrestricted SSH Access
README.md:282Security Documentation Overstates the Protection Provided by Tunnel Shutdown
Appending a key to ~/.ssh/authorized_keys establishes persistent remote access to the target account. In this skill's context that is intentional, but it is still a high-risk capability because misuse, mistaken key placement, or deployment on a sensitive account can create durable unauthorized access paths.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
The YARA hit is understandable because adding keys to authorized_keys is a common persistence technique used by attackers. Here it appears to be documented setup for legitimate SSH access, but in substance it still enables persistent remote entry, which is high impact if deployed carelessly or if the controlling private key is stolen.
��────────┘
### 环境要求
- 远程设备开启 SSH 服务
- 内网穿透工具(如果设备在内网)
- SSH 密钥认证
### 快速开始
1. **被控电脑开启 SSH (macOS)**:
- 系统偏好设置 → 共享 → 勾选"远程登录"
2. **生成 SSH 密钥对**:
```bash
ssh-keygen -t ed25519 -C "ai@server"
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
| 工具 | 特点 | 官网 |
|---|---|---|
| 花生壳 | 国内老牌,稳定 | oray.com |
| ngrok | 国际流行,配置简单 | ngrok.com |
| frp | 开源免费,可自建服务器 | github.com/fatedier/frp |
export SSH_TARGET_HOST="你的穿透地址"
export SSH_TARGET_PORT="穿透端口"
export SSH_TARGET_USER="用户名"
export SSH_KEY_PATH="/path/to/private/key"
The finding is tied to the same authorized_keys setup sequence and therefore inherits the risk of persistent access creation. Although chmod itself is not credential access, in context this line participates in enabling key-based login that, if mismanaged, can expose the remote system to ongoing access.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
This English duplicate also instructs adding an SSH public key to authorized_keys, which creates lasting remote login capability. For a remote-control skill this is expected, but it remains security-sensitive because compromise of the paired private key or overly broad account privileges can result in full remote account access.
echo "your-public-key" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
This line is part of the same SSH key authorization workflow and thus contributes to establishing persistent remote access. The risk is contextual rather than inherently malicious: the skill is built for remote control, so mistakes in account choice or key handling materially increase exposure.
echo "your-public-key" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Appending a key to ~/.ssh/authorized_keys establishes persistent remote access to the target host. Even though the stated purpose is legitimate setup, this mechanism is identical to a common persistence/backdoor technique, and in an agent skill that enables remote control it materially expands access if misused or applied to the wrong account.
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
The YARA match is substantively valid because echo ... >> ~/.ssh/authorized_keys is the same primitive used to create persistent SSH access. In this skill's context, the action is framed as onboarding for legitimate remote management, but it still enables durable access to a user device and becomes dangerous if the agent, server, or key is compromised.
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'docker ps'
## 远程电脑配置要求
### macOS 配置步骤
1. **开启远程登录**
- 系统偏好设置 → 共享 → 勾选"远程登录"
- 设置允许访问的用户
2. **生成SSH密钥对**
```bash
ssh-keygen -t ed25519 -C "ai@server"
添加公钥到远程电脑
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
配置内网穿透(如果电脑在内网)
为什么需要内网穿透? 大多数家庭/办公网络的电脑没有公网IP,无法直接从外网访问。内网穿透工具可以将内网端口映射到公网,让外部设备能够连接进来。
常用内网穿透工具:
| 工具 | 特点 | 官网 |
|---|---|---|
| 花生壳 | 国内老牌,稳定,支持SSH | oray.com |
| ngrok | 国际流行,配置简单 | ngrok.com |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo "你的公钥内容" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
The README promotes remote upload, app control, and screenshot capture but does not prominently warn that these capabilities can alter remote data and expose sensitive user information such as documents, browser contents, or on-screen secrets. In a skill specifically designed for AI-driven remote control, understated warnings increase the risk of unsafe deployment or overbroad use on personal devices.
The skill provides concrete remote-control examples including file creation, upload/download, application control, process inspection, and screenshot capture before presenting a clear, prominent warning about privacy, data loss, and system-state changes. In an agent skill, these examples normalize high-impact actions and may cause an agent or operator to perform invasive operations without explicit consent gating.
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
# 查看目录
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'ls -la ~/Desktop/'
# 查看文件内容
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'cat ~/Desktop/test.txt'
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
# 查看目录
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'ls -la ~/Desktop/'
# 查看文件内容
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'cat ~/Desktop/test.txt'
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
# 查看目录
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'ls -la ~/Desktop/'
# 查看文件内容
ssh -i $SSH_KEY_PATH -p $SSH_TARGET_PORT $SSH_TARGET_USER@$SSH_TARGET_HOST 'cat ~/Desktop/test.txt'
No suspicious patterns detected.