Vulnerabilities in pkg:npm/uap-core

PACKAGE
Advisory Identifier: GHSA-cmcx-xhr8-3w9p
Advisory Summary

CVE-2020-5243 is a MODERATE (CVSS 5.7) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Uap core libraries in the npm ecosystem. The issue involves denial of service in uap-core when processing crafted user-agent strings. Remediation is available by upgrading affected packages to version 0.7.3, 2.6.0.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/uap-core

3 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-cmcx-xhr8-3w9p CVE-2020-5243 MODERATE Denial of Service in uap-core when processing crafted User-Agent strings
GHSA-p4pj-mg4r-x6v4 CVE-2021-21317 HIGH Denial of Service in uap-core
GHSA-fx7m-j728-mjw3 CVE-2018-20164 MODERATE uap-core Regular Expression Denial of Service issue

CVE-2020-5243 at a Glance

CVE Identifier CVE-2020-5243
GHSA Identifier GHSA-cmcx-xhr8-3w9p
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Uap core
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H).

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

How to Fix CVE-2020-5243

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

uap-core fixed: 0.7.3
npm install uap-core@0.7.3
user_agent_parser fixed: 2.6.0
Upgrade user_agent_parser to 2.6.0
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 uap-core

How to Check if You Are Affected

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

npm ls uap-core

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

Note: The npm ls uap-core 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 Uap core, 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 Some regexes are vulnerable to regular expression denial of service (REDoS) due to overlapping capture groups. This allows remote attackers to overload a server by setting the User-Agent header in an HTTP(S) request to maliciously crafted long strings. ### Patches Please update uap-core to >= v0.7.3 Downstream packages such as uap-python, uap-ruby etc which depend upon uap-core follow different version schemes. ### Details Each vulnerable regular expression reported here contains 3 overlapping capture groups. Backtracking has approximately cubic time complexity with respect to the length of the user-agent string. #### Regex 1: ``` \bSmartWatch *\( *([^;]+) *; *([^;]+) *; ``` is vulnerable in portion ` *([^;]+) *` and can be attacked with ```python "SmartWatch(" + (" " * 3500) + "z" ``` e.g. ``` SmartWatch( z ``` #### Regex 2: ``` ; *([^;/]+) Build[/ ]Huawei(MT1-U06|[A-Z]+\d+[^\);]+)[^\);]*\) ``` is vulnerable in portion `\d+[^\);]+[^\);]*` and can be attacked with ```python ";A Build HuaweiA" + ("4" * 3500) + "z" ``` #### Regex 3: ``` (HbbTV)/[0-9]+\.[0-9]+\.[0-9]+ \([^;]*; *(LG)E *; *([^;]*) *;[^;]*;[^;]*;\) ``` is vulnerable in portion ` *([^;]*) *` and can be attacked with ```python "HbbTV/0.0.0 (;LGE;" + (" " * 3500) + "z" ``` #### Regex 4: ``` (HbbTV)/[0-9]+\.[0-9]+\.[0-9]+ \([^;]*; *(?:CUS:([^;]*)|([^;]+)) *; *([^;]*) *;.*; ``` is vulnerable in portions ` *(?:CUS:([^;]*)|([^;]+)) *` and ` *([^;]*) *` and can be attacked with ```python "HbbTV/0.0.0 (;CUS:;" + (" " * 3500) + "z" "HbbTV/0.0.0 (;" + (" " * 3500) + "z" "HbbTV/0.0.0 (;z;" + (" " * 3500) + "z" ``` Reported by Ben Caller @bcaller

CVE-2020-5243 Affected Uap core Versions

2 component(s)
Fixed Versions:
0.7.32.6.0
Product / Package Ecosystem Affected Versions Fixed Version
uap-core
npm
< 0.7.3
0.7.3
user_agent_parser
RubyGems
< 2.6.0
2.6.0

References

Frequently Asked Questions

