CVE-2021-43840: Path traversal when MessageBus :Diagnostics Is Enabled Vulnerability
MODERATECVE-2021-43840 is a MODERATE (CVSS 4.2) :diagnostics is enabled vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Path traversal when MessageBus libraries in the RubyGems ecosystem. The issue involves :diagnostics is enabled. Remediation is available by upgrading affected packages to version 3.3.7.
CVE-2021-43840 at a Glance
Security Impact
CVSS: 4.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N).
How to Fix CVE-2021-43840
To remediate this vulnerability, upgrade all affected Path traversal when MessageBus 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 message_bus to 3.3.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for message_bus
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-43840, inspect your project dependencies for Path traversal when MessageBus:
inspect dependencies for message_bus
Analyze the terminal output to locate any version of Path traversal when MessageBus in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.3.7), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Path traversal when MessageBus, 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-2021-43840 Affected Path traversal when MessageBus Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
message_bus
|
RubyGems |
< 3.3.7
|
3.3.7
|
References
Frequently Asked Questions
What is CVE-2021-43840?
Which Path traversal when MessageBus versions are affected?
What version fixes CVE-2021-43840?
Is message_bus affected?
What is the CVSS score of CVE-2021-43840?
What CWE is associated with CVE-2021-43840?
How can I check RubyGems dependencies for CVE-2021-43840?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xmgj-5fh3-xjmm",
"modified" : "2021-12-17T19:34:45Z",
"published" : "2021-12-17T19:59:13Z",
"aliases" : [ "CVE-2021-43840" ],
"summary" : "Path traversal when MessageBus::Diagnostics is enabled",
"details" : "### Impact\n\nUsers who deployed message bus with diagnostics features enabled (default off) were vulnerable to a path traversal bug, which could lead to disclosure of secret information on a machine if an unintended user were to gain access to the diagnostic route. The impact is also greater if there is no proxy for your web application as the number of steps up the directories is not bounded. For deployments which uses a proxy, the impact varies. For example, If a request goes through a proxy like Nginx with `merge_slashes` enabled, the number of steps up the directories that can be read is limited to 3 levels. \n\n### Patches\n\nPatched in 3.3.7.\n\n### Workarounds\n\nDisable MessageBus::Diagnostics in production like environments. \n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "message_bus"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.3.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/discourse/message_bus/security/advisories/GHSA-xmgj-5fh3-xjmm"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43840"
}, {
"type" : "WEB",
"url" : "https://github.com/discourse/message_bus/commit/9b6deee01ed474c7e9b5ff65a06bb0447b4db2ba"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/discourse/message_bus"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/message_bus/CVE-2021-43840.yml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-12-17T19:34:45Z",
"nvd_published_at" : "2021-12-17T19:15:00Z"
}
}