CVE-2022-31099: Rulex Uncontrolled Recursion Vulnerability

MODERATE
Advisory Identifier: GHSA-v78m-2q7v-fjqp
CVSS 6.5
CWE-674
Published
Advisory Summary

CVE-2022-31099 is a MODERATE (CVSS 6.5) uncontrolled recursion vulnerability (CWE-674: Uncontrolled Recursion) affecting Rulex libraries in the crates.io ecosystem. The issue involves uncontrolled recursion in rulex. Remediation is available by upgrading affected packages to version 0.4.3.

CVE-2022-31099 at a Glance

CVE Identifier CVE-2022-31099
GHSA Identifier GHSA-v78m-2q7v-fjqp
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product Rulex
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.5

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:N/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 None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-31099

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

rulex fixed: 0.4.3
Upgrade rulex to 0.4.3
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 rulex

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-31099, inspect your project dependencies for Rulex:

inspect dependencies for rulex

Analyze the terminal output to locate any version of Rulex in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.3), 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. In Rulex, 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 When parsing untrusted rulex expressions, the stack may overflow, possibly enabling a Denial of Service attack. This happens when parsing an expression with several hundred levels of nesting, causing the process to abort immediately. This is a security concern for you, if - your service parses untrusted rulex expressions (expressions provided by an untrusted user), and - your service becomes unavailable when the process running rulex aborts due to a stack overflow. ### Patches The crash is fixed in version **0.4.3**. Affected users are advised to update to this version. ### Workarounds None. ### For more information If you have any questions or comments about this advisory: * Open an issue in [rulex](https://github.com/rulex-rs/rulex/issues) * Email me at [ludwig.stecher@gmx.de](mailto:ludwig.stecher@gmx.de) ### Credits Credit for finding these bugs goes to - [evanrichter](https://github.com/evanrichter) - [ForAllSecure Mayhem](https://forallsecure.com/) - [cargo fuzz](https://github.com/rust-fuzz/cargo-fuzz) and [afl.rs](https://github.com/rust-fuzz/afl.rs)

CVE-2022-31099 Affected Rulex Versions

1 component(s)
Fixed Versions:
0.4.3
Product / Package Ecosystem Affected Versions Fixed Version
rulex
crates.io
< 0.4.3
0.4.3

References

Frequently Asked Questions

What is CVE-2022-31099?
CVE-2022-31099 is a security vulnerability in Rulex involving Uncontrolled Recursion in rulex under CWE-674: Uncontrolled Recursion.
Which Rulex versions are affected?
Affected versions include releases prior to 0.4.3 across affected packages: rulex.
What version fixes CVE-2022-31099?
Upgrading to 0.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rulex affected?
Yes, rulex is affected in releases prior to 0.4.3. Upgrade your dependency to 0.4.3 or later.
What is the CVSS score of CVE-2022-31099?
CVE-2022-31099 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-31099?
CVE-2022-31099 is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check crates.io dependencies for CVE-2022-31099?
Run the dependency tree command: 'inspect dependencies for rulex'. 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-v78m-2q7v-fjqp",
  "modified" : "2022-07-12T21:59:11Z",
  "published" : "2022-06-22T17:52:51Z",
  "aliases" : [ "CVE-2022-31099" ],
  "summary" : "Uncontrolled Recursion in rulex",
  "details" : "### Impact\nWhen parsing untrusted rulex expressions, the stack may overflow, possibly enabling a Denial of Service attack. This happens when parsing an expression with several hundred levels of nesting, causing the process to abort immediately.\n\nThis is a security concern for you, if\n- your service parses untrusted rulex expressions (expressions provided by an untrusted user), and\n- your service becomes unavailable when the process running rulex aborts due to a stack overflow.\n\n### Patches\nThe crash is fixed in version **0.4.3**. Affected users are advised to update to this version.\n\n### Workarounds\nNone.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [rulex](https://github.com/rulex-rs/rulex/issues)\n* Email me at [ludwig.stecher@gmx.de](mailto:ludwig.stecher@gmx.de)\n\n### Credits\n\nCredit for finding these bugs goes to\n\n- [evanrichter](https://github.com/evanrichter)\n- [ForAllSecure Mayhem](https://forallsecure.com/)\n- [cargo fuzz](https://github.com/rust-fuzz/cargo-fuzz) and [afl.rs](https://github.com/rust-fuzz/afl.rs)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "rulex"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rulex-rs/rulex/security/advisories/GHSA-v78m-2q7v-fjqp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31099"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rulex-rs/rulex/commit/60aa2dc03a22d69c8800fec81f99c96958a11363"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rulex-rs/rulex"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0030.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-22T17:52:51Z",
    "nvd_published_at" : "2022-06-27T23:15:00Z"
  }
}