What is CVE-2020-5243?
CVE-2020-5243 is a security vulnerability in Uap core involving Denial of Service in uap-core when processing crafted User-Agent strings under CWE-1333: Inefficient Regular Expression Complexity.
Which Uap core versions are affected?
Affected versions include releases prior to 0.7.3, 2.6.0 across affected packages: uap-core, user_agent_parser.
What version fixes CVE-2020-5243?
Upgrading to 0.7.3, 2.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is uap-core affected?
Yes, uap-core is affected in releases prior to 0.7.3. Upgrade your dependency to 0.7.3 or later.
Is user_agent_parser affected?
Yes, user_agent_parser is affected in releases prior to 2.6.0. Upgrade your dependency to 2.6.0 or later.
What is the CVSS score of CVE-2020-5243?
CVE-2020-5243 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2020-5243?
CVE-2020-5243 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-2020-5243?
Run the dependency tree command: 'npm ls uap-core'. 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-cmcx-xhr8-3w9p",
  "modified" : "2024-02-08T22:49:51Z",
  "published" : "2020-02-20T23:26:10Z",
  "aliases" : [ "CVE-2020-5243" ],
  "summary" : "Denial of Service in uap-core when processing crafted User-Agent strings",
  "details" : "### Impact\n\nSome regexes are vulnerable to regular expression denial of service (REDoS) due to overlapping capture groups. This allows remote attackers to overload a server by setting the User-Agent header in an HTTP(S) request to maliciously crafted long strings.\n\n### Patches\n\nPlease update uap-core to &amp;amp;gt;= v0.7.3\n\nDownstream packages such as uap-python, uap-ruby etc which depend upon uap-core follow different version schemes.\n\n### Details\n\nEach vulnerable regular expression reported here contains 3 overlapping capture groups. Backtracking has approximately cubic time complexity with respect to the length of the user-agent string.\n\n#### Regex 1:\n\n```\n\\bSmartWatch *\\( *([^;]+) *; *([^;]+) *;\n```\n\nis vulnerable in portion ` *([^;]+) *` and can be attacked with\n\n```python\n&amp;amp;quot;SmartWatch(&amp;amp;quot; + (&amp;amp;quot; &amp;amp;quot; * 3500) + &amp;amp;quot;z&amp;amp;quot;\n```\ne.g.\n```\nSmartWatch(                                   z\n```\n\n\n#### Regex 2:\n\n```\n; *([^;/]+) Build[/ ]Huawei(MT1-U06|[A-Z]+\\d+[^\\);]+)[^\\);]*\\)\n```\n\nis vulnerable in portion `\\d+[^\\);]+[^\\);]*` and can be attacked with\n\n```python\n&amp;amp;quot;;A Build HuaweiA&amp;amp;quot; + (&amp;amp;quot;4&amp;amp;quot; * 3500) + &amp;amp;quot;z&amp;amp;quot;\n```\n\n\n#### Regex 3:\n\n```\n(HbbTV)/[0-9]+\\.[0-9]+\\.[0-9]+ \\([^;]*; *(LG)E *; *([^;]*) *;[^;]*;[^;]*;\\)\n```\n\nis vulnerable in portion ` *([^;]*) *` and can be attacked with\n\n```python\n&amp;amp;quot;HbbTV/0.0.0 (;LGE;&amp;amp;quot; + (&amp;amp;quot; &amp;amp;quot; * 3500) + &amp;amp;quot;z&amp;amp;quot;\n```\n\n#### Regex 4:\n\n```\n(HbbTV)/[0-9]+\\.[0-9]+\\.[0-9]+ \\([^;]*; *(?:CUS:([^;]*)|([^;]+)) *; *([^;]*) *;.*;\n```\n\nis vulnerable in portions ` *(?:CUS:([^;]*)|([^;]+)) *` and ` *([^;]*) *` and can be attacked with\n\n```python\n&amp;amp;quot;HbbTV/0.0.0 (;CUS:;&amp;amp;quot; + (&amp;amp;quot; &amp;amp;quot; * 3500) + &amp;amp;quot;z&amp;amp;quot;\n&amp;amp;quot;HbbTV/0.0.0 (;&amp;amp;quot; + (&amp;amp;quot; &amp;amp;quot; * 3500) + &amp;amp;quot;z&amp;amp;quot;\n&amp;amp;quot;HbbTV/0.0.0 (;z;&amp;amp;quot; + (&amp;amp;quot; &amp;amp;quot; * 3500) + &amp;amp;quot;z&amp;amp;quot;\n```\n\nReported by Ben Caller @bcaller",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "uap-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "user_agent_parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ua-parser/uap-core/security/advisories/GHSA-cmcx-xhr8-3w9p"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ua-parser/uap-ruby/security/advisories/GHSA-pcqq-5962-hvcw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5243"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ua-parser/uap-core/commit/0afd61ed85396a3b5316f18bfd1edfaadf8e88e1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/user_agent_parser/CVE-2020-5243.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-02-20T23:09:32Z",
    "nvd_published_at" : "2020-02-21T00:15:10Z"
  }
}