T09 · Insecure Skill Coding Practices
- Location
scripts/create_app.py:434- Finding
Workspace credential can be transmitted to an arbitrary API origin
- Content
View full analysis
Vulnerability Details
File Location:
scripts/create_app.py:65-78,scripts/create_app.py:134-161,scripts/create_app.py:207-230,scripts/create_app.py:285-313, andscripts/create_app.py:434-438
Vulnerability Type: User-controlled credential destination
Risk Level: CriticalVulnerable Code
python def read_token(token_path: str = ".openclaw/workspace/token") -> str: """Read the API token from file.""" try: # Try relative to current workspace token_file = Path(token_path) if token_file.exists(): return token_file.read_text().strip() # Try absolute path abs_token_file = Path("/home/admin/.openclaw/workspace/token") if abs_token_file.exists(): return abs_token_file.read_text().strip()python parser.add_argument( '--api-url', default='https://api.loopspace.xyz', help='App Hub API base URL (default: https://api.loopspace.xyz)' )python endpoint = f"{api_base_url.rstrip('/')}/api/app_hub/create" headers = { 'Token': token, 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.post( endpoint, json=app_data, headers=headers, timeout=30 )The detail and update operations construct their endpoints from the same user-controlled
api_base_urland attach the same token.Technical Analysis
The command-line
--api-urlargument accepts an unrestricted base URL. The script reads an authentication token from a workspace file and attaches it to create, detail, and update requests using theTokenheader.There is no trusted-host allowlist, HTTPS enforcement, origin comparison, port restriction, or redirect control. Consequently, a caller can replace the intended App Hub API origin with an attacker-controlled server. The option also accepts plaintext HTTP URLs, allowing credentials to ...[truncated 1307 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--api-urlif alternate API deployments are not a required feature. - Otherwise, enforce an explicit allowlist of exact HTTPS origins before reading the token.
- Parse the URL and validate the normalized scheme, hostname, port, username, and password fields.
- Reject HTTP, IP-literal hosts, embedded credentials, unexpected ports, and hostname suffix tricks.
- Configure requests not to follow redirects for credential-bearing calls, or verify that every redirect remains on the exact trusted origin.
- Load a narrowly scoped App Hub token only after the destination has passed validation.
- Prefer separate credentials for separate approved environments rather than sending one workspace token to configurable hosts.
- Remove
