CVE-2021-29474
HedgeDoc File Path Traversal Vulnerability
Description
HedgeDoc (formerly known as CodiMD) is an open-source collaborative markdown editor. An attacker can read arbitrary `.md` files from the server's filesystem due to an improper input validation, which results in the ability to perform a relative path traversal. To verify if you are affected, you can try to open the following URL: `http://localhost:3000/..%2F..%2FREADME#` (replace `http://localhost:3000` with your instance's base-URL e.g. `https://demo.hedgedoc.org/..%2F..%2FREADME#`). If you see a README page being rendered, you run an affected version. The attack works due the fact that the internal router passes the url-encoded alias to the `noteController.showNote`-function. This function passes the input directly to findNote() utility function, that will pass it on the the parseNoteId()-function, that tries to make sense out of the noteId/alias and check if a note already exists and if so, if a corresponding file on disk was updated. If no note exists the note creation-function is called, which pass this unvalidated alias, with a `.md` appended, into a path.join()-function which is read from the filesystem in the follow up routine and provides the pre-filled content of the new note. This allows an attacker to not only read arbitrary `.md` files from the filesystem, but also observes changes to them. The usefulness of this attack can be considered limited, since mainly markdown files are use the file-ending `.md` and all markdown files contained in the hedgedoc project, like the README, are public anyway. If other protections such as a chroot or container or proper file permissions are in place, this attack's usefulness is rather limited. On a reverse-proxy level one can force a URL-decode, which will prevent this attack because the router will not accept such a path.
INFO
Published Date :
April 26, 2021, 10:15 p.m.
Last Modified :
Oct. 24, 2022, 6:21 p.m.
Source :
[email protected]
Remotely Exploitable :
Yes !
Impact Score :
1.4
Exploitability Score :
3.9
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2021-29474
.
URL | Resource |
---|---|
https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-p528-555r-pf87 | Exploit Patch Third Party Advisory |
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2021-29474
vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2021-29474
vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
CVE Modified by [email protected]
May. 14, 2024
Action Type Old Value New Value -
Reanalysis by [email protected]
Oct. 24, 2022
Action Type Old Value New Value Added CWE NIST CWE-22 -
Initial Analysis by [email protected]
May. 07, 2021
Action Type Old Value New Value Added CVSS V2 NIST (AV:N/AC:L/Au:N/C:P/I:N/A:N) Added CVSS V3.1 NIST AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N Changed Reference Type https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-p528-555r-pf87 No Types Assigned https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-p528-555r-pf87 Exploit, Patch, Third Party Advisory Added CPE Configuration OR *cpe:2.3:a:hedgedoc:hedgedoc:*:*:*:*:*:*:*:* versions up to (excluding) 1.8.0
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2021-29474
is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2021-29474
weaknesses.
Exploit Prediction
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.
0.13 }} 0.02%
score
0.47733
percentile