T09 · Insecure Skill Coding Practices
- Location
scripts/common.py:281- Finding
Base64-Encoded Remote Shell Execution Obscures the Effective Payload
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent remote training helper, but its SSH scripts can exceed the promised project-folder boundary in some configurations, so it needs review before install.
Install only after reviewing the scripts and using a dedicated non-root SSH account limited to the training project. Keep log_path and log_candidates relative to the project, set a non-empty process_match or train_command, prefer key-based SSH over password mode, and avoid using this against servers that contain unrelated sensitive workloads.
scripts/common.py:281Base64-Encoded Remote Shell Execution Obscures the Effective Payload
scripts/common.py:339Absolute Log Paths Bypass the Declared Project-Directory Boundary
scripts/common.py:406Empty Process Matcher Causes Remote Process Enumeration
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
.env
.env.local
config.local.json
config.*.local.json
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
.env
.env.local
config.local.json
config.*.local.json
config.private.json
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_AUTODL_HOST",
"port": 22,
"username": "root",
"ssh_key_path": "~/.ssh/id_rsa",
"strict_host_key_checking": "accept-new",
"project_path": "/root/autodl-tmp/your-project",
"allowed_project_roots": [
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_AUTODL_HOST",
"port": 22,
"username": "root",
"ssh_key_path": "~/.ssh/id_rsa",
"strict_host_key_checking": "accept-new",
"project_path": "/root/autodl-tmp/your-project",
"allowed_project_roots": [
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "region-1.autodl.example",
"port": 22,
"username": "root",
"ssh_key_path": "~/.ssh/id_ed25519",
"project_path": "/root/autodl-tmp/your-project",
"allowed_project_roots": ["/root/autodl-tmp"],
"env_name": "llm-train",
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def __init__(self, description: str) -> None:
super().__init__(description=description)
self.add_argument("--config", help="Path to a JSON config file.")
self.add_argument("--env-file", help="Path to a .env file.")
self.add_argument("--host")
self.add_argument("--port", type=int)
self.add_argument("--username")
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
file_data = json.load(handle)
config.update(file_data)
env_data = os.environ.copy()
env_data.update(load_env_file(getattr(args, "env_file", None)))
for key, env_name in ENV_MAP.items():
value = env_data.get(env_name)
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
file_data = json.load(handle)
config.update(file_data)
env_data = os.environ.copy()
env_data.update(load_env_file(getattr(args, "env_file", None)))
for key, env_name in ENV_MAP.items():
value = env_data.get(env_name)
The skill explicitly instructs the agent to read files, access environment-provided secrets, and execute shell commands over SSH, but it does not declare any tool scope such as permissions or allowed-tools. That creates a capability/visibility mismatch: a reviewer or enforcement layer cannot easily constrain or audit what the skill is allowed to access, increasing the risk of unintended command execution, secret exposure, or broader filesystem interaction than expected.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- Confirm `host`, `port`, `username`, and `ssh_key_path`.
- Test SSH manually with the same host and key.
- Ensure the key has correct permissions such as `chmod 600 ~/.ssh/id_rsa`.
- If host key prompts block automation, keep `strict_host_key_checking` as `accept-new` or pre-populate `known_hosts`.
- If the server is password-based, export `AUTOCLAW_TRAIN_SSH_PASSWORD` before running the scripts.
The code handles an SSH password by placing it into an environment variable and creating an askpass helper script, which increases exposure of a sensitive credential to local process inspection, crash dumps, inherited environments, or accidental logging. In a skill explicitly designed to operate remote servers, this is more dangerous because compromise of the credential grants direct infrastructure access.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
env.setdefault("DISPLAY", "autoclaw:0")
try:
result = subprocess.run(
command,
input=None if ssh_password else script,
text=True,
This Python file contains multiple natural-language strings presented to users in Chinese, such as failure causes and remediation guidance. The skill does not indicate that it is intentionally region-specific or provide any user opt-in for language selection, which conflicts with the language/locale policy criterion.
The convergence assessment strings returned by the code are all in Chinese, and they flow directly into the final human-readable summary. Because no alternative language path or opt-in is provided, the skill enforces a specific locale in user-visible output.
The assembled human_summary is entirely composed of Chinese phrases, which means end users receive output in a fixed language regardless of preference. This is a natural-language policy issue because the file does not offer opt-in, negotiation, or justification for the locale restriction.
The assessment strings returned to the user are hard-coded in Chinese, including the default summary and bottleneck warnings. This forces a specific language for user-facing output without opt-in or justification, which matches the language/locale policy violation criteria.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
{build_activation_block(config)}
exec {train_command}
EOF_AUTOCLAW_LAUNCHER
chmod 700 "$LAUNCHER_PATH"
nohup "$LAUNCHER_PATH" >> "$TRAIN_LOG" 2>&1 < /dev/null &
PID=$!
sleep 2
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
exec {train_command}
EOF_AUTOCLAW_LAUNCHER
chmod 700 "$LAUNCHER_PATH"
nohup "$LAUNCHER_PATH" >> "$TRAIN_LOG" 2>&1 < /dev/null &
PID=$!
sleep 2
RUNNING=0
The short description forces a specific language in user-facing metadata and does not offer any language/locale choice or explain that the skill is intended only for Chinese-speaking users. This can violate language/locale policy when skills are expected to avoid imposing a language without user opt-in.
This is a manifest/config file, so vague-trigger checks apply. The file defines operational parameters for SSH access and training execution, but provides no activation constraints, invocation scope, or exclusion conditions that would clarify when this skill should or should not be used.
The example configuration hard-codes SSH access as the root user, normalizing privileged remote operation as the default path. In the context of a skill that executes training operations over SSH, this increases the blast radius of any command misuse, path manipulation, or downstream compromise on the remote host.
No suspicious patterns detected.