CVE-2024-37031: Activeadmin Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-9mg6-x45v-hcfm
CVSS 7.2
CWE-79
Published
Advisory Summary

CVE-2024-37031 is a HIGH (CVSS 7.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Activeadmin libraries in the RubyGems ecosystem. The issue involves activeadmin vulnerable to stored persistent cross-site scripting (xss) in dynamic form legends. Remediation is available by upgrading affected packages to version 3.2.2, 4.0.0.beta7.

CVE-2024-37031 at a Glance

CVE Identifier CVE-2024-37031
GHSA Identifier GHSA-9mg6-x45v-hcfm
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Activeadmin
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 7.2

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:C/C:L/I:L/A:N).

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

How to Fix CVE-2024-37031

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

activeadmin fixed: 3.2.2
Upgrade activeadmin to 3.2.2
activeadmin fixed: 4.0.0.beta7
Upgrade activeadmin to 4.0.0.beta7
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 activeadmin

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-37031, inspect your project dependencies for Activeadmin:

inspect dependencies for activeadmin

Analyze the terminal output to locate any version of Activeadmin in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.2), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Activeadmin, 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 Users settings their active admin form legends dynamically may be vulnerable to stored XSS, as long as its value can be injected directly by a malicious user. For example: * A public web application allows users to create entities with arbitrary names. * Active Admin is used to administrate these entities through a private backend. * The form to edit these entities in the private backend has the following shape (note the dynamic `name` value dependent on an attribute of the `resource`): ```ruby form do |f| f.inputs name: resource.name do f.input :name f.input :description end f.actions end ``` Then a malicious user could create an entity with a payload that would get executed in the active admin administrator's browser. Both `form` blocks with an implicit or explicit name (i.e., both `form resource.name` or `form name: resource.name` would suffer from the problem), where the value of the name can be arbitrarily set by non admin users. ### Patches The problem has been fixed in ActiveAdmin 3.2.2 and ActiveAdmin 4.0.0.beta7. ### Workarounds Users can workaround this problem without upgrading by explicitly escaping the form name using an HTML escaping utility. For example: ```ruby form do |f| f.inputs name: ERB::Util.html_escape(resource.name) do f.input :name f.input :description end f.actions end ``` Upgrading is of course recommended though. ### References https://owasp.org/www-community/attacks/xss/#stored-xss-attacks

CVE-2024-37031 Affected Activeadmin Versions

2 component(s)
Fixed Versions:
3.2.24.0.0.beta7
Product / Package Ecosystem Affected Versions Fixed Version
activeadmin
RubyGems
< 3.2.2
3.2.2
activeadmin
RubyGems
≥ 4.0.0.beta1
< 4.0.0.beta7
4.0.0.beta7

References

Frequently Asked Questions

What is CVE-2024-37031?
CVE-2024-37031 is a security vulnerability in Activeadmin involving activeadmin vulnerable to stored persistent cross-site scripting (XSS) in dynamic form legends under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Activeadmin versions are affected?
Affected versions include releases prior to 3.2.2, 4.0.0.beta7 across affected packages: activeadmin.
What version fixes CVE-2024-37031?
Upgrading to 3.2.2, 4.0.0.beta7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is activeadmin affected?
Yes, activeadmin is affected in releases prior to 3.2.2, 4.0.0.beta7. Upgrade your dependency to 3.2.2, 4.0.0.beta7 or later.
What is the CVSS score of CVE-2024-37031?
CVE-2024-37031 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2024-37031?
CVE-2024-37031 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check RubyGems dependencies for CVE-2024-37031?
Run the dependency tree command: 'inspect dependencies for activeadmin'. 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-9mg6-x45v-hcfm",
  "modified" : "2024-10-28T12:37:00Z",
  "published" : "2024-06-02T22:32:24Z",
  "aliases" : [ "CVE-2024-37031" ],
  "summary" : "activeadmin vulnerable to stored persistent cross-site scripting (XSS) in dynamic form legends",
  "details" : "### Impact\n\nUsers settings their active admin form legends dynamically may be vulnerable to stored XSS, as long as its value can be injected directly by a malicious user.\n\nFor example:\n\n* A public web application allows users to create entities with arbitrary names.\n* Active Admin is used to administrate these entities through a private backend.\n* The form to edit these entities in the private backend has the following shape (note the dynamic `name` value dependent on an attribute of the `resource`):\n\n```ruby\n  form do |f|\n    f.inputs name: resource.name do\n      f.input :name\n      f.input :description\n    end\n\n    f.actions\n  end\n```\n\nThen a malicious user could create an entity with a payload that would get executed in the active admin administrator's browser.\n\nBoth `form` blocks with an implicit or explicit name (i.e., both `form resource.name` or `form name: resource.name` would suffer from the problem), where the value of the name can be arbitrarily set by non admin users.\n\n### Patches\n\nThe problem has been fixed in ActiveAdmin 3.2.2 and ActiveAdmin 4.0.0.beta7.\n\n### Workarounds\n\nUsers can workaround this problem without upgrading by explicitly escaping the form name using an HTML escaping utility. For example:\n\n```ruby\n  form do |f|\n    f.inputs name: ERB::Util.html_escape(resource.name) do\n      f.input :name\n      f.input :description\n    end\n\n    f.actions\n  end\n```\nUpgrading is of course recommended though.\n\n### References\nhttps://owasp.org/www-community/attacks/xss/#stored-xss-attacks",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activeadmin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activeadmin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0.beta1"
      }, {
        "fixed" : "4.0.0.beta7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/activeadmin/activeadmin/security/advisories/GHSA-9mg6-x45v-hcfm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-37031"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/activeadmin/activeadmin/pull/8349"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/activeadmin/activeadmin"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/activeadmin/activeadmin/releases/tag/v3.2.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activeadmin/CVE-2024-37031.yml"
  }, {
    "type" : "WEB",
    "url" : "https://rubygems.org/gems/activeadmin/versions/3.2.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-02T22:32:24Z",
    "nvd_published_at" : "2024-06-03T06:15:10Z"
  }
}