Back to skill

Security audit

Remote VPS Control

Security checks for vulnerabilities and agentic risk

Overview

This skill manages authorized servers through SSH with clearly disclosed permissions, safeguards, and access-removal procedures.

Use only for servers you are authorized to manage. Protect the controller's unencrypted private keys, grant only necessary sudo commands, verify server fingerprints independently, and retain provider-console recovery access. SSH access persists until revoked; ipify receives the controller's public IP during discovery.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (81)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 167)May include surrounding context.

text
可以通过编辑器写入:

  sudo nano /home/hermesctl/.ssh/authorized_keys

然后执行:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 171)May include surrounding context.

text
然后执行:

  sudo chown hermesctl:hermesctl /home/hermesctl/.ssh/authorized_keys
  sudo chmod 600 /home/hermesctl/.ssh/authorized_keys
  sudo stat -c '%U:%G %a %n' /home/hermesctl/.ssh/authorized_keys

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 172)May include surrounding context.

text
然后执行:

  sudo chown hermesctl:hermesctl /home/hermesctl/.ssh/authorized_keys
  sudo chmod 600 /home/hermesctl/.ssh/authorized_keys
  sudo stat -c '%U:%G %a %n' /home/hermesctl/.ssh/authorized_keys

注意:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 173)May include surrounding context.

text
sudo chown hermesctl:hermesctl /home/hermesctl/.ssh/authorized_keys
  sudo chmod 600 /home/hermesctl/.ssh/authorized_keys
  sudo stat -c '%U:%G %a %n' /home/hermesctl/.ssh/authorized_keys

注意:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 484)May include surrounding context.

text
被控机检查:

  sudo stat -c '%a %U:%G %n' /home/hermesctl/.ssh
  sudo stat -c '%a %U:%G %n' /home/hermesctl/.ssh/authorized_keys
  sudo sshd -t
  sudo visudo -c

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 580)May include surrounding context.

text
==============================

1. 通过控制台或其他管理员入口登录被控机。
2. 从 /home/hermesctl/.ssh/authorized_keys 只删除该机器对应公钥行。
3. 验证旧私钥连接失败。
4. 如果不再需要任何 Hermes 管理,删除云防火墙和系统防火墙中的主控 IP SSH 规则。
5. 根据审计需求决定锁定还是保留 hermesctl 账户,不要误删其他用户和密钥。

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 167)May include surrounding context.

text
可以通过编辑器写入:

  sudo nano /home/hermesctl/.ssh/authorized_keys

然后执行:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 171)May include surrounding context.

text
然后执行:

  sudo chown hermesctl:hermesctl /home/hermesctl/.ssh/authorized_keys
  sudo chmod 600 /home/hermesctl/.ssh/authorized_keys
  sudo stat -c '%U:%G %a %n' /home/hermesctl/.ssh/authorized_keys

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 172)May include surrounding context.

text
然后执行:

  sudo chown hermesctl:hermesctl /home/hermesctl/.ssh/authorized_keys
  sudo chmod 600 /home/hermesctl/.ssh/authorized_keys
  sudo stat -c '%U:%G %a %n' /home/hermesctl/.ssh/authorized_keys

注意:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 173)May include surrounding context.

text
sudo chown hermesctl:hermesctl /home/hermesctl/.ssh/authorized_keys
  sudo chmod 600 /home/hermesctl/.ssh/authorized_keys
  sudo stat -c '%U:%G %a %n' /home/hermesctl/.ssh/authorized_keys

注意:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 484)May include surrounding context.

text
被控机检查:

  sudo stat -c '%a %U:%G %n' /home/hermesctl/.ssh
  sudo stat -c '%a %U:%G %n' /home/hermesctl/.ssh/authorized_keys
  sudo sshd -t
  sudo visudo -c

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 580)May include surrounding context.

text
==============================

1. 通过控制台或其他管理员入口登录被控机。
2. 从 /home/hermesctl/.ssh/authorized_keys 只删除该机器对应公钥行。
3. 验证旧私钥连接失败。
4. 如果不再需要任何 Hermes 管理,删除云防火墙和系统防火墙中的主控 IP SSH 规则。
5. 根据审计需求决定锁定还是保留 hermesctl 账户,不要误删其他用户和密钥。

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 210)May include surrounding context.

text
4. 只有一致后,才把**核验过的那一行**加入 known_hosts:

  cat "$HK" >> /root/.ssh/known_hosts
  chmod 600 /root/.ssh/known_hosts
  rm -f "$HK"

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 211)May include surrounding context.

text
4. 只有一致后,才把**核验过的那一行**加入 known_hosts:

  cat "$HK" >> /root/.ssh/known_hosts
  chmod 600 /root/.ssh/known_hosts
  rm -f "$HK"

写入前确认文件里只有一行、且是 ed25519:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/remote-vps-control-setup.txt (reported line 681)May include surrounding context.

