T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/manage.py:12- Finding
Unrestricted Loading of a Hard-Coded Workspace Credential File
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does what it claims at a high level, but it has under-disclosed, high-impact Docker and credential-handling behavior that users should review carefully before installing.
Install only if you are comfortable giving this skill strong Portainer control over the configured Docker endpoint. Before use, remove or review the hard-coded .env loading, rotate any Portainer key previously used with this implementation, avoid running update until the helper-container key exposure and ng-agent deletion behavior are fixed, and use a narrowly scoped Portainer API key where possible.
scripts/manage.py:12Unrestricted Loading of a Hard-Coded Workspace Credential File
scripts/manage.py:134Portainer API Key Persisted in Docker Container Command Metadata
scripts/manage.py:134Shell Command Injection Through Unsafely Interpolated Configuration Values
scripts/manage.py:108Undeclared Forced Deletion of Potentially Unrelated Containers
scripts/manage.py:134Mutable Redeployer Image and Unpinned Runtime Package Installation
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
if data is not None:
req.data = json.dumps(data).encode()
try:
resp = urllib.request.urlopen(req, timeout=timeout)
if raw:
return resp.status, resp.read()
return resp.status, json.loads(resp.read())
The script automatically loads credentials from a hard-coded .env path in the workspace. This creates implicit credential access behavior and couples privileged API use to a developer-specific file location, which can surprise operators and expose secrets if the workspace is shared or improperly protected.
import json, os, urllib.parse, urllib.request, sys
from datetime import datetime, timezone, timedelta
# Auto-load .env from workspace root
_env_path = '/home/node/.openclaw/workspace/liyj/.env'
if os.path.isfile(_env_path):
with open(_env_path) as _f:
The .env parsing logic reads arbitrary key/value pairs from a local workspace file into process environment variables without user confirmation. In this privileged management script, that behavior can silently import sensitive credentials or attacker-controlled configuration that alters where privileged API requests are sent.
from datetime import datetime, timezone, timedelta
# Auto-load .env from workspace root
_env_path = '/home/node/.openclaw/workspace/liyj/.env'
if os.path.isfile(_env_path):
with open(_env_path) as _f:
for _line in _f:
The code force-deletes containers matching 'ng-agent' even though that action is unrelated to the stated stack redeploy purpose. Deleting unrelated containers can cause denial of service, interfere with other agents or security tooling, and exceeds the principle of least privilege.
The skill exposes capabilities that can access environment variables, make network requests, and execute shell commands, but the manifest does not declare any tool scope or permission boundaries. For a stack-management skill that can stop and redeploy services through the Portainer API, this lack of explicit scope increases the chance of unintended or overly broad execution in an automation environment.
The documentation describes update and redeploy behavior that stops stacks and replaces running services, but it does not clearly warn operators about service interruption, replacement risk, or the operational impact of targeting the wrong stack. In this context, that omission is security-relevant because the skill performs high-impact infrastructure actions and could be invoked without adequate operator awareness or safeguards.
The script embeds the Portainer API key and full stack payload into a shell script executed inside a temporary container over host networking. This transmits privileged credentials and configuration into another execution environment, increasing exposure through process inspection, logs, container metadata, or compromise of that helper container.
script = (
'apk add -q curl\n'
f'echo "R: 1/2 Stopping stack {stack_id}..."\n'
f'curl -sS -X POST -H "X-API-Key: {KEY}" '
f'{HOST}/api/stacks/{stack_id}/stop?endpointId={EP} >/dev/null\n'
f'echo ""\n'
f'echo "R: 2/2 Deploying with updated config..."\n'
The skill claims to manage stacks, but it also directly restarts a specific container outside stack-scoped operations. This creates a broader operational capability than advertised, increasing the chance of unintended service disruption or misuse by callers who expect only stack-level actions.
The script performs impactful actions such as image pulls, stack stop/redeploy, and container restart without an interactive confirmation or a dry-run safeguard. In an agent skill context, this makes accidental or unintended destructive operations more likely, especially when invoked programmatically.
The script fetches stack environment metadata from Portainer and logs the variable names. Even without values, variable names can disclose sensitive implementation details such as the presence of secret-bearing configuration, third-party integrations, or internal service names.