T05 · Unauthorized Access and Privilege Escalation
- Location
send.sh:27- Finding
Path Traversal Allows Unauthorized Feishu Credential Selection
- Content
View full analysis
Vulnerability Details
File Location:
send.sh, lines 10 and 27–40
Vulnerability Type: Path traversal and insufficient access control
Risk Level: HighVulnerable Code
bash AGENT=$1 # Configuration file path CONFIG_FILE="$HOME/.openclaw/openclaw-${AGENT}.json" if [ ! -f "$CONFIG_FILE" ]; then echo "Error: configuration file does not exist: $CONFIG_FILE" exit 1 fi # Read configuration APP_ID=$(jq -r '.channels.feishu.appId' "$CONFIG_FILE") APP_SECRET=$(jq -r '.channels.feishu.appSecret' "$CONFIG_FILE") if [ -z "$APP_ID" ] || [ -z "$APP_SECRET" ] || [ "$APP_ID" == "null" ] || [ "$APP_SECRET" == "null" ]; then echo "Error: unable to read Feishu credentials from configuration file" exit 1 fiTechnical Analysis
The first command-line argument is used directly when constructing a sensitive configuration-file path. The script does not restrict the argument to a known agent identifier, reject path separators, canonicalize the resulting path, or verify that the resolved file remains under
$HOME/.openclaw.An argument containing traversal components such as
../can consequently cause the path to resolve outside the intended configuration directory. The selected file must have a.jsonsuffix and contain values at.channels.feishu.appIdand.channels.feishu.appSecret, but no other authorization check is performed before those credentials are used.This violates least privilege because a caller permitted to select an agent can potentially select another readable JSON credential file instead.
Attack Path
- An attacker obtains the ability to invoke
send.shand control itsagentargument. - The attacker supplies an argument containing traversal components that resolves to another readable JSON file.
- The script confirms only that the resulting path identifies a regular file.
jqextractschannels.feishu.appIdand `channels.feishu.appSecr ...[truncated 862 chars]
- An attacker obtains the ability to invoke
- Remediation
View remediation
Remediation Suggestions
- Replace arbitrary agent selection with an explicit allowlist of supported agent identifiers.
- At minimum, enforce a strict identifier format containing only letters, digits, underscores, and hyphens.
- Reject values containing
/,\,.., control characters, or leading dots. - Resolve the candidate path to its canonical form and verify that it remains inside the canonical
$HOME/.openclawdirectory. - Consider mapping each permitted agent identifier to a fixed configuration path instead of constructing paths from user input.
- Verify that configuration files are owned by the expected account, are not symbolic links, and have restrictive permissions such as
0600. - Run the script with an account that can read only the credential files required for its legitimate function.
