CVE-2017-18924: Oauth2 server Code Injection Vulnerability

HIGH
Advisory Identifier: GHSA-2fw4-mgq9-39cx
CVSS 7.5
CWE-94
Published
Advisory Summary

CVE-2017-18924 is a HIGH (CVSS 7.5) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Oauth2 server libraries in the npm ecosystem. The issue involves code injection in oauth2-server. Remediation is available in the latest vendor maintenance releases.

CVE-2017-18924 at a Glance

CVE Identifier CVE-2017-18924
GHSA Identifier GHSA-2fw4-mgq9-39cx
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Oauth2 server
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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 None (A:N)

How to Fix CVE-2017-18924

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

oauth2-server fixed: Latest secure release
npm install oauth2-server@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 oauth2-server

How to Check if You Are Affected

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

npm ls oauth2-server

Analyze the terminal output to locate any version of Oauth2 server 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 oauth2-server 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Oauth2 server, 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

"oauth2-server (aka node-oauth2-server) through 3.1.1 implements OAuth 2.0 without PKCE. It does not prevent authorization code injection. This is similar to CVE-2020-7692. NOTE: the vendor states 'As RFC7636 is an extension, I think the claim in the Readme of "RFC 6749 compliant" is valid and not misleading and I also therefore wouldn't describe this as a "vulnerability" with the library per se.'"

CVE-2017-18924 Affected Oauth2 server Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
oauth2-server
npm
≤ 3.1.1

References

Frequently Asked Questions

What is CVE-2017-18924?
CVE-2017-18924 is a security vulnerability in Oauth2 server involving Code Injection in oauth2-server under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Oauth2 server versions are affected?
Affected versions include releases prior to current release patches across affected packages: oauth2-server.
What version fixes CVE-2017-18924?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is oauth2-server affected?
Yes, oauth2-server 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-2017-18924?
CVE-2017-18924 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2017-18924?
CVE-2017-18924 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2017-18924?
Run the dependency tree command: 'npm ls oauth2-server'. 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-2fw4-mgq9-39cx",
  "modified" : "2021-04-21T21:15:38Z",
  "published" : "2021-04-22T15:53:45Z",
  "aliases" : [ "CVE-2017-18924" ],
  "summary" : "Code Injection in oauth2-server",
  "details" : "\"oauth2-server (aka node-oauth2-server) through 3.1.1 implements OAuth 2.0 without PKCE. It does not prevent authorization code injection. This is similar to CVE-2020-7692. NOTE: the vendor states 'As RFC7636 is an extension, I think the claim in the Readme of \"RFC 6749 compliant\" is valid and not misleading and I also therefore wouldn't describe this as a \"vulnerability\" with the library per se.'\"",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "oauth2-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "3.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-18924"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauthjs/node-oauth2-server/issues/637"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauthjs/node-oauth2-server/pull/452"
  }, {
    "type" : "WEB",
    "url" : "https://codeburst.io/missing-the-point-in-securing-oauth-2-0-83968708b467"
  }, {
    "type" : "WEB",
    "url" : "https://tools.ietf.org/html/draft-ietf-oauth-security-topics-15"
  }, {
    "type" : "WEB",
    "url" : "https://tools.ietf.org/html/rfc7636"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-21T21:15:38Z",
    "nvd_published_at" : "2020-10-04T05:15:00Z"
  }
}