Back to skill

Security audit

Docker Claude Code Setup

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Docker setup guide, but it recommends unsafe defaults that can expose a writable web shell and grant broad persistent agent permissions.

Review before installing. Do not expose the ttyd port to a public or shared network unless it is bound to localhost or protected by strong authentication and network controls. Avoid the wildcard Claude Code permission examples, keep secrets out of persistent workspace files where possible, and prefer pinned or verified installation steps over curl-to-bash.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (5)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/install-acpx.sh:8
Finding

Unverified Remote Script Executed with Elevated Privileges

Content
View full analysis
/dev/null; then echo "Installing Node.js..." curl -fsSL https://deb.nodesource.com/setup_20.x | bash - apt-get install -y nodejs fi ``` ### Technical Analysis The downloaded response is passed directly to Bash without being saved, inspected, version-pinned, or verified against a trusted cryptographic signature or checksum. The subsequent use of `apt-get` indicates that the instructions or script are expected to run with root-level privileges, particularly in a Docker container. NodeSource is a recognizable provider, but the endpoint serves mutable content. Trust in the current domain owner does not protect against DNS compromise, TLS termination compromise, upstream infrastructure compromise, or an unintended future modification to the remote installer. This behavior exceeds the minimum privilege necessary to install Node.js because safer package installation and verification methods are available. ### Attack Path 1. An attacker compromises the remote endpoint, its delivery infrastructure, DNS resolution, or another component capable of changing the HTTP response. 2. A user or agent follows the Skill instructions or invokes `scripts/install-acpx.sh` in a privileged container. 3. `curl` retrieves the attacker-controlled response. 4. The shell executes that response immediately through the pipe. 5. The payload runs with the invoking user's privileges, potentially root inside the container. 6. The payload can alter package repositories, install additional software, access mounted secrets, or modify ...[truncated 420 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/start-ttyd.sh:29
Finding

Unauthenticated Writable Web Terminal Exposes an Interactive Shell

Content
View full analysis
/dev/null || true sleep 1 # Start ttyd with tmux echo "=== Starting ttyd + tmux ===" nohup ttyd -p $PORT -W bash -c "export LANG=zh_CN.UTF-8; cd $WORKSPACE && tmux new -A -s main" > /tmp/ttyd.log 2>&1 & ``` The accompanying guidance explicitly enables writable access and advertises external access: ```bash # Basic startup ttyd -p 6080 -W tmux new -A -s main # Startup with environment variables ttyd -p 6080 -W bash -c "export LANG=zh_CN.UTF-8; export MY_VAR=value; tmux new -A -s main" ``` ```text - Local: http://localhost:6080 - External: http://YOUR_IP:6080 ``` No authentication option, loopback-only bind, TLS configuration, firewall restriction, or other mandatory access control is configured. The `-W` option grants terminal write capability, and all visitors attach to the persistent `main` tmux session. ### Technical Analysis A web terminal is equivalent to remote shell access. Enabling write access without authentication breaks the system's access-control boundary. Unless the environment independently restricts the listener, ttyd may be reachable through the container or host network. Advertising the external URL increases the likelihood that the port will be published or exposed. The shared tmux session compounds the issue because an unauthenticated visitor may observe an existing authenticated session, terminal history, environment-derived credentials, active commands, and filesystem content. HTTPS alone would not correct the missing authorization; it only protects traffic in transit. This exposure is unnecessary for the declared functionality. Persistent browser terminal acc ...[truncated 1157 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
references/claude-code-installation.md:52
Finding

Blanket Claude Code Permissions Disable Least-Privilege Controls

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/start-ttyd.sh:7
Finding

Unsafe Shell Construction and Global Process Termination in ttyd Launcher