text
/root/.ssh/hermes_<alias>_ed25519       每机独立私钥,0600
  /root/.ssh/hermes_<alias>_ed25519.pub   对应公钥
  /root/.ssh/config                       严格 Host 块
  /root/.ssh/known_hosts                  已核验的被控机 Host Key

被控端:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 28)May include surrounding context.

md
## Overview

通过当前主控机(运行 agent 的那台)安全管理其他 VPS。默认采用:**每台被控机独立 Ed25519 密钥 + 独立 `hermesctl` 账户 + `from="IP/32"` 来源限制 + SSH Host Key 固定 + 最小 sudo 权限**。账户名 `hermesctl` 只是本文的示例命名,换成 `agentctl` 之类同样成立。

本 Skill 只保留每次都必须遵守的流程。首次接入、密钥轮换、IP 变更、撤销或故障恢复时,加载完整命令手册:`references/remote-vps-control-setup.txt`。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 36)May include surrounding context.

md
- 接入新的被控 VPS;
- 通过 SSH 检查或维护已接入 VPS;
- 修改管理 IP、sudo 或防火墙权限;
- 轮换/撤销 SSH 密钥;
- 排查 SSH、Host Key、sudo 或来源白名单故障。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 38)May include surrounding context.

md
- 通过 SSH 检查或维护已接入 VPS;
- 修改管理 IP、sudo 或防火墙权限;
- 轮换/撤销 SSH 密钥;
- 排查 SSH、Host Key、sudo 或来源白名单故障。

仅操作你明确拥有或获授权管理的主机。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 108)May include surrounding context.

md
按完整手册配置:

- `sudoers`:优先最小权限,执行 `visudo -c`;
- sshd:只针对 `hermesctl` 禁止密码、PTY 和转发,执行 `sshd -t` 后 reload;
- 云防火墙和系统防火墙:先增加 `<MANAGEMENT_IPV4>/32 -> SSH_PORT`,再开新连接复测;
- 只有复测成功且获得授权后,才删除 `0.0.0.0/0` 等宽规则。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 122)May include surrounding context.

md
- BatchMode SSH 成功;
- 私钥、远端 `.ssh` 和 `authorized_keys` 权限正确;
- Host Key 已固定;
- sudo 与授权范围一致;
- `sshd -t`、`visudo -c` 通过;
- 云防火墙、系统防火墙和 `from=` 三层来源一致;
- 未执行任何禁止的重启/关机操作。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 123)May include surrounding context.

md
- 私钥、远端 `.ssh` 和 `authorized_keys` 权限正确;
- Host Key 已固定;
- sudo 与授权范围一致;
- `sshd -t`、`visudo -c` 通过;
- 云防火墙、系统防火墙和 `from=` 三层来源一致;
- 未执行任何禁止的重启/关机操作。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 155)May include surrounding context.

md
### 轮换

新建不同路径的新密钥 → 远端并行加入新公钥 → 用 `-i` 显式测试 → 更新 alias → 验证 SSH/sudo → 删除远端旧公钥 → 确认旧密钥被拒绝后再处理本地旧私钥。不得覆盖旧密钥原地轮换。

### 撤销

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 177)May include surrounding context.

md
- `Permission denied (publickey)`:检查 `IdentitiesOnly`、私钥权限、远端属主/权限、`from=` 和目标看到的来源 IP。
- timeout/refused:检查目标、端口、云/系统防火墙和 sshd 监听。
- Host Key changed:立即停止,通过厂商控制台重新核验;不得自动删除旧记录。
- sudo 要密码:检查 sudoers 路径、模式、绝对命令路径和 `sudo -n`。
- PTY 失败:`restrict` 下属于预期,改用非交互命令;确需 PTY 才申请例外。
- 主控可连、温备不可连:通常说明 `/32` 或独立密钥限制正常,按 Active/Passive 方案更新。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 177)May include surrounding context.

md
- `Permission denied (publickey)`:检查 `IdentitiesOnly`、私钥权限、远端属主/权限、`from=` 和目标看到的来源 IP。
- timeout/refused:检查目标、端口、云/系统防火墙和 sshd 监听。
- Host Key changed:立即停止,通过厂商控制台重新核验;不得自动删除旧记录。
- sudo 要密码:检查 sudoers 路径、模式、绝对命令路径和 `sudo -n`。
- PTY 失败:`restrict` 下属于预期,改用非交互命令;确需 PTY 才申请例外。
- 主控可连、温备不可连:通常说明 `/32` 或独立密钥限制正常,按 Active/Passive 方案更新。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 187)May include surrounding context.

md
2. 未核验 Host Key 就接受首次连接。
3. 新连接未通过就删除旧 SSH 规则。
4. 使用过期的主控出口 IP。
5. 为方便直接给完整 sudo 或关闭严格 Host Key 检查。
6. 把本地文件工具误当成远端文件工具。
7. 只执行命令、不做变更后验证。