Summary
The Docker build flow writes sensitive runtime values to a repo-root .env file and then builds from the same root using COPY . .. Because .dockerignore does not exclude .env, gateway tokens and other secrets can be embedded in image layers and extracted by anyone with image access.
CVSS Assessment
| Metric |
Value |
| Score |
9.1 / 10.0 |
| Severity |
Critical |
| Vector |
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
CVSS v3.1 Calculator
Affected Code
File: docker-setup.sh:125
ENV_FILE="$ROOT_DIR/.env"
# ...
upsert_env "$ENV_FILE" \
OPENCLAW_GATEWAY_TOKEN \
OPENCLAW_IMAGE \
OPENCLAW_EXTRA_MOUNTS
docker build \
-t "$IMAGE_NAME" \
-f "$ROOT_DIR/Dockerfile" \
"$ROOT_DIR"
File: Dockerfile:26
File: .dockerignore
.git
.worktrees
.bun-cache
.bun
.tmp
# ... no .env or .env.* ignore rule present
Attack Surface
- Entry point: Pulling or receiving a built image artifact that was produced from a workspace containing
.env
- Authentication: None (unauthenticated/public access to published images)
- Complexity: Low (no special conditions)
- User interaction: None
Steps to Reproduce
- Run the Docker setup flow that writes
.env and builds the image from repo root.
- Export or run the built image.
- Inspect image contents (
docker run --rm <image> cat /app/.env) and observe secret values.
Impact
| Impact Type |
Level |
Description |
| Confidentiality |
High |
Recover OPENCLAW_GATEWAY_TOKEN and other secrets from image layers or /app/.env. |
| Integrity |
High |
Use stolen gateway token to issue authenticated commands against the gateway. |
| Availability |
None |
No direct outage primitive is required for data exfiltration. |
Recommended Fix
Add .env and .env.* to .dockerignore immediately and avoid COPY . . for production builds. Move runtime secret generation outside the Docker build context and pass secrets only at container runtime.
References
- CWE: CWE-200 - Exposure of Sensitive Information to an Unauthorized Actor
Exploit Conditions
Complexity:
User interaction:
Prerequisites: Build performed with secrets present in repo-root .env, and image is shared, pushed to a registry, or otherwise retrievable.
Summary
The Docker build flow writes sensitive runtime values to a repo-root
.envfile and then builds from the same root usingCOPY . .. Because.dockerignoredoes not exclude.env, gateway tokens and other secrets can be embedded in image layers and extracted by anyone with image access.CVSS Assessment
Affected Code
File:
docker-setup.sh:125File:
Dockerfile:26COPY . .File:
.dockerignoreAttack Surface
.envSteps to Reproduce
.envand builds the image from repo root.docker run --rm <image> cat /app/.env) and observe secret values.Impact
OPENCLAW_GATEWAY_TOKENand other secrets from image layers or/app/.env.Recommended Fix
Add
.envand.env.*to.dockerignoreimmediately and avoidCOPY . .for production builds. Move runtime secret generation outside the Docker build context and pass secrets only at container runtime.References
Exploit Conditions
Complexity:
User interaction:
Prerequisites: Build performed with secrets present in repo-root
.env, and image is shared, pushed to a registry, or otherwise retrievable.