The vulnerability lies in a flawed configuration within the openclaw package that could lead to an approval bypass. Specifically, if the sort command is manually added to the tools.exec.safeBins configuration, a malicious user could leverage the --compress-program argument of sort to execute an arbitrary command.
The analysis of the provided patch commit 57fbbaebca4d34d17549accf6092ae26eb7b605c reveals the root cause of the vulnerability. The patch modifies the safe-bin policy for the sort command in src/infra/exec-safe-bin-policy.ts. Before the fix, the --compress-program flag was part of the valueFlags list, meaning it was considered safe. The patch moves this flag to the blockedFlags list.
The function validateSafeBinArgv, located in the same file, is responsible for checking a command's arguments against these policies. The associated test files confirm that validateSafeBinArgv is the function that directly consumes this flawed policy. When a command is checked, this function would be called, and prior to the patch, it would have incorrectly approved the malicious command. Therefore, validateSafeBinArgv is identified as the key vulnerable function, as it's the component that fails to prevent the unsafe operation due to the incorrect policy.