/

CVE-2026-136187

Severity:

HIGH RISK

(8.8)

OS Command Injection (CWE-78) in Spug Credential API

CVE-2026-136187

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Authenticated command execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Spug has an OS command injection vulnerability in the credential-check endpoint, where a crafted Git URL can cause shell metacharacters to be interpreted as commands. An authenticated user who can reach the endpoint may execute commands with the privileges of the Spug service account; in Docker deployments, that account may run as root.

Affected context

The vulnerability affects Spug deployments with the vulnerable credential-check behavior. The /api/credential/check/ endpoint passes user-supplied Git URL data to git ls-remote using shell=True, creating risk when that data is interpreted by a shell. The described affected releases are Spug versions before 4.1.1; the impact depends in part on the privileges of the service account and deployment environment.

Exploit preconditions

  • Attack surface: The Spug /api/credential/check/ API endpoint
  • Required access: An authenticated account able to submit requests to the endpoint
  • Trigger point: Processing of user-supplied Git URL data for the Git remote check
  • Why exploitation is possible: The data is passed to a shell-backed command, allowing shell metacharacters to alter command interpretation

Why this happens

The underlying bug is OS command injection, mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command. User-controlled Git URL data is incorporated into a command that runs with shell=True, so shell syntax may be interpreted rather than treated strictly as data. The risk comes from constructing shell commands with untrusted input instead of using a structured process invocation and constrained arguments.

Potential impact

  • An authenticated attacker may execute commands as the Spug service account.
  • The attacker could access or modify data and resources available to that account.
  • In Docker deployments where the service account runs as root, compromise could affect the container with elevated privileges.
  • Depending on the environment and exposed permissions, an attacker may disrupt services or attempt further movement.

General mitigation guidance

Mitigations generally focus on preventing untrusted input from becoming shell syntax and limiting the consequences of command execution.

Common defensive patterns include:

  • Use process APIs that pass executable names and arguments separately, avoiding shell interpretation.
  • Validate Git URL input against a narrowly defined format and reject unexpected values.
  • Prefer a constrained library or dedicated mechanism for checking remote repositories where practical.
  • Run the service with least privilege; avoid root execution in containers and restrict container capabilities.
  • Limit endpoint access and apply authorization policies appropriate to the credential-check operation.

How teams detect issues like this

Detection can combine code review, runtime monitoring, and policy checks:

  • Use static analysis to identify shell-backed process execution and trace whether arguments include request data.
  • Review command construction around Git operations, especially uses of shell=True and string interpolation.
  • Monitor endpoint activity and child-process creation for unexpected commands or unusual process trees.
  • Apply code and deployment policies that prohibit shell execution with user-controlled values and discourage root-running containers.

Automated security review tools may help flag risky command-execution patterns.

Sources

SourceLink
github.comgithub.com/openspug/spug/blob/v4.1.0/spug_api/apps/credential/views.py#L47-L60
github.comgithub.com/openspug/spug/blob/v4.1.0/spug_api/libs/gitlib.py#L197-L208
github.comgithub.com/openspug/spug/commit/8e4c8199995406abea26a2d3e0f6ed487577d853
github.comgithub.com/openspug/spug/releases/tag/v4.1.1
github.comgithub.com/openspug/spug/security/advisories/GHSA-xp2v-72m9-wqfv
vulncheck.comvulncheck.com/advisories/spug-4.0.0-before-4.1.1-os-command-injection-via-credential-check-endpoint

Frequently asked

questions

It can be triggered through the API endpoint, but exploitation requires an authenticated user who can submit data to the credential-check operation.

An account with access to /api/credential/check/ is required. The potential impact depends on the privileges assigned to the Spug service account.

Avoid invoking a shell with user-controlled command data. Pass executable arguments separately and validate input against the expected Git URL format.

Use safe process APIs, review data flows into command execution, restrict access to sensitive endpoints, and run services with least privilege.

Find out what's already
exploitable in your codebase.