CVE-2024-41122: Go.woodpecker ci.org/woodpecker/v2 Woodpecker's Custom Environment Variables Allow Vulnerability

MODERATE
Advisory Identifier: GHSA-3wf2-2pq4-4rvc
CVSS 7.5
CWE-74
Published
Advisory Summary

CVE-2024-41122 is a MODERATE (CVSS 7.5) woodpecker's custom environment variables allow vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Go.woodpecker ci.org/woodpecker/v2 libraries in the Go ecosystem. The issue involves woodpecker's custom environment variables allow to alter execution flow of plugins. Remediation is available by upgrading affected packages to version 2.7.0.

CVE-2024-41122 at a Glance

CVE Identifier CVE-2024-41122
GHSA Identifier GHSA-3wf2-2pq4-4rvc
Severity MODERATE
CVSS v3.1 Base Score 7.5
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Go.woodpecker ci.org/woodpecker/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-41122

To remediate this vulnerability, upgrade all affected Go.woodpecker ci.org/woodpecker/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

go.woodpecker-ci.org/woodpecker/v2 fixed: 2.7.0
Upgrade go.woodpecker-ci.org/woodpecker/v2 to 2.7.0
go.woodpecker-ci.org/woodpecker fixed: 2.7.0
Upgrade go.woodpecker-ci.org/woodpecker to 2.7.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for go.woodpecker-ci.org/woodpecker/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-41122, inspect your project dependencies for Go.woodpecker ci.org/woodpecker/v2:

inspect dependencies for go.woodpecker-ci.org/woodpecker/v2

Analyze the terminal output to locate any version of Go.woodpecker ci.org/woodpecker/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Go.woodpecker ci.org/woodpecker/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact The server allow to create any user who can trigger a pipeline run malicious workflows: - Those workflows can either lead to a host takeover that runs the agent executing the workflow. - Or allow to extract the secrets who would be normally provided to the plugins who's entrypoint are overwritten. ### Patches https://github.com/woodpecker-ci/woodpecker/pull/3909 https://github.com/woodpecker-ci/woodpecker/pull/3934 ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ **Enable the "gated" repo feature and review each change upfront of running** ### References - https://github.com/woodpecker-ci/woodpecker/pull/3909 - https://github.com/woodpecker-ci/woodpecker/pull/3934 - https://github.com/woodpecker-ci/woodpecker-security/issues/10 (info will be published later at https://github.com/woodpecker-ci/woodpecker/issues/3929) - https://github.com/woodpecker-ci/woodpecker/issues/3929 (info will be published later once we got adoption of the update) ### Credits - Daniel Kilimnik [@D_K_Dev](https://x.com/D_K_Dev) (Neodyme AG) - Felipe Custodio Romero [@_localo_](https://x.com/_localo_) (Neodyme AG)

CVE-2024-41122 Affected Go.woodpecker ci.org/woodpecker/v2 Versions

2 component(s)
Fixed Versions:
2.7.0
Product / Package Ecosystem Affected Versions Fixed Version
go.woodpecker-ci.org/woodpecker/v2
Go
< 2.7.0
2.7.0
go.woodpecker-ci.org/woodpecker
Go
< 2.7.0
2.7.0

References

Frequently Asked Questions

What is CVE-2024-41122?
CVE-2024-41122 is a security vulnerability in Go.woodpecker ci.org/woodpecker/v2 involving Woodpecker's custom environment variables allow to alter execution flow of plugins under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Go.woodpecker ci.org/woodpecker/v2 versions are affected?
Affected versions include releases prior to 2.7.0 across affected packages: go.woodpecker-ci.org/woodpecker/v2, go.woodpecker-ci.org/woodpecker.
What version fixes CVE-2024-41122?
Upgrading to 2.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is go.woodpecker-ci.org/woodpecker/v2 affected?
Yes, go.woodpecker-ci.org/woodpecker/v2 is affected in releases prior to 2.7.0. Upgrade your dependency to 2.7.0 or later.
Is go.woodpecker-ci.org/woodpecker affected?
Yes, go.woodpecker-ci.org/woodpecker is affected in releases prior to 2.7.0. Upgrade your dependency to 2.7.0 or later.
What is the CVSS score of CVE-2024-41122?
CVE-2024-41122 has a CVSS v3.1 base score of 7.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-41122?
CVE-2024-41122 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2024-41122?
Run the dependency tree command: 'inspect dependencies for go.woodpecker-ci.org/woodpecker/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3wf2-2pq4-4rvc",
  "modified" : "2024-11-18T16:26:54Z",
  "published" : "2024-07-19T19:59:06Z",
  "aliases" : [ "CVE-2024-41122" ],
  "summary" : "Woodpecker's custom environment variables allow to alter execution flow of plugins",
  "details" : "### Impact\nThe server allow to create any user who can trigger a pipeline run malicious workflows:\n- Those workflows can either lead to a host takeover that runs the agent executing the workflow.\n- Or allow to extract the secrets who would be normally provided to the plugins who's entrypoint are overwritten.\n\n### Patches\nhttps://github.com/woodpecker-ci/woodpecker/pull/3909\nhttps://github.com/woodpecker-ci/woodpecker/pull/3934\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n**Enable the \"gated\" repo feature and review each change upfront of running**\n\n### References\n- https://github.com/woodpecker-ci/woodpecker/pull/3909\n- https://github.com/woodpecker-ci/woodpecker/pull/3934\n- https://github.com/woodpecker-ci/woodpecker-security/issues/10 (info will be published later at https://github.com/woodpecker-ci/woodpecker/issues/3929)\n- https://github.com/woodpecker-ci/woodpecker/issues/3929 (info will be published later once we got adoption of the update)\n\n### Credits\n\n- Daniel Kilimnik [@D_K_Dev](https://x.com/D_K_Dev) (Neodyme AG)\n- Felipe Custodio Romero [@_localo_](https://x.com/_localo_) (Neodyme AG)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.woodpecker-ci.org/woodpecker/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.woodpecker-ci.org/woodpecker"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/woodpecker-ci/woodpecker/security/advisories/GHSA-3wf2-2pq4-4rvc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-41122"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woodpecker-ci/woodpecker-security/issues/10"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woodpecker-ci/woodpecker/issues/3929"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woodpecker-ci/woodpecker/pull/3909"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woodpecker-ci/woodpecker/pull/3934"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woodpecker-ci/woodpecker/commit/8aa3e5ec82c92eca3279e4be68625111eeedf1c4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/woodpecker-ci/woodpecker"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-2998"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-19T19:59:06Z",
    "nvd_published_at" : "2024-07-19T20:15:08Z"
  }
}