T07 · Tool Hijacking and Spoofing
- Location
run.sh:7- Finding
Unverified PATH-Resolved Executable Allows Tool Hijacking
- Content
View full analysis
/dev/null; then echo "错误:salary-natural 命令未找到" echo "请先安装:cd /Users/claw/.openclaw/workspace-ideacat/hr-skills/salary-research && npm link" exit 1 fi # 执行 salary-natural 命令,传递所有参数 salary-natural "$@" ``` ### Technical Analysis The script locates and executes `salary-natural` using the process's `PATH`. Although `command -v` checks that an executable with this name is available, it does not establish that the resolved executable is the intended or trusted implementation. The subsequent invocation performs the same uncontrolled name-based resolution. An attacker who can place a malicious executable named `salary-natural` in a directory that appears earlier in `PATH` can make the script execute attacker-controlled code. The external `salary-natural` implementation is not included in the audited project. Consequently, its provenance, integrity, version, network behavior, and handling of salary queries or sensitive enterprise data cannot be verified from this package. ### Attack Path 1. An attacker creates a malicious executable named `salary-natural`. 2. The attacker places it in a writable directory, such as a compromised user binary directory or working-directory-related path entry. 3. That directory is placed before the legitimate installation directory in the victim's `PATH`. 4. The victim or an agent invokes `run.sh`. 5. `command -v salary-natural` finds the attacker's executable and treats it as valid. 6. The final `salary-natural "$@"` statement executes the malicious program with the invoking user's permissions and forwards all supplied arguments to it. 7. The malicious executable can perform arbitrary actions available to that user while presenting itself as the expected salary-research t ...[truncated 794 chars]- Remediation
View remediation
&2 exit 1 fi # Optionally verify a pinned checksum or signature here. exec "$SALARY_NATURAL" "$@" ``` ]]>
