Use of Hard-coded Credentials Affecting github.com/go-tribe/gotribe/pkg/token package, versions *


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.55% (42nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use of Hard-coded Credentials vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMGOTRIBEGOTRIBEPKGTOKEN-7830478
  • published25 Aug 2024
  • disclosed24 Aug 2024
  • creditgtqbhksl

Introduced: 24 Aug 2024

CVE-2024-8135  (opens in a new tab)
CWE-798  (opens in a new tab)

How to fix?

A fix was pushed into the master branch but not yet published.

Overview

Affected versions of this package are vulnerable to Use of Hard-coded Credentials in the token.go component. An attacker can use the Sign function and gain unauthorized access by manipulating the config.key argument, which results in exploiting the hard-coded credentials.

PoC

var (
    config = Config{"Rtg8BPKNEf2mB4mgvKONGPZZQSaJWNLijxR42qRgq0iBb5", "identityKey"}
    once   sync.Once
)
...........
...........
// Sign 使用 jwtSecret 签发 token,token 的 claims 中会存放传入的 subject.
func Sign(identityKey string) (tokenString string, err error) {
    // Token 的内容
    token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
        config.identityKey: identityKey,
        "nbf":              time.Now().Unix(),
        "iat":              time.Now().Unix(),
        "exp":              time.Now().Add(100000 * time.Hour).Unix(),
    })
    // 签发 token
    tokenString, err = token.SignedString([]byte(config.key))

    return
}

CVSS Base Scores

version 4.0
version 3.1