CVE-2021-27293: RestSharp Incorrect Regular Expression Vulnerability

HIGH
Advisory Identifier: GHSA-9pq7-rcxv-47vq
CVSS 7.5
CWE-185 CWE-697
Published
Advisory Summary

CVE-2021-27293 is a HIGH (CVSS 7.5) incorrect regular expression vulnerability (CWE-185: Incorrect Regular Expression) affecting RestSharp libraries in the NuGet ecosystem. The issue involves incorrect regular expression in restsharp. Remediation is available by upgrading affected packages to version 106.11.8-alpha.0.13.

CVE-2021-27293 at a Glance

CVE Identifier CVE-2021-27293
GHSA Identifier GHSA-9pq7-rcxv-47vq
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-185: Incorrect Regular Expression
Affected Product RestSharp
Package Ecosystem NuGet
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-27293

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

RestSharp fixed: 106.11.8-alpha.0.13
Upgrade RestSharp to 106.11.8-alpha.0.13
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for RestSharp

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-27293, inspect your project dependencies for RestSharp:

inspect dependencies for RestSharp

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-185: Incorrect Regular Expression, where the product specifies a regular expression in a way that causes data to be improperly matched or compared. In RestSharp, 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

RestSharp < 106.11.8-alpha.0.13 uses a regular expression which is vulnerable to Regular Expression Denial of Service (ReDoS) when converting strings into DateTimes. If a server responds with a malicious string, the client using RestSharp will be stuck processing it for an exceedingly long time. Thus the remote server can trigger Denial of Service.

CVE-2021-27293 Affected RestSharp Versions

1 component(s)
Fixed Versions:
106.11.8-alpha.0.13
Product / Package Ecosystem Affected Versions Fixed Version
RestSharp
NuGet
< 106.11.8-alpha.0.13
106.11.8-alpha.0.13

References

Frequently Asked Questions

What is CVE-2021-27293?
CVE-2021-27293 is a security vulnerability in RestSharp involving Incorrect Regular Expression in RestSharp under CWE-185: Incorrect Regular Expression.
Which RestSharp versions are affected?
Affected versions include releases prior to 106.11.8-alpha.0.13 across affected packages: RestSharp.
What version fixes CVE-2021-27293?
Upgrading to 106.11.8-alpha.0.13 (or the latest patched release for your respective branch) resolves the vulnerability.
Is RestSharp affected?
Yes, RestSharp is affected in releases prior to 106.11.8-alpha.0.13. Upgrade your dependency to 106.11.8-alpha.0.13 or later.
What is the CVSS score of CVE-2021-27293?
CVE-2021-27293 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-27293?
CVE-2021-27293 is classified under CWE-185: Incorrect Regular Expression (The product specifies a regular expression in a way that causes data to be improperly matched or compared.).
How can I check NuGet dependencies for CVE-2021-27293?
Run the dependency tree command: 'inspect dependencies for RestSharp'. 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-9pq7-rcxv-47vq",
  "modified" : "2021-07-15T20:24:43Z",
  "published" : "2021-07-14T19:10:01Z",
  "aliases" : [ "CVE-2021-27293" ],
  "summary" : "Incorrect Regular Expression in RestSharp",
  "details" : "RestSharp < 106.11.8-alpha.0.13 uses a regular expression which is vulnerable to Regular Expression Denial of Service (ReDoS) when converting strings into DateTimes. If a server responds with a malicious string, the client using RestSharp will be stuck processing it for an exceedingly long time. Thus the remote server can trigger Denial of Service.",
  "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" : "NuGet",
      "name" : "RestSharp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "106.11.8-alpha.0.13"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 106.11.7"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-27293"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/restsharp/RestSharp/issues/1556"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/restsharp/RestSharp/commit/be39346784b68048b230790d15333574341143bc"
  }, {
    "type" : "WEB",
    "url" : "https://restsharp.dev"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-185", "CWE-697" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-07-13T21:24:43Z",
    "nvd_published_at" : "2021-07-12T11:15:00Z"
  }
}