T03 · Remote Payload Retrieval and Execution
- Location
scripts/install-server-env.sh:36- Finding
Unverified Remote NodeSource Scripts Are Executed Directly by Bash
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This deployment skill fits its stated purpose, but it embeds credentials and uses root-level deployment scripts with unsafe SSH and deletion behavior that require careful review before use.
Do not install this as-is for any reachable or production server. Rotate any exposed Git or SSH/root passwords, remove real credentials from the package and history, use a non-root deploy account, require verified host keys and HTTPS/SSH Git transport, validate all paths and branch/backup inputs, and add explicit approval before deploy or rollback.
scripts/install-server-env.sh:36Unverified Remote NodeSource Scripts Are Executed Directly by Bash
deploy-config.json:2Reusable Git and Root Server Credentials Are Hardcoded in the Skill
scripts/deploy.sh:17Git Credentials Are Sent over Plain HTTP and Embedded in the Clone URL
scripts/deploy.sh:51Unquoted Deployment Inputs Permit Command Injection in a Remote Root Shell
scripts/rollback.sh:21Rollback Version Input Permits Root Command Injection and Unsafe Deletion
scripts/setup.sh:59SSH Host Authentication Is Explicitly Disabled During Trust Establishment
README.md:98Deployment Architecture Grants Excessive Root and Elevated Command Authority
scripts/deploy.sh:75Unpinned Dependencies and Build Hooks Execute on the Production Server
scripts/configure-ssh-manual.sh:15Manual SSH Configuration Script Starts an Endless Remote Command and Mishandles the Password
The README advertises that a plain-language request will cause end-to-end development and deployment, but it does not prominently warn users that live systems may be modified. In this context, missing warnings materially increase the chance of accidental production changes, unauthorized deployment, or social-engineered triggering by benign-looking requests.
The README instructs adding a deployment key to root's authorized_keys, granting persistent remote login capability to the root account. In an automation skill with deployment privileges, compromise of the corresponding private key would immediately yield full server control, greatly increasing blast radius.
cat ~/.ssh/server_deploy.pub
### 1.3 验证 SSH 连接
The rollback procedure performs destructive deletion of the deployment directory contents and service interruption without a prominent warning about downtime, data loss, or path-safety requirements. If the path is wrong, empty, or manipulated, the deletion step can destroy critical files on the remote server.
This exact command, rm -rf /www/wwwroot/points/*, is a destructive operation against a live deployment path. If executed against the wrong host or path, or if the rollback copy step fails after deletion, it can leave the service unavailable and destroy deployed contents irreversibly.
# 恢复备份
ssh user@server << EOF
systemctl stop points-service
rm -rf /www/wwwroot/points/*
cp -r /www/backup/$BACKUP/* /www/wwwroot/points/
systemctl start points-service
EOF
This exact command, rm -rf /www/wwwroot/points/*, is a destructive operation against a live deployment path. If executed against the wrong host or path, or if the rollback copy step fails after deletion, it can leave the service unavailable and destroy deployed contents irreversibly.
# 恢复备份
ssh user@server << EOF
systemctl stop points-service
rm -rf /www/wwwroot/points/*
cp -r /www/backup/$BACKUP/* /www/wwwroot/points/
systemctl start points-service
EOF
The document discloses a plaintext root password and explicitly instructs password-based SSH access, including use of sshpass and disabled host key checking. This creates immediate credential exposure risk, enables unauthorized root access if the file is leaked, and normalizes insecure operational practices in a deployment workflow.
The script hardcodes the root SSH password in plaintext and uses it in a security-sensitive workflow. Any user with access to the file, logs, backups, or source repository can recover the credential and use it for unauthorized server access, especially because the target account is root.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SERVER_IP="192.168.1.168"
SERVER_USER="root"
SERVER_PASSWORD="zhangjiamin"
SSH_KEY_PUB="/home/node/.ssh/server_deploy.pub"
# 读取公钥
PUBLIC_KEY=$(cat $SSH_KEY_PUB)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SERVER_IP="192.168.1.168"
SERVER_USER="root"
SERVER_PASSWORD="zhangjiamin"
SSH_KEY_PUB="/home/node/.ssh/server_deploy.pub"
# 读取公钥
PUBLIC_KEY=$(cat $SSH_KEY_PUB)
Appending a key to ~/.ssh/authorized_keys grants persistent SSH access to the remote account, which here is root. In an agent skill context, this is especially dangerous because it establishes durable remote access and closely matches common persistence and backdoor techniques if done without strong operator controls.
yes
$SERVER_PASSWORD
mkdir -p ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
echo "✅ SSH Key 配置完成"
The script injects a public key into root's authorized_keys on a remote host, creating persistent privileged access. In the absence of safeguards, approvals, host authenticity checks, or any limiting controls, this behavior is highly consistent with backdoor persistence techniques and is especially dangerous in an agent-executable skill.
#!/bin/bash
# 使用 SSH 密码连接并配置公钥
SERVER_IP="192.168.1.168"
SERVER_USER="root"
SERVER_PASSWORD="zhangjiamin"
SSH_KEY_PUB="/home/node/.ssh/server_deploy.pub"
# 读取公钥
PUBLIC_KEY=$(cat $SSH_KEY_PUB)
echo "🔑 正在配置 SSH Key 到服务器..."
echo ""
# 使用 ssh 命令配合密码输入
ssh ${SERVER_USER}@${SERVER_IP} << EOF
yes
$SERVER_PASSWORD
mkdir -p ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
echo "✅ SSH Key 配置完成"
exit
EOF
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
mkdir -p ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
echo "✅ SSH Key 配置完成"
exit
EOF
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
mkdir -p ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
echo "✅ SSH Key 配置完成"
exit
EOF
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
mkdir -p ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
echo "✅ SSH Key 配置完成"
exit
EOF
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
mkdir -p ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
echo "✅ SSH Key 配置完成"
exit
EOF
The script hardcodes a root SSH password and uses Expect to automate password-based authentication for ssh-copy-id. Storing and transmitting privileged credentials in plaintext makes secret disclosure likely through source control, logs, backups, or local file access, and compromise of this password grants direct root access to the target host.
A hardcoded password is embedded directly in the script and then used for authentication. Plaintext secrets in code are highly exposed to anyone with repository, filesystem, backup, or artifact access, and here the secret protects a root account, making the blast radius especially severe.
The script executes rm -rf $DEPLOY_PATH/* on the remote host without quoting or validating DEPLOY_PATH. If deploy-config.json is incorrect, maliciously modified, or contains shell metacharacters/command substitutions, this can delete unintended paths or lead to command injection on the target server, making the deployment context significantly more dangerous because it runs over SSH against production infrastructure.
set -e
echo " [1/3] 解压部署包..."
rm -rf $DEPLOY_PATH/*
tar -xzf /tmp/points-deploy.tar.gz -C $DEPLOY_PATH
echo " [2/3] 停止旧服务..."
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).
fi
# 清理临时文件
rm /tmp/points-deploy.tar.gz
EOF
log_info "部署完成"
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).
fi
# 清理临时文件
rm /tmp/points-deploy.tar.gz
EOF
log_info "部署完成"
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).
COMMIT_MSG=$(echo "$COMMIT_INFO" | tail -1)
# 清理
ssh -i "$SSH_KEY" -p "$SERVER_PORT" "$SERVER_USER@$SERVER_HOST" "rm -f /tmp/deploy-commit.txt"
# 部署完成摘要
echo ""
The script interpolates unquoted variables into a remote shell here-document and then executes a destructive command, rm -rf $DEPLOY_PATH/*. If deploy-config.json or the backup name is malformed, empty, or attacker-controlled, shell expansion or path confusion could cause deletion of unintended directories on the remote host; the same issue affects the restore copy command using $BACKUP_NAME. The skill context makes this more dangerous because it is an operational deployment script that runs against production-like infrastructure over SSH with file deletion and service control privileges.
pm2 stop points 2>/dev/null || systemctl stop points-service 2>/dev/null || true
echo "恢复备份..."
rm -rf $DEPLOY_PATH/*
cp -r $BACKUP_PATH/$BACKUP_NAME/* $DEPLOY_PATH/
echo "启动服务..."
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
echo "✅ 使用现有 SSH Key"
fi
else
echo "生成新的 SSH Key..."
ssh-keygen -t ed25519 -C "openclaw-server" -f ~/.ssh/server_deploy -N ""
fi
echo ""
echo "📋 公钥内容(复制添加到服务器):"
echo "----------------------------------------"
cat ~/.ssh/server_deploy.pub
echo "----------------------------------------"
echo ""
echo "请登录服务器执行:"
echo " mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
echo " 然后粘贴上面的公钥内容,按 Ctrl+D 结束"
echo ""
read -p "按回车继续..."
# 步骤 2:配置服务器信息
echo ""
echo "📌 步骤 2/4: 配置服务器信息"
echo ""
read -p "服务器 IP 地址: " SERVER_IP
read -p "SSH 端口(默认 22): " SERVER_PORT
SERVER_PORT=${SERVER_PORT:-22}
read -p "SSH 用户(默认 root): " SERVER_USER
SERVER_USER=${SERVER_USER:-root}
read -p "部署路径(默认 /www/wwwroot/points): " DEPLOY_PATH
DEPLOY_PATH=${DEPLOY_PATH:-/www/wwwroot/points}
read -p "�
The script hardcodes a root username, server IP, and plaintext password, then prints them along with instructions for logging in and installing an SSH key for persistent access. Even on a private LAN, exposing privileged credentials and encouraging root-level key enrollment creates a serious risk of credential leakage, unauthorized access, and later persistence.
Appending a key into ~/.ssh/authorized_keys is a direct mechanism for establishing trusted remote access. In this script, the operation is explicitly tied to a root login workflow, making it a privileged persistence vector if performed by an unauthorized user or under misleading instructions.
console.log('2️⃣ 在服务器上执行:');
console.log(' mkdir -p ~/.ssh');
console.log(' echo "' + publicKey + '" >> ~/.ssh/authorized_keys');
console.log(' chmod 700 ~/.ssh');
console.log(' chmod 600 ~/.ssh/authorized_keys');
console.log(' exit');