Vulnerabilities in pkg:npm/hawk

PACKAGE
Advisory Identifier: GHSA-44pw-h2cw-w3vq
Advisory Summary

CVE-2022-29167 is a HIGH (CVSS 7.4) remote code execution vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Hawk libraries in the npm ecosystem. The issue involves uncontrolled resource consumption in hawk. Remediation is available by upgrading affected packages to version 9.0.1.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/hawk

2 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-44pw-h2cw-w3vq CVE-2022-29167 HIGH Uncontrolled Resource Consumption in Hawk
GHSA-jcpv-g9rr-qxrc CVE-2016-2515 HIGH Regular Expression Denial of Service in hawk

CVE-2022-29167 at a Glance

CVE Identifier CVE-2022-29167
GHSA Identifier GHSA-44pw-h2cw-w3vq
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Hawk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.4

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

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

How to Fix CVE-2022-29167

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

hawk fixed: 9.0.1
npm install hawk@9.0.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 hawk

How to Check if You Are Affected

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

npm ls hawk

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

Note: The npm ls hawk 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Hawk, 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

Hawk is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with partial cryptographic verification of the request and response, covering the HTTP method, request URI, host, and optionally the request payload. Hawk used a regular expression to parse `Host` HTTP header (`Hawk.utils.parseHost()`), which was subject to regular expression DoS attack - meaning each added character in the attacker's input increases the computation time exponentially. `parseHost()` was patched in `9.0.1` to use built-in `URL` class to parse hostname instead.`Hawk.authenticate()` accepts `options` argument. If that contains `host` and `port`, those would be used instead of a call to `utils.parseHost()`.

CVE-2022-29167 Affected Hawk Versions

1 component(s)
Fixed Versions:
9.0.1
Product / Package Ecosystem Affected Versions Fixed Version
hawk
npm
< 9.0.1
9.0.1

References

Frequently Asked Questions

What is CVE-2022-29167?
CVE-2022-29167 is a security vulnerability in Hawk involving Uncontrolled Resource Consumption in Hawk under CWE-400: Uncontrolled Resource Consumption.
Which Hawk versions are affected?
Affected versions include releases prior to 9.0.1 across affected packages: hawk.
What version fixes CVE-2022-29167?
Upgrading to 9.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is hawk affected?
Yes, hawk is affected in releases prior to 9.0.1. Upgrade your dependency to 9.0.1 or later.
What is the CVSS score of CVE-2022-29167?
CVE-2022-29167 has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:H.
What CWE is associated with CVE-2022-29167?
CVE-2022-29167 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2022-29167?
Run the dependency tree command: 'npm ls hawk'. 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-44pw-h2cw-w3vq",
  "modified" : "2022-05-23T20:18:14Z",
  "published" : "2022-05-23T20:18:14Z",
  "aliases" : [ "CVE-2022-29167" ],
  "summary" : "Uncontrolled Resource Consumption in Hawk",
  "details" : "Hawk is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with partial cryptographic verification of the request and response, covering the HTTP method, request URI, host, and optionally the request payload. Hawk used a regular expression to parse `Host` HTTP header (`Hawk.utils.parseHost()`), which was subject to regular expression DoS attack - meaning each added character in the attacker's input increases the computation time exponentially. `parseHost()` was patched in `9.0.1` to use built-in `URL` class to parse hostname instead.`Hawk.authenticate()` accepts `options` argument. If that contains `host` and `port`, those would be used instead of a call to `utils.parseHost()`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "hawk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mozilla/hawk/security/advisories/GHSA-44pw-h2cw-w3vq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-29167"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mozilla/hawk/pull/286"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mozilla/hawk/commit/d10d72ca82db967f6c5fcf866ff78e3ca25ce1ab"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mozilla/hawk"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-23T20:18:14Z",
    "nvd_published_at" : "2022-05-05T23:15:00Z"
  }
}