Content
View full analysis
/dev/null || true sleep 1 # Start ttyd with tmux echo "=== Starting ttyd + tmux ===" nohup ttyd -p $PORT -W bash -c "export LANG=zh_CN.UTF-8; cd $WORKSPACE && tmux new -A -s main" > /tmp/ttyd.log 2>&1 & ``` ### Technical Analysis `$WORKSPACE`, which incorporates the environment-controlled value of `$HOME`, is interpolated into a command string passed to `bash -c` without shell escaping. Shell metacharacters in the value can alter the nested command. `$PORT` is also unquoted and is not validated as a numeric TCP port, permitting argument splitting and option confusion. Separately, `pkill -9 ttyd` terminates every process with the matching name that the current user is allowed to signal. It does not verify that a process belongs to this script, uses the requested port, or is the intended service instance. `SIGKILL` also prevents graceful cleanup. ### Attack Path A shell-injection exploitation path is: 1. An attacker gains influence over the script's environment, particularly `HOME`, or over how the launcher is invoked. 2. The script constructs `WORKSPACE` from the attacker-influenced value. 3. That value is inserted into the quoted string supplied to `bash -c`. 4. Shell metacharacters in the interpolated value are interpreted by the nested Bash process. 5. Attacker-selected commands execute with the launcher's privileges. A denial-of-service path is: 1. Other ttyd instances are running under the same account or a privileged account. 2. The script is invoked. 3. `pkill -9 ttyd` forcibly terminates all matching instances, including unrelated services. 4. Existing terminal users lose their sessions and unsaved state. ### Impact As ...[truncated 386 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/acpx-setup.md:19
Finding

API Keys Are Encouraged in Plaintext Persistent Configuration

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (37)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · references/api-configuration.md (reported line 32)May include surrounding context.

claude

text

### 方法 2: .env 文件

在项目目录创建 `.env`:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · references/api-configuration.md (reported line 72)May include surrounding context.

claude

text

### 方法 2: .env 文件

在项目目录创建 `.env`:

Credential Access

High
Category
Privilege Escalation
Confidence
79% confidence
Finding

The Docker persistence guidance suggests creating ~/workspace/.env in a persistent workspace, which can encourage storing secrets in a long-lived, potentially shared or mounted path inside container environments. In Docker/OpenClaw-style setups, persisted workspaces are often easier to copy, back up, or accidentally commit, increasing the chance of API key disclosure.

Content

Scanner excerpt · references/api-configuration.md (reported line 66)May include surrounding context.

bash
# 在持久化目录存储配置
mkdir -p ~/workspace/.claude
mkdir -p ~/workspace/.env

# 创建符号链接
ln -sf ~/workspace/.claude ~/.claude

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · references/claude-code-installation.md (reported line 55)May include surrounding context.

4. 权限配置

创建 ~/.claude/settings.local.json:

json
{

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · references/claude-code-installation.md (reported line 91)May include surrounding context.

4. 权限配置

创建 ~/.claude/settings.local.json:

json
{

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · references/claude-code-installation.md (reported line 90)May include surrounding context.

md
| 文件 | 用途 |
|------|------|
| `~/.claude/settings.json` | 全局设置 |
| `~/.claude/settings.local.json` | 本地权限配置 |
| `CLAUDE.md` | 项目级指令文件 |

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

Scanner excerpt · references/claude-code-installation.md (reported line 99)May include surrounding context.

bash
claude              # 启动交互式会话
claude "task"       # 直接执行任务
claude --print      # 输出到 stdout
claude --help       # 查看帮助

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill includes shell commands and operational setup steps but declares no explicit tool scope or allowed-tools boundary. In an agent setting, this increases the chance that the skill will invoke shell-capable behavior without least-privilege constraints, which can lead to unintended command execution or broader system changes than the user expects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs users to start a browser-accessible ttyd terminal and advertises persistent sessions, but it does not warn that this exposes an interactive shell over HTTP. If bound beyond localhost, misconfigured, or left unauthenticated, an attacker could gain remote shell access or hijack an existing session.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

The skill recommends persisting directories that may contain credentials, session state, and tool configuration across container lifecycles. This is not inherently malicious, but if those paths are shared, weakly permissioned, or mounted into less-trusted environments, sensitive tokens and history may be exposed or reused by unauthorized parties.

Content

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

在 Docker 容器中,将配置目录映射到持久化存储:

bash
# Create persistent directories / 创建持久化目录
mkdir -p ~/workspace/claude-code/.claude
mkdir -p ~/workspace/.acpx
mkdir -p ~/workspace/.gradle  # For Android projects

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation shows API keys embedded directly in a JSON config file and shell exports without any warning about secret handling, file permissions, or safer alternatives. In a Docker and multi-agent setup, this increases the chance that users store credentials in persistent volumes, shell history, images, or shared configs where they may be exposed to other users or processes.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · references/acpx-setup.md (reported line 67)May include surrounding context.

bash
# 创建持久化目录
mkdir -p ~/workspace/.acpx

# 创建符号链接
ln -sf ~/workspace/.acpx ~/.acpx

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/api-configuration.md (reported line 10)May include surrounding context.

md
| 提供商 | BASE_URL | 说明 |
|--------|----------|------|
| Anthropic | https://api.anthropic.com | 官方 API |
| 腾讯 Coding | https://api.lkeap.cloud.tencent.com/coding/anthropic | Coding Plan |
| DeepSeek | https://api.deepseek.com | DeepSeek API |
| 百度千帆 | https://aip.baidubce.com/rpc/2.0/ai_custom/v1 | 百度 API |
| 阿里百炼 | https://dashscope.aliyuncs.com/compatible-mode/v1 | 阿里 API |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
# 使用代理服务
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://api.example.com/v1"
export ANTHROPIC_MODEL="model-name"  # 可选

# 启动 Claude Code

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/acpx-setup.md (reported line 85)May include surrounding context.

md
# 使用代理服务
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://api.example.com/v1"
export ANTHROPIC_MODEL="model-name"  # 可选

# 启动 Claude Code

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/api-configuration.md (reported line 25)May include surrounding context.

md
# 使用代理服务
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://api.example.com/v1"
export ANTHROPIC_MODEL="model-name"  # 可选

# 启动 Claude Code

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/api-configuration.md (reported line 38)May include surrounding context.

md
# 使用代理服务
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://api.example.com/v1"
export ANTHROPIC_MODEL="model-name"  # 可选

# 启动 Claude Code

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/api-configuration.md (reported line 85)May include surrounding context.

md
# 使用代理服务
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://api.example.com/v1"
export ANTHROPIC_MODEL="model-name"  # 可选

# 启动 Claude Code

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/claude-code-installation.md (reported line 48)May include surrounding context.

md
# 使用代理服务
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="https://api.example.com/v1"
export ANTHROPIC_MODEL="model-name"  # 可选

# 启动 Claude Code

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The instructions create persistent storage for Claude configuration and link it into the home directory, which can preserve credentials, session artifacts, and permission settings across container restarts. In web-terminal or shared container contexts, this expands the lifetime and recoverability of sensitive state, making post-compromise access or accidental leakage more likely.

Content

Scanner excerpt · references/api-configuration.md (reported line 65)May include surrounding context.

bash
# 在持久化目录存储配置
mkdir -p ~/workspace/.claude
mkdir -p ~/workspace/.env

# 创建符号链接

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide instructs users to grant Claude unrestricted Read, Edit, Write, and Bash access across all paths using wildcards. In a containerized setup that may be mounted to host workspaces or secrets, this removes meaningful safeguards and can enable destructive file modification, data exposure, or arbitrary command execution without adequate warning or scope limitation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
81% confidence
Finding

Persisting the entire ~/.claude directory into a mounted workspace can retain API keys, conversation history, settings, and other sensitive agent state beyond the container lifecycle. In shared Docker environments or host-mounted directories, this increases the chance of unintended access, leakage, or reuse of privileged configuration by other users or processes.

Content

Scanner excerpt · references/claude-code-installation.md (reported line 78)May include surrounding context.

bash
# 创建持久化目录
mkdir -p ~/workspace/claude-code/.claude

# 创建符号链接
ln -sf ~/workspace/claude-code/.claude ~/.claude

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · references/ttyd-tmux-setup.md (reported line 22)May include surrounding context.

或从源码编译

git clone https://github.com/tsl0922/ttyd.git cd ttyd && mkdir build && cd build cmake .. && make && make install

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example uses ttyd with the -W flag, which enables interactive remote input rather than read-only viewing, but the documentation does not warn that this grants remote users the ability to execute commands in the served shell session. Because the command launches tmux/bash, an exposed writable terminal can be used to run arbitrary commands, access secrets, modify files, or pivot further depending on container permissions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document explicitly advertises access via an external IP for a web-exposed terminal but does not mention authentication, network restriction, or that anyone who can reach the port may obtain terminal access. In the context of ttyd serving a shell/tmux session, this can lead to full remote command execution in the container and potentially host-impacting actions depending on container privileges and mounted resources.

Content

No source excerpt is available for this finding.