avo 1.2.3

4 security vulnerabilities found in version 1.2.3

avo vulnerable to stored cross-site scripting (XSS) in key_value field

high severity CVE-2024-22191
high severity CVE-2024-22191
Patched versions: >= 3.2.4, ~> 2.47, >= 2.47

Summary

A stored cross-site scripting (XSS) vulnerability was found in the key_value field of Avo v3.2.3. This vulnerability could allow an attacker to execute arbitrary JavaScript code in the victim's browser.

Details

The value of the key_value is inserted directly into the HTML code. In the current version of Avo (possibly also older versions), the value is not properly sanitized before it is inserted into the HTML code.

This vulnerability can be exploited by an attacker to inject malicious JavaScript code into the key_value field. When a victim views the page containing the malicious code, the code will be executed in their browser.

In avo/fields/common/key_value_component.html.erb the value is taken in lines 38 and 49 and seems to be interpreted directly as html in lines 44 and 55.

PoC

POC

To reproduce the vulnerability, follow these steps:

  1. Edit an entry with a key_value field.

  2. Enter the following payload into the value field: POC\\\"> <script>alert('XSS in key_value' );</script> <strong>Outside-tag</strong

  3. Save the entry.

  4. Go to the index page and click on the eye icon next to the entry.

The malicious JavaScript code will be executed and an alert box will be displayed.

On the show and edit page the alert seems not to pop up, but the strong tag breaks out of the expected html tag

Impact

This vulnerability could be used to steal sensitive information from victims that could be used to hijack victims' accounts or redirect them to malicious websites.

avo vulnerable to Stored XSS (Cross Site Scripting) in html content based fields

high severity CVE-2023-34103
high severity CVE-2023-34103
Patched versions: >= 2.33.3

Summary

Some avo fields are vulnerable to XSS when rendering html based content.

Details

During the analysis of the web application, a rendered field was discovered that did not filter JS / HTML tags in a safe way and can be abused to execute js code on a client side. The trix field uses the trix editor in the backend to edit rich text data which basically operates with html tags. To display the stored data in a rendered view, the HasHTMLAttributes concern is used. This can be exploited by an attacker to store javascript code in any trix field by intercepting the request and modifying the post data, as the trix editor does not allow adding custom html or js tags on the frontend.

PoC

image Adding javascript in the post request which is used when editing a "post" resource (body is declared as a trix field) image Successful execution of JS code on live demo environment

Impact

Unlike non-persistent XSS, persistent XSS does not require a social engineering phase. Victims of this attack do not need to be tricked into clicking a link or something like that. However, by exploiting such a vulnerability on this particular target, attackers may be able to gain access to accounts that require special protection, such as administrators of the web service, which is what Avo is primarily intended to be used for.

Recommendation

The content of a field that contains html code should be sanitized using the according rails helper which uses a whitelist of known-safe tags and attributes. Also this security consideration should be applied to the “as_html” attribute as well because it may contain user controlled input as well.

https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html

avo possible unsafe reflection / partial DoS vulnerability

high severity CVE-2023-34102
high severity CVE-2023-34102
Patched versions: >= 2.33.3

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\n_In the test scenario we choose the demo app and the review resource which has a polymorphic reviewable field.image\n_Intercepting the request and switching the review[reviewable_type] from “Fish” to “File” which is a real class inside Railsimage\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\nimage\n_Manual delete the corrupted resource in order to recover the applications functionality\n\nimage\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\nimage\n_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."

Cross-site scripting (XSS) in Action messages on Avo

medium severity CVE-2024-22411
medium severity CVE-2024-22411
Patched versions: >= 3.3.0, ~> 2.47, >= 2.47

Avo is a framework to create admin panels for Ruby on Rails apps. In Avo 3 pre12 any HTML inside text that is passed to error or succeed in an Avo::BaseAction subclass will be rendered directly without sanitization in the toast/notification that appears in the UI on Action completion. A malicious user could exploit this vulnerability to trigger a cross site scripting attack on an unsuspecting user.

This issue has been addressed in the 3.0.2 release of Avo. Users are advised to upgrade.

No officially reported memory leakage issues detected.


This gem version does not have any officially reported memory leaked issues.

No license issues detected.


This gem version has a license in the gemspec.

This gem version is available.


This gem version has not been yanked and is still available for usage.