CVE-2024-37031: Activeadmin Cross-Site Scripting Vulnerability
HIGHCVE-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
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).
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.
Upgrade activeadmin to 3.2.2
Upgrade activeadmin to 4.0.0.beta7
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
CVE-2024-37031 Affected Activeadmin Versions
2 component(s)| 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?
Which Activeadmin versions are affected?
What version fixes CVE-2024-37031?
Is activeadmin affected?
What is the CVSS score of CVE-2024-37031?
What CWE is associated with CVE-2024-37031?
How can I check RubyGems dependencies for CVE-2024-37031?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}