CVE-2021-29474 Vulnerability Analysis & Exploit Details

CVE-2021-29474
Vulnerability Scoring

4.7
/10
Medium Risk

The vulnerability CVE-2021-29474 could compromise system integrity but typically requires user interaction to be exploited.

Attack Complexity Details

  • Attack Complexity: Low
    Exploits can be performed without significant complexity or special conditions.
  • Attack Vector: Network
    Vulnerability is exploitable over a network without physical access.
  • Privileges Required: None
    No privileges are required for exploitation.
  • Scope: Changed
    Successful exploitation can impact components beyond the vulnerable component.
  • User Interaction: Required
    User interaction is necessary for successful exploitation.

CVE-2021-29474 Details

Status: Modified

Last updated: 🕕 21 Nov 2024, 06:01 UTC
Originally published on: 🕙 26 Apr 2021, 22:15 UTC

Time between publication and last update: 1304 days

CVSS Release: version 3

CVSS3 Source

security-advisories@github.com

CVSS3 Type

Secondary

CVSS3 Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N

CVE-2021-29474 Vulnerability Summary

CVE-2021-29474: 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.

Assessing the Risk of CVE-2021-29474

Access Complexity Graph

The exploitability of CVE-2021-29474 depends on two key factors: attack complexity (the level of effort required to execute an exploit) and privileges required (the access level an attacker needs).

Exploitability Analysis for CVE-2021-29474

With low attack complexity and no required privileges, CVE-2021-29474 is an easy target for cybercriminals. Organizations should prioritize immediate mitigation measures to prevent unauthorized access and data breaches.

Understanding AC and PR

A lower complexity and fewer privilege requirements make exploitation easier. Security teams should evaluate these aspects to determine the urgency of mitigation strategies, such as patch management and access control policies.

Attack Complexity (AC) measures the difficulty in executing an exploit. A high AC means that specific conditions must be met, making an attack more challenging, while a low AC means the vulnerability can be exploited with minimal effort.

Privileges Required (PR) determine the level of system access necessary for an attack. Vulnerabilities requiring no privileges are more accessible to attackers, whereas high privilege requirements limit exploitation to authorized users with elevated access.

CVSS Score Breakdown Chart

Above is the CVSS Sub-score Breakdown for CVE-2021-29474, illustrating how Base, Impact, and Exploitability factors combine to form the overall severity rating. A higher sub-score typically indicates a more severe or easier-to-exploit vulnerability.

CIA Impact Analysis

Below is the Impact Analysis for CVE-2021-29474, showing how Confidentiality, Integrity, and Availability might be affected if the vulnerability is exploited. Higher values usually signal greater potential damage.

  • Confidentiality: Low
    CVE-2021-29474 could lead to minor leaks of non-critical information without major privacy breaches.
  • Integrity: None
    CVE-2021-29474 poses no threat to data integrity.
  • Availability: None
    CVE-2021-29474 does not impact system availability.

Exploit Prediction Scoring System (EPSS)

The EPSS score estimates the probability that this vulnerability will be exploited in the near future.

EPSS Score: 0.142% (probability of exploit)

EPSS Percentile: 51.33% (lower percentile = lower relative risk)
This vulnerability is less risky than approximately 48.67% of others.

CVE-2021-29474 References

External References

CWE Common Weakness Enumeration

CWE-22

