CVE-2021-4305: Robots txt guard Robots-txt-guard Inefficient Regular Expression Complexity Vulnerability

HIGH
Advisory Identifier: GHSA-6g33-8w2q-4hxv
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-2021-4305 is a HIGH (CVSS 7.5) robots-txt-guard inefficient regular expression complexity vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Robots txt guard libraries in the npm ecosystem. The issue involves robots-txt-guard inefficient regular expression complexity vulnerability. Remediation is available by upgrading affected packages to version 1.0.2.

CVE-2021-4305 at a Glance

CVE Identifier CVE-2021-4305
GHSA Identifier GHSA-6g33-8w2q-4hxv
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Robots txt guard
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:N/I:N/A:H).

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 None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2021-4305

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

robots-txt-guard fixed: 1.0.2
npm install robots-txt-guard@1.0.2
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 robots-txt-guard

How to Check if You Are Affected

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

npm ls robots-txt-guard

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

Note: The npm ls robots-txt-guard 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-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Robots txt guard, 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 vulnerability was found in Woorank robots-txt-guard. It has been rated as problematic. Affected by this issue is the function makePathPattern of the file lib/patterns.js. The manipulation of the argument pattern leads to inefficient regular expression complexity. The exploit has been disclosed to the public and may be used. The name of the patch is c03827cd2f9933619c23894ce7c98401ea824020. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217448.

CVE-2021-4305 Affected Robots txt guard Versions

1 component(s)
Fixed Versions:
1.0.2
Product / Package Ecosystem Affected Versions Fixed Version
robots-txt-guard
npm
< 1.0.2
1.0.2

References

Frequently Asked Questions

What is CVE-2021-4305?
CVE-2021-4305 is a security vulnerability in Robots txt guard involving robots-txt-guard Inefficient Regular Expression Complexity vulnerability under CWE-1333: Inefficient Regular Expression Complexity.
Which Robots txt guard versions are affected?
Affected versions include releases prior to 1.0.2 across affected packages: robots-txt-guard.
What version fixes CVE-2021-4305?
Upgrading to 1.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is robots-txt-guard affected?
Yes, robots-txt-guard is affected in releases prior to 1.0.2. Upgrade your dependency to 1.0.2 or later.
What is the CVSS score of CVE-2021-4305?
CVE-2021-4305 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:N/I:N/A:H.
What CWE is associated with CVE-2021-4305?
CVE-2021-4305 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2021-4305?
Run the dependency tree command: 'npm ls robots-txt-guard'. 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-6g33-8w2q-4hxv",
  "modified" : "2023-01-11T23:01:14Z",
  "published" : "2023-01-05T12:30:27Z",
  "aliases" : [ "CVE-2021-4305" ],
  "summary" : "robots-txt-guard Inefficient Regular Expression Complexity vulnerability",
  "details" : "A vulnerability was found in Woorank robots-txt-guard. It has been rated as problematic. Affected by this issue is the function makePathPattern of the file lib/patterns.js. The manipulation of the argument pattern leads to inefficient regular expression complexity. The exploit has been disclosed to the public and may be used. The name of the patch is c03827cd2f9933619c23894ce7c98401ea824020. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217448.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "robots-txt-guard"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4305"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Woorank/robots-txt-guard/pull/4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Woorank/robots-txt-guard/commit/c03827cd2f9933619c23894ce7c98401ea824020"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Woorank/robots-txt-guard"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?ctiid.217448"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.217448"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-01-09T20:04:05Z",
    "nvd_published_at" : "2023-01-05T11:15:00Z"
  }
}