T05 · Unauthorized Access and Privilege Escalation
- Location
send.sh:9- Finding
Unvalidated Agent Identifier Allows Unauthorized Credential Selection
- Content
View full analysis
Vulnerability Details
File Location:
send.sh, lines 9-34
Vulnerability Type: Missing authorization and input validation
Risk Level: MediumVulnerable Code
bash AGENT=$1 TARGET=$2 MSG_TYPE=$3 MESSAGE=$4 if [ -z "$AGENT" ] || [ -z "$TARGET" ] || [ -z "$MSG_TYPE" ] || [ -z "$MESSAGE" ]; then echo "用法:$0 {agent} {target} {msg_type} {message}" echo "示例:" echo " $0 ass ou_afa28cfc5689f929f1b1d8f3b09b9408 open_id \"私聊消息\"" echo " $0 ass oc_88fbbe55e37eca3c3339b2f4bae1a8a9 chat_id \"群聊消息\"" echo " $0 ops ou_xxxxxxxxxxxxxxxxxxxxxxxxxxx open_id \"运维消息\"" exit 1 fi # 配置文件路径 CONFIG_FILE="$HOME/.openclaw/openclaw-${AGENT}.json" if [ ! -f "$CONFIG_FILE" ]; then echo "错误:配置文件不存在:$CONFIG_FILE" exit 1 fi # 读取配置 APP_ID=$(jq -r '.channels.feishu.appId' "$CONFIG_FILE") APP_SECRET=$(jq -r '.channels.feishu.appSecret' "$CONFIG_FILE")Technical Analysis
The documentation defines the permitted agent values as
assandops, but the script only checks whether the argument is empty. It directly incorporates the caller-controlled value into a credential configuration filename.Consequently, a caller can select another existing configuration that follows the
openclaw-<agent>.jsonnaming convention, such as a privilegedbossconfiguration. If that file contains the expected Feishu fields and is readable by the process, the script extracts its App ID and App Secret, obtains a tenant token, and sends a message using that application's identity.The script does not directly disclose the App Secret or transmit it to an unrelated domain. However, it acts as a credential-use oracle that enables operations under an application identity the caller was not intended to select.
Attack Path
- An attacker or untrusted agent gains permission to invoke
send.sh. - The attacker supplies an undocumented agent identifier corresponding to another ...[truncated 861 chars]
- An attacker or untrusted agent gains permission to invoke
- Remediation
View remediation
Remediation Suggestions
Enforce an explicit allowlist before deriving or accessing any configuration path:
bash case "$AGENT" in ass) CONFIG_FILE="$HOME/.openclaw/openclaw-ass.json" ;; ops) CONFIG_FILE="$HOME/.openclaw/openclaw-ops.json" ;; *) echo "Invalid agent identifier" exit 1 ;; esacAdditional hardening should include:
- Use a fixed mapping rather than concatenating user input into a path.
- Resolve the canonical path and verify that it exactly matches an approved configuration file.
- Apply restrictive permissions to credential files, such as owner-only read access.
- Run separate agents under separate operating-system accounts where practical.
- Ensure that each runtime identity can read only its own configuration.
- Add authorization checks at the skill invocation boundary so untrusted agents cannot select application identities.