CAPEC Common Attack Pattern Enumeration and Classification

  • Path Traversal CAPEC-126 An adversary uses path manipulation methods to exploit insufficient input validation of a target to obtain access to data that should be not be retrievable by ordinary well-formed requests. A typical variety of this attack involves specifying a path to a desired file together with dot-dot-slash characters, resulting in the file access API or function traversing out of the intended directory structure and into the root file system. By replacing or modifying the expected path information the access function or API retrieves the file desired by the attacker. These attacks either involve the attacker providing a complete path to a targeted file or using control characters (e.g. path separators (/ or \) and/or dots (.)) to reach desired directories or files.
  • Using Slashes and URL Encoding Combined to Bypass Validation Logic CAPEC-64 This attack targets the encoding of the URL combined with the encoding of the slash characters. An attacker can take advantage of the multiple ways of encoding a URL and abuse the interpretation of the URL. A URL may contain special character that need special syntax handling in order to be interpreted. Special characters are represented using a percentage character followed by two digits representing the octet code of the original character (%HEX-CODE). For instance US-ASCII space character would be represented with %20. This is often referred as escaped ending or percent-encoding. Since the server decodes the URL from the requests, it may restrict the access to some URL paths by validating and filtering out the URL requests it received. An attacker will try to craft an URL with a sequence of special characters which once interpreted by the server will be equivalent to a forbidden URL. It can be difficult to protect against this attack since the URL can contain other format of encoding such as UTF-8 encoding, Unicode-encoding, etc.
  • Manipulating Web Input to File System Calls CAPEC-76 An attacker manipulates inputs to the target software which the target software passes to file system calls in the OS. The goal is to gain access to, and perhaps modify, areas of the file system that the target software did not intend to be accessible.
  • Using Escaped Slashes in Alternate Encoding CAPEC-78 This attack targets the use of the backslash in alternate encoding. An adversary can provide a backslash as a leading character and causes a parser to believe that the next character is special. This is called an escape. By using that trick, the adversary tries to exploit alternate ways to encode the same character which leads to filter problems and opens avenues to attack.
  • Using Slashes in Alternate Encoding CAPEC-79 This attack targets the encoding of the Slash characters. An adversary would try to exploit common filtering problems related to the use of the slashes characters to gain access to resources on the target host. Directory-driven systems, such as file systems and databases, typically use the slash character to indicate traversal between directories or other container components. For murky historical reasons, PCs (and, as a result, Microsoft OSs) choose to use a backslash, whereas the UNIX world typically makes use of the forward slash. The schizophrenic result is that many MS-based systems are required to understand both forms of the slash. This gives the adversary many opportunities to discover and abuse a number of common filtering problems. The goal of this pattern is to discover server software that only applies filters to one version, but not the other.

Vulnerable Configurations

  • cpe:2.3:a:hedgedoc:hedgedoc:-:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:-:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.3.3:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.3.3:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.3.4:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.3.4:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.1:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.1:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.2:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.2:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.3:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.3:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.4:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.4:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.5:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.5:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.4.6:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.4.6:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.5.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.5.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:0.5.1:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:0.5.1:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.2.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.2.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.2.1:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.2.1:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.3.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.3.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.3.1:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.3.1:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.3.2:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.3.2:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.4.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.4.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.5.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.5.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.6.0:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.6.0:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.7.0:-:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.7.0:-:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.7.0:rc1:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.7.0:rc1:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.7.0:rc2:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.7.0:rc2:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.7.1:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.7.1:*:*:*:*:*:*:*
  • cpe:2.3:a:hedgedoc:hedgedoc:1.7.2:*:*:*:*:*:*:*
    cpe:2.3:a:hedgedoc:hedgedoc:1.7.2:*:*:*:*:*:*:*

Protect Your Infrastructure against CVE-2021-29474: Combat Critical CVE Threats

Stay updated with real-time CVE vulnerabilities and take action to secure your systems. Enhance your cybersecurity posture with the latest threat intelligence and mitigation techniques. Develop the skills necessary to defend against CVEs and secure critical infrastructures. Join the top cybersecurity professionals safeguarding today's infrastructures.

Other 5 Recently Published CVEs Vulnerabilities

  • CVE-2024-43107 – Improper Certificate Validation (CWE-295) in the Gallagher Milestone Integration Plugin (MIP) permits unauthenticated messages (e.g. alarm events) ...
  • CVE-2024-41724 – Improper Certificate Validation (CWE-295) in the Gallagher Command Centre SALTO integration allowed an attacker to spoof the SALTO server. Thi...
  • CVE-2025-2133 – A vulnerability classified as problematic was found in ftcms 2.1. Affected by this vulnerability is an unknown functionality of the file /admin/ind...
  • CVE-2025-2132 – A vulnerability classified as critical has been found in ftcms 2.1. Affected is an unknown function of the file /admin/index.php/web/ajax_all_lists...
  • CVE-2025-2131 – A vulnerability was found in dayrui XunRuiCMS up to 4.6.3. It has been rated as problematic. This issue affects some unknown processing of the comp...