CVE-2023-34102: Avo Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-86h2-2g4g-29qx
CVSS 8.3
CWE-470 CWE-20
Published
Advisory Summary

CVE-2023-34102 is a HIGH (CVSS 8.3) denial of service vulnerability (CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')) affecting Avo libraries in the RubyGems ecosystem. The issue involves avo possible unsafe reflection / partial dos vulnerability. Remediation is available by upgrading affected packages to version 2.33.3.

CVE-2023-34102 at a Glance

CVE Identifier CVE-2023-34102
GHSA Identifier GHSA-86h2-2g4g-29qx
Severity HIGH
CVSS v3.1 Base Score 8.3
CWE Classification CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
Affected Product Avo
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 8.3

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:L/I:H/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 Low (C:L)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2023-34102

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

avo fixed: 2.33.3
Upgrade avo to 2.33.3
avo fixed: Latest secure release
Upgrade avo to Latest secure release
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 avo

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-34102, inspect your project dependencies for Avo:

inspect dependencies for avo

Analyze the terminal output to locate any version of Avo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.33.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-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection'), where the product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code. In Avo, 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

### Summary The polymorphic field type stores the classes to operate on when updating a record with user input, and does not validate them in the back end. This can lead to unexpected behavior, remote code execution, or application crashes when viewing a manipulated record. ### Details After reviewing the polymorphic field implementation and performing some black box approaches, we identified a potential security issue related to the use of safe_constantize / constantize. This Rails functionality is capable of searching for classes within the Rails context and returning the class for further use. Because Avo does not validate user input when updating or creating a new polymorphic resource, it is possible to create database entries with completely different or invalid class names than the preselected ones. Avo assumes that the class specified by the user request is a valid one and attempts to work with it, which may result in dangerous behavior and code execution. ### PoC ![image](https://user-images.githubusercontent.com/26464774/243437854-933d94c8-4ae0-43fe-b2da-35b103e28796.png) _In the test scenario we choose the demo app and the review resource which has a polymorphic reviewable field._ ![image](https://user-images.githubusercontent.com/26464774/243437954-2d947c6d-4e97-4e91-a442-405e553dd047.png) _Intercepting the request and switching the review[reviewable_type] from “Fish” to “File” which is a real class inside Rails_ ![image](https://user-images.githubusercontent.com/26464774/243438031-109de6d0-9370-4318-b18e-c5bcea61cf54.png) _Corrupting the database with unusable classes will cause a crash at the application while viewing the new record or the index view (partial DoS)_ ![image](https://user-images.githubusercontent.com/26464774/243438104-80df5aae-86de-40fc-870d-689a03cae389.png) _Manual delete the corrupted resource in order to recover the applications functionality_ ![image](https://user-images.githubusercontent.com/26464774/243438182-1e7eef54-73ba-47d0-b5df-4bad14859af3.png) _Of course it is possible to use other class names or namespaces. The local development environment displays the backend error message when visiting a corrupted record. Avo is trying to apply a scope to this class that does not exist._ ![image](https://user-images.githubusercontent.com/26464774/243438257-dbb59153-58a8-4421-b796-f2a0f2c20083.png) _Specifying an invalid class name in the parameter will cause the application to crash again while trying constanize the provided string_ ### Impact The final exploitation of this vulnerability requires more time than is provided in this assessment, but initial testing of the post request shows the potential critical risk. The classes could be instantiated at any point in the code and this could also lead to code execution. ### Recommendation Avo should be configured to never trust user-supplied input, especially when defining classes for records. In this particular case, Avo can evaluate the options list given for the polymorphic field and only allow strings from that list. With this white-list approach, an attacker cannot supply unintended classes.

CVE-2023-34102 Affected Avo Versions

2 component(s)
Fixed Versions:
2.33.3
Product / Package Ecosystem Affected Versions Fixed Version
avo
RubyGems
< 2.33.3
2.33.3
avo
RubyGems
≥ 3.0.0.pre1
≤ 3.0.0.pre12

References

Frequently Asked Questions

What is CVE-2023-34102?
CVE-2023-34102 is a security vulnerability in Avo involving avo possible unsafe reflection / partial DoS vulnerability under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection').
Which Avo versions are affected?
Affected versions include releases prior to 2.33.3 across affected packages: avo.
What version fixes CVE-2023-34102?
Upgrading to 2.33.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is avo affected?
Yes, avo is affected in releases prior to 2.33.3, Latest secure release. Upgrade your dependency to 2.33.3, Latest secure release or later.
What is the CVSS score of CVE-2023-34102?
CVE-2023-34102 has a CVSS v3.1 base score of 8.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:H.
What CWE is associated with CVE-2023-34102?
CVE-2023-34102 is classified under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') (The product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.).
How can I check RubyGems dependencies for CVE-2023-34102?
Run the dependency tree command: 'inspect dependencies for avo'. 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-86h2-2g4g-29qx",
  "modified" : "2024-06-25T16:56:30Z",
  "published" : "2023-06-06T16:46:57Z",
  "aliases" : [ "CVE-2023-34102" ],
  "summary" : "avo possible unsafe reflection / partial DoS vulnerability",
  "details" : "### Summary\nThe polymorphic field type stores the classes to operate on when updating a record with user input, and does not validate them in the back end. This can lead to unexpected behavior, remote code execution, or application crashes when viewing a manipulated record. \n\n### Details\nAfter reviewing the polymorphic field implementation and performing some black box approaches, we identified a potential security issue related to the use of safe_constantize / constantize. This Rails functionality is capable of searching for classes within the Rails context and returning the class for further use. Because Avo does not validate user input when updating or creating a new polymorphic resource, it is possible to create database entries with completely different or invalid class names than the preselected ones. Avo assumes that the class specified by the user request is a valid one and attempts to work with it, which may result in dangerous behavior and code execution.\n\n### PoC\n![image](https://user-images.githubusercontent.com/26464774/243437854-933d94c8-4ae0-43fe-b2da-35b103e28796.png)\n_In the test scenario we choose the demo app and the review resource which has a polymorphic reviewable field._\n\n![image](https://user-images.githubusercontent.com/26464774/243437954-2d947c6d-4e97-4e91-a442-405e553dd047.png)\n_Intercepting the request and switching the review[reviewable_type] from “Fish” to “File” which is a real class inside Rails_\n\n![image](https://user-images.githubusercontent.com/26464774/243438031-109de6d0-9370-4318-b18e-c5bcea61cf54.png)\n_Corrupting the database with unusable classes will cause a crash at the application while viewing the new record or the index view (partial DoS)_\n\n![image](https://user-images.githubusercontent.com/26464774/243438104-80df5aae-86de-40fc-870d-689a03cae389.png)\n_Manual delete the corrupted resource in order to recover the applications functionality_\n\n![image](https://user-images.githubusercontent.com/26464774/243438182-1e7eef54-73ba-47d0-b5df-4bad14859af3.png)\n_Of course it is possible to use other class names or namespaces. The local development environment displays the backend error message when visiting a corrupted record. Avo is trying to apply a scope to this class that does not exist._\n\n![image](https://user-images.githubusercontent.com/26464774/243438257-dbb59153-58a8-4421-b796-f2a0f2c20083.png)\n_Specifying an invalid class name in the parameter will cause the application to crash again while trying constanize the provided string_\n\n### Impact\nThe final exploitation of this vulnerability requires more time than is provided in this assessment, but initial testing of the post request shows the potential critical risk. The classes could be instantiated at any point in the code and this could also lead to code execution.\n\n### Recommendation\nAvo should be configured to never trust user-supplied input, especially when defining classes for records. In this particular case, Avo can evaluate the options list given for the polymorphic field and only allow strings from that list. With this white-list approach, an attacker cannot supply unintended classes.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "avo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.33.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.33.2"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "avo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0.pre1"
      }, {
        "last_affected" : "3.0.0.pre12"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/avo-hq/avo/security/advisories/GHSA-86h2-2g4g-29qx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-34102"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/avo-hq/avo/commit/ec117882ddb1b519481bdd046dc3cfa4474e6e17"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/avo-hq/avo"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/avo-hq/avo/releases/tag/v2.33.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/avo/CVE-2023-34102.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-470" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-06T16:46:57Z",
    "nvd_published_at" : "2023-06-05T23:15:12Z"
  }
}