Summary
A command injection vulnerability in the OpenClaw maintainer script scripts/update-clawtributors.ts allows arbitrary shell commands to be executed when processing crafted Git commit author metadata.
The issue only affects environments where contributors, maintainers, or CI systems run bun scripts/update-clawtributors.ts in a repository containing malicious author email fields; normal CLI usage via npm i -g openclaw is not impacted.
Affected context
This vulnerability occurs in the OpenClaw development and maintenance workflow, specifically when the scripts/update-clawtributors.ts script is executed in a local source checkout or CI environment.
It relies on Git history being treated as trusted input: the script reads commit author metadata from git log, derives a GitHub login, and interpolates that value into a shell command executed via execSync.
Only environments that run this script against a repository containing malicious author email values are exposed; users of the published CLI package who do not invoke this script are not directly affected.
Exploit preconditions
- Attack surface: Local development or CI environment where
scripts/update-clawtributors.tsis executed. - Required access: Ability to introduce or control commits in the repository, including author email fields (e.g., through contributing, compromising a contributor account, or poisoning a fork that maintainers run the script against).
- Trigger point: Manual or automated execution of
bun scripts/update-clawtributors.tsin a repository whose Git history includes a maliciously crafted author email. - Why exploitation is possible: The script derives a GitHub login from
git logauthor metadata and interpolates it directly into a shell command executed viaexecSyncwithout sanitization or escaping, allowing shell metacharacters in the author email to break out of the intended command context.
Why this happens
The underlying issue is an instance of CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
The script implicitly trusts Git commit author metadata, constructs a command string using this unvalidated data, and then invokes it via execSync.
Because shell command construction occurs through naive string interpolation rather than safe argument passing or escaping, an attacker-controlled author email can inject shell metacharacters, append additional commands, or alter command behavior.
The bug pattern is treating non-validated metadata (Git log output) as safe when constructing OS-level commands.
Potential impact
- Execution of arbitrary shell commands under the privileges of the maintainer, contributor, or CI runner.
- Exfiltration of repository contents, SSH keys, or other sensitive files present on the development/CI machine.
- Modification or deletion of local source code, build artifacts, or configuration files.
- Poisoning of generated contributor metadata or documentation produced by the script.
- Potential lateral movement within the maintainer's environment, depending on local tooling and access.
General mitigation guidance
Effective mitigations focus on eliminating direct string-based command construction and reducing trust in metadata sources:
- Prefer OS command APIs that accept argument arrays (e.g.,
execFile,spawnwith argument lists) instead of concatenated shell strings, so user-controlled values are not interpreted by a shell. - Treat Git metadata (author names, emails, commit messages) as untrusted input and apply strict validation or whitelisting before using it in commands or scripts.
- Use robust escaping/quoting utilities if values must be passed through a shell, ensuring shell metacharacters are neutralized.
- Decouple contributor data generation from shell invocation where possible (e.g., use HTTP APIs via native libraries instead of shelling out to CLI tools).
- Run maintenance scripts in minimally privileged environments (e.g., isolated CI jobs or containers) with restricted filesystem and credential access.
How teams detect issues like this
Organizations can identify similar vulnerabilities through a combination of static analysis and process checks:
- Configure static analysis or linters to flag dynamic shell execution patterns such as
execSync,exec, orspawnwith a single concatenated string, especially when variables are interpolated. - During code review, scrutinize any use of Git output, environment variables, or other external metadata being fed into command strings or shell pipelines.
- Establish secure coding guidelines that discourage shell command construction with string concatenation and mandate safe process execution APIs.
- Incorporate security-focused checks into CI that scan for known dangerous patterns (e.g.,
execSync(\...${var}...\)) and require explicit justification or mitigation. - Optionally use automated SAST tools tuned with custom rules for command injection risks in scripting utilities and build tooling.

