Vulnerabilities in pkg:npm/@redwoodjs/api

PACKAGE
Advisory Summary

GHSA-3qmc-2r76-4rqp is a HIGH (CVSS 8.2) redwood is vulnerable to account vulnerability (General Security Weakness) affecting @redwoodjs/api libraries in the npm ecosystem. The issue involves redwood is vulnerable to account takeover via dbauth "forgot-password". Remediation is available by upgrading affected packages to version 2.2.5, 3.3.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@redwoodjs/api

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@redwoodjs/api. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-3qmc-2r76-4rqp - HIGH Redwood is vulnerable to account takeover via dbAuth "forgot-password"

GHSA-3qmc-2r76-4rqp at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-3qmc-2r76-4rqp
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification General Security Weakness
Affected Product @redwoodjs/api
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

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:N/A:L).

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 None (I:N)
Availability Low (A:L)

How to Fix GHSA-3qmc-2r76-4rqp

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

@redwoodjs/api fixed: 2.2.5
npm install @redwoodjs/api@2.2.5
@redwoodjs/api fixed: 3.3.1
npm install @redwoodjs/api@3.3.1
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 @redwoodjs/api

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-3qmc-2r76-4rqp, inspect your project dependencies using npm:

npm ls @redwoodjs/api

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

Note: The npm ls @redwoodjs/api 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 General Security Weakness. In @redwoodjs/api, 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

# Impact _What kind of vulnerability is it? Who is impacted?_ This is an API vulnerability in Redwood's [dbAuth], specifically the dbAuth forgot password feature: - only projects with the dbAuth "forgot password" feature are affected - this vulnerability was introduced in v0.38.0 ## User Accounts are Vulnerable to Takeover (Hijacking) A reset token for any user can be obtained given knowledge of their username or email via the forgot-password API. With the leaked reset token, a malicious user could request to reset a user's password, changing their credentials and gaining access to their account. ## How to Determine if Projects have been Attacked To determine if a project has been attacked, we recommend checking logs for suspicious activity; namely, the volume of requests to the forgot-password API using emails that don't exist. Another indication is if users inform you that they can't access their accounts. If you have question or concerns, reach out via the "For More Information" section below. # Patch Releases Available **The problem has been patched on the v3 and v2 release lines.** Users should upgrade to **v3.3.1+** or **v2.2.5+** respectively. ## Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ We recommend upgrading to the Patch Releases above. If upgrading is not possible, there are several workarounds: ### Manually strip out `resetToken` and `resetTokenExpiresAt` in the `forgotPassword.handler()` Users on all release lines can have their `forgotPassword.handler()` function strip out the sensitive fields manually before returning ```js handler: (user) => { // your code to notify/email user of the link to reset their password... const = { resetToken, resetTokenExpiresAt, ...rest } return rest } ``` ### Use `yarn patch` to manually apply the fix Users on v3 and v2 can use [`yarn patch`] to apply the fix if they're using yarn v3. See the dbAuth "forgot-password" Account Takeover Vulnerability high gist for instructions. ### Disable the forgot password flow entirely v3 only Users on v3 can disable the forgot password flow entirely.

GHSA-3qmc-2r76-4rqp Affected @redwoodjs/api Versions

2 component(s)
Fixed Versions:
2.2.53.3.1
Product / Package Ecosystem Affected Versions Fixed Version
@redwoodjs/api
npm
≥ 0.38.0
< 2.2.5
2.2.5
@redwoodjs/api
npm
≥ 3.0.0
< 3.3.1
3.3.1

References

Frequently Asked Questions

What is GHSA-3qmc-2r76-4rqp?
GHSA-3qmc-2r76-4rqp is a security vulnerability in @redwoodjs/api involving Redwood is vulnerable to account takeover via dbAuth "forgot-password" under General Security Weakness.
Which @redwoodjs/api versions are affected?
Affected versions include releases prior to 2.2.5, 3.3.1 across affected packages: @redwoodjs/api.
What version fixes GHSA-3qmc-2r76-4rqp?
Upgrading to 2.2.5, 3.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @redwoodjs/api affected?
Yes, @redwoodjs/api is affected in releases prior to 2.2.5, 3.3.1. Upgrade your dependency to 2.2.5, 3.3.1 or later.
What is the CVSS score of GHSA-3qmc-2r76-4rqp?
GHSA-3qmc-2r76-4rqp has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L.
What CWE is associated with GHSA-3qmc-2r76-4rqp?
GHSA-3qmc-2r76-4rqp is classified under General Security Weakness.
How can I check npm dependencies for GHSA-3qmc-2r76-4rqp?
Run the dependency tree command: 'npm ls @redwoodjs/api'. 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-3qmc-2r76-4rqp",
  "modified" : "2022-11-10T15:51:01Z",
  "published" : "2022-11-10T15:51:01Z",
  "aliases" : [ ],
  "summary" : "Redwood is vulnerable to account takeover via dbAuth \"forgot-password\" ",
  "details" : "# Impact\n\n_What kind of vulnerability is it? Who is impacted?_\n\nThis is an API vulnerability in Redwood's [dbAuth], specifically the dbAuth forgot password feature:\n- only projects with the dbAuth \"forgot password\" feature are affected\n- this vulnerability was introduced in v0.38.0\n\n## User Accounts are Vulnerable to Takeover (Hijacking)\n\nA reset token for any user can be obtained given knowledge of their username or email via the forgot-password API. With the leaked reset token, a malicious user could request to reset a user's password, changing their credentials and gaining access to their account.\n\n## How to Determine if Projects have been Attacked\n\nTo determine if a project has been attacked, we recommend checking logs for suspicious activity; namely, the volume of requests to the forgot-password API using emails that don't exist. Another indication is if users inform you that they can't access their accounts.\n\nIf you have question or concerns, reach out via the \"For More Information\" section below.\n\n# Patch Releases Available\n\n**The problem has been patched on the v3 and v2 release lines.** Users should upgrade to **v3.3.1+**  or **v2.2.5+** respectively.\n\n## Workarounds\n\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nWe recommend upgrading to the Patch Releases above. If upgrading is not possible, there are several workarounds:\n\n### Manually strip out `resetToken` and `resetTokenExpiresAt` in the `forgotPassword.handler()`\n\nUsers on all release lines can have their `forgotPassword.handler()` function strip out the sensitive fields manually before returning\n\n```js\nhandler: (user) => {\n  // your code to notify/email user of the link to reset their password...\n\n  const = { resetToken, resetTokenExpiresAt, ...rest }\n\n  return rest\n}\n```\n\n### Use `yarn patch` to manually apply the fix\n\nUsers on v3 and v2 can use [`yarn patch`] to apply the fix if they're using yarn v3. See the dbAuth \"forgot-password\" Account Takeover Vulnerability high gist for instructions. \n\n### Disable the forgot password flow entirely v3 only\n\nUsers on v3 can disable the forgot password flow entirely.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@redwoodjs/api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.38.0"
      }, {
        "fixed" : "2.2.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@redwoodjs/api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/redwoodjs/redwood/security/advisories/GHSA-3qmc-2r76-4rqp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redwoodjs/redwood/issues/6343"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redwoodjs/redwood/pull/6778"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/redwoodjs/redwood"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redwoodjs/redwood/releases/tag/v2.2.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redwoodjs/redwood/releases/tag/v3.3.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-10T15:51:01Z",
    "nvd_published_at" : null
  }
}