CVE-2023-48223 (GCVE-0-2023-48223)

Vulnerability from cvelistv5 – Published: 2023-11-20 17:39 – Updated: 2024-08-02 21:23
VLAI?
Title
fast-jwt JWT Algorithm Confusion
Summary
fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to version 3.3.2, the fast-jwt library does not properly prevent JWT algorithm confusion for all public key types. The 'publicKeyPemMatcher' in 'fast-jwt/src/crypto.js' does not properly match all common PEM formats for public keys. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work if the victim application utilizes a public key containing the `BEGIN RSA PUBLIC KEY` header. Applications using the RS256 algorithm, a public key with a `BEGIN RSA PUBLIC KEY` header, and calling the verify function without explicitly providing an algorithm, are vulnerable to this algorithm confusion attack which allows attackers to sign arbitrary payloads which will be accepted by the verifier. Version 3.3.2 contains a patch for this issue. As a workaround, change line 29 of `blob/master/src/crypto.js` to include a regular expression.
CWE
  • CWE-20 - Improper Input Validation
Assigner
Impacted products
Vendor Product Version
nearform fast-jwt Affected: < 3.3.2
Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T21:23:39.066Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "name": "https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg",
            "tags": [
              "x_refsource_CONFIRM",
              "x_transferred"
            ],
            "url": "https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg"
          },
          {
            "name": "https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29",
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29"
          },
          {
            "name": "https://github.com/nearform/fast-jwt/releases/tag/v3.3.2",
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://github.com/nearform/fast-jwt/releases/tag/v3.3.2"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "product": "fast-jwt",
          "vendor": "nearform",
          "versions": [
            {
              "status": "affected",
              "version": "\u003c 3.3.2"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to version 3.3.2, the fast-jwt library does not properly prevent JWT algorithm confusion for all public key types. The \u0027publicKeyPemMatcher\u0027 in \u0027fast-jwt/src/crypto.js\u0027 does not properly match all common PEM formats for public keys. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work if the victim application utilizes a public key containing the `BEGIN RSA PUBLIC KEY` header. Applications using the RS256 algorithm, a public key with a `BEGIN RSA PUBLIC KEY` header, and calling the verify function without explicitly providing an algorithm, are vulnerable to this algorithm confusion attack which allows attackers to sign arbitrary payloads which will be accepted by the verifier. Version 3.3.2 contains a patch for this issue. As a workaround, change line 29 of `blob/master/src/crypto.js` to include a regular expression."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "attackComplexity": "HIGH",
            "attackVector": "NETWORK",
            "availabilityImpact": "NONE",
            "baseScore": 5.9,
            "baseSeverity": "MEDIUM",
            "confidentialityImpact": "NONE",
            "integrityImpact": "HIGH",
            "privilegesRequired": "NONE",
            "scope": "UNCHANGED",
            "userInteraction": "NONE",
            "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N",
            "version": "3.1"
          }
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-20",
              "description": "CWE-20: Improper Input Validation",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2023-11-20T17:39:56.816Z",
        "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
        "shortName": "GitHub_M"
      },
      "references": [
        {
          "name": "https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg",
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg"
        },
        {
          "name": "https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29"
        },
        {
          "name": "https://github.com/nearform/fast-jwt/releases/tag/v3.3.2",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/nearform/fast-jwt/releases/tag/v3.3.2"
        }
      ],
      "source": {
        "advisory": "GHSA-c2ff-88x2-x9pg",
        "discovery": "UNKNOWN"
      },
      "title": "fast-jwt JWT Algorithm Confusion"
    }
  },
  "cveMetadata": {
    "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
    "assignerShortName": "GitHub_M",
    "cveId": "CVE-2023-48223",
    "datePublished": "2023-11-20T17:39:56.816Z",
    "dateReserved": "2023-11-13T13:25:18.480Z",
    "dateUpdated": "2024-08-02T21:23:39.066Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "vulnerability-lookup:meta": {
    "fkie_nvd": {
      "configurations": "[{\"nodes\": [{\"operator\": \"OR\", \"negate\": false, \"cpeMatch\": [{\"vulnerable\": true, \"criteria\": \"cpe:2.3:a:nearform:fast-jwt:*:*:*:*:*:node.js:*:*\", \"versionEndExcluding\": \"3.3.2\", \"matchCriteriaId\": \"04216FDF-08CB-4312-9068-BE70476DD1C4\"}]}]}]",
      "descriptions": "[{\"lang\": \"en\", \"value\": \"fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to version 3.3.2, the fast-jwt library does not properly prevent JWT algorithm confusion for all public key types. The \u0027publicKeyPemMatcher\u0027 in \u0027fast-jwt/src/crypto.js\u0027 does not properly match all common PEM formats for public keys. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work if the victim application utilizes a public key containing the `BEGIN RSA PUBLIC KEY` header. Applications using the RS256 algorithm, a public key with a `BEGIN RSA PUBLIC KEY` header, and calling the verify function without explicitly providing an algorithm, are vulnerable to this algorithm confusion attack which allows attackers to sign arbitrary payloads which will be accepted by the verifier. Version 3.3.2 contains a patch for this issue. As a workaround, change line 29 of `blob/master/src/crypto.js` to include a regular expression.\"}, {\"lang\": \"es\", \"value\": \"fast-jwt proporciona una implementaci\\u00f3n r\\u00e1pida de JSON Web Token (JWT). Antes de la versi\\u00f3n 3.3.2, la librer\\u00eda fast-jwt no evita adecuadamente la confusi\\u00f3n del algoritmo JWT para todos los tipos de claves p\\u00fablicas. El \u0027publicKeyPemMatcher\u0027 en \u0027fast-jwt/src/crypto.js\u0027 no coincide correctamente con todos los formatos PEM comunes para claves p\\u00fablicas. Para explotar esta vulnerabilidad, un atacante necesita crear un token JWT malicioso que contenga el algoritmo HS256, firmado con la clave RSA p\\u00fablica de la aplicaci\\u00f3n v\\u00edctima. Este ataque solo funcionar\\u00e1 si la aplicaci\\u00f3n v\\u00edctima utiliza una clave p\\u00fablica que contenga el encabezado \\\"BEGIN RSA PUBLIC KEY\\\". Las aplicaciones que utilizan el algoritmo RS256, una clave p\\u00fablica con un encabezado \\\"BEGIN RSA PUBLIC KEY\\\", y que llaman a la funci\\u00f3n de verificaci\\u00f3n sin proporcionar expl\\u00edcitamente un algoritmo, son vulnerables a este ataque de confusi\\u00f3n de algoritmo que permite a los atacantes firmar payloads arbitrarios que ser\\u00e1n aceptadas por el verificador. La versi\\u00f3n 3.3.2 contiene un parche para este problema. Como workaround, cambie la l\\u00ednea 29 de `blob/master/src/crypto.js` para incluir una expresi\\u00f3n regular.\"}]",
      "id": "CVE-2023-48223",
      "lastModified": "2024-11-21T08:31:14.567",
      "metrics": "{\"cvssMetricV31\": [{\"source\": \"security-advisories@github.com\", \"type\": \"Secondary\", \"cvssData\": {\"version\": \"3.1\", \"vectorString\": \"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N\", \"baseScore\": 5.9, \"baseSeverity\": \"MEDIUM\", \"attackVector\": \"NETWORK\", \"attackComplexity\": \"HIGH\", \"privilegesRequired\": \"NONE\", \"userInteraction\": \"NONE\", \"scope\": \"UNCHANGED\", \"confidentialityImpact\": \"NONE\", \"integrityImpact\": \"HIGH\", \"availabilityImpact\": \"NONE\"}, \"exploitabilityScore\": 2.2, \"impactScore\": 3.6}, {\"source\": \"nvd@nist.gov\", \"type\": \"Primary\", \"cvssData\": {\"version\": \"3.1\", \"vectorString\": \"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N\", \"baseScore\": 5.9, \"baseSeverity\": \"MEDIUM\", \"attackVector\": \"NETWORK\", \"attackComplexity\": \"HIGH\", \"privilegesRequired\": \"NONE\", \"userInteraction\": \"NONE\", \"scope\": \"UNCHANGED\", \"confidentialityImpact\": \"NONE\", \"integrityImpact\": \"HIGH\", \"availabilityImpact\": \"NONE\"}, \"exploitabilityScore\": 2.2, \"impactScore\": 3.6}]}",
      "published": "2023-11-20T18:15:07.047",
      "references": "[{\"url\": \"https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29\", \"source\": \"security-advisories@github.com\", \"tags\": [\"Product\"]}, {\"url\": \"https://github.com/nearform/fast-jwt/releases/tag/v3.3.2\", \"source\": \"security-advisories@github.com\", \"tags\": [\"Release Notes\"]}, {\"url\": \"https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg\", \"source\": \"security-advisories@github.com\", \"tags\": [\"Exploit\", \"Vendor Advisory\"]}, {\"url\": \"https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29\", \"source\": \"af854a3a-2127-422b-91ae-364da2661108\", \"tags\": [\"Product\"]}, {\"url\": \"https://github.com/nearform/fast-jwt/releases/tag/v3.3.2\", \"source\": \"af854a3a-2127-422b-91ae-364da2661108\", \"tags\": [\"Release Notes\"]}, {\"url\": \"https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg\", \"source\": \"af854a3a-2127-422b-91ae-364da2661108\", \"tags\": [\"Exploit\", \"Vendor Advisory\"]}]",
      "sourceIdentifier": "security-advisories@github.com",
      "vulnStatus": "Modified",
      "weaknesses": "[{\"source\": \"security-advisories@github.com\", \"type\": \"Secondary\", \"description\": [{\"lang\": \"en\", \"value\": \"CWE-20\"}]}, {\"source\": \"nvd@nist.gov\", \"type\": \"Primary\", \"description\": [{\"lang\": \"en\", \"value\": \"NVD-CWE-noinfo\"}]}]"
    },
    "nvd": "{\"cve\":{\"id\":\"CVE-2023-48223\",\"sourceIdentifier\":\"security-advisories@github.com\",\"published\":\"2023-11-20T18:15:07.047\",\"lastModified\":\"2024-11-21T08:31:14.567\",\"vulnStatus\":\"Modified\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to version 3.3.2, the fast-jwt library does not properly prevent JWT algorithm confusion for all public key types. The \u0027publicKeyPemMatcher\u0027 in \u0027fast-jwt/src/crypto.js\u0027 does not properly match all common PEM formats for public keys. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work if the victim application utilizes a public key containing the `BEGIN RSA PUBLIC KEY` header. Applications using the RS256 algorithm, a public key with a `BEGIN RSA PUBLIC KEY` header, and calling the verify function without explicitly providing an algorithm, are vulnerable to this algorithm confusion attack which allows attackers to sign arbitrary payloads which will be accepted by the verifier. Version 3.3.2 contains a patch for this issue. As a workaround, change line 29 of `blob/master/src/crypto.js` to include a regular expression.\"},{\"lang\":\"es\",\"value\":\"fast-jwt proporciona una implementaci\u00f3n r\u00e1pida de JSON Web Token (JWT). Antes de la versi\u00f3n 3.3.2, la librer\u00eda fast-jwt no evita adecuadamente la confusi\u00f3n del algoritmo JWT para todos los tipos de claves p\u00fablicas. El \u0027publicKeyPemMatcher\u0027 en \u0027fast-jwt/src/crypto.js\u0027 no coincide correctamente con todos los formatos PEM comunes para claves p\u00fablicas. Para explotar esta vulnerabilidad, un atacante necesita crear un token JWT malicioso que contenga el algoritmo HS256, firmado con la clave RSA p\u00fablica de la aplicaci\u00f3n v\u00edctima. Este ataque solo funcionar\u00e1 si la aplicaci\u00f3n v\u00edctima utiliza una clave p\u00fablica que contenga el encabezado \\\"BEGIN RSA PUBLIC KEY\\\". Las aplicaciones que utilizan el algoritmo RS256, una clave p\u00fablica con un encabezado \\\"BEGIN RSA PUBLIC KEY\\\", y que llaman a la funci\u00f3n de verificaci\u00f3n sin proporcionar expl\u00edcitamente un algoritmo, son vulnerables a este ataque de confusi\u00f3n de algoritmo que permite a los atacantes firmar payloads arbitrarios que ser\u00e1n aceptadas por el verificador. La versi\u00f3n 3.3.2 contiene un parche para este problema. Como workaround, cambie la l\u00ednea 29 de `blob/master/src/crypto.js` para incluir una expresi\u00f3n regular.\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"security-advisories@github.com\",\"type\":\"Secondary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N\",\"baseScore\":5.9,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"NETWORK\",\"attackComplexity\":\"HIGH\",\"privilegesRequired\":\"NONE\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"NONE\"},\"exploitabilityScore\":2.2,\"impactScore\":3.6},{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N\",\"baseScore\":5.9,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"NETWORK\",\"attackComplexity\":\"HIGH\",\"privilegesRequired\":\"NONE\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"NONE\"},\"exploitabilityScore\":2.2,\"impactScore\":3.6}]},\"weaknesses\":[{\"source\":\"security-advisories@github.com\",\"type\":\"Secondary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-20\"}]},{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"NVD-CWE-noinfo\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:a:nearform:fast-jwt:*:*:*:*:*:node.js:*:*\",\"versionEndExcluding\":\"3.3.2\",\"matchCriteriaId\":\"04216FDF-08CB-4312-9068-BE70476DD1C4\"}]}]}],\"references\":[{\"url\":\"https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Product\"]},{\"url\":\"https://github.com/nearform/fast-jwt/releases/tag/v3.3.2\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Release Notes\"]},{\"url\":\"https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Exploit\",\"Vendor Advisory\"]},{\"url\":\"https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Product\"]},{\"url\":\"https://github.com/nearform/fast-jwt/releases/tag/v3.3.2\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Release Notes\"]},{\"url\":\"https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Exploit\",\"Vendor Advisory\"]}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…