CVE-2023-39655: @perfood/couch auth CouchAuth Host Header Injection Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-fqh6-6h6c-366m
CVSS 8.1
CWE-74
Published
Advisory Summary

CVE-2023-39655 is a HIGH (CVSS 8.1) couchauth host header injection vulnerability vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting @perfood/couch auth libraries in the npm ecosystem. The issue involves couchauth host header injection vulnerability leaks the password reset token. Remediation is available in the latest vendor maintenance releases.

CVE-2023-39655 at a Glance

CVE Identifier CVE-2023-39655
GHSA Identifier GHSA-fqh6-6h6c-366m
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product @perfood/couch auth
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

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:R/S:U/C:H/I:H/A:N).

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

How to Fix CVE-2023-39655

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

@perfood/couch-auth fixed: Latest secure release
npm install @perfood/couch-auth@Latest secure release
Verify Direct and Transitive Dependencies

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

npm ls @perfood/couch-auth

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2023-39655, inspect your project dependencies using npm:

npm ls @perfood/couch-auth

Analyze the terminal output to locate any version of @perfood/couch auth in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls @perfood/couch-auth command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In @perfood/couch auth, 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

A host header injection vulnerability exists in the NPM package @perfood/couch-auth versions <= 0.20.0. By sending a specially crafted host header in the forgot password request, it is possible to send password reset links to users which, once clicked, lead to an attacker-controlled server and thus leak the password reset token. This may allow an attacker to reset other users' passwords and take over their accounts.

CVE-2023-39655 Affected @perfood/couch auth Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
@perfood/couch-auth
npm
≤ 0.20.0

References

Frequently Asked Questions

What is CVE-2023-39655?
CVE-2023-39655 is a security vulnerability in @perfood/couch auth involving CouchAuth host header injection vulnerability leaks the password reset token under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which @perfood/couch auth versions are affected?
Affected versions include releases prior to current release patches across affected packages: @perfood/couch-auth.
What version fixes CVE-2023-39655?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is @perfood/couch-auth affected?
Yes, @perfood/couch-auth is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2023-39655?
CVE-2023-39655 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2023-39655?
CVE-2023-39655 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2023-39655?
Run the dependency tree command: 'npm ls @perfood/couch-auth'. 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-fqh6-6h6c-366m",
  "modified" : "2024-01-03T22:03:52Z",
  "published" : "2024-01-03T15:30:26Z",
  "aliases" : [ "CVE-2023-39655" ],
  "summary" : "CouchAuth host header injection vulnerability leaks the password reset token",
  "details" : "A host header injection vulnerability exists in the NPM package @perfood/couch-auth versions <= 0.20.0. By sending a specially crafted host header in the forgot password request, it is possible to send password reset links to users which, once clicked, lead to an attacker-controlled server and thus leak the password reset token. This may allow an attacker to reset other users' passwords and take over their accounts.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@perfood/couch-auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.20.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-39655"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dub-flow/vulnerability-research/tree/main/CVE-2023-39655"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/perfood/couch-auth"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/%40perfood/couch-auth"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-03T22:03:52Z",
    "nvd_published_at" : "2024-01-03T13:15:08Z"
  }
}