Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-45308 Overview
HedgeDoc is an open source, real-time, collaborative markdown notes application. CVE-2024-45308 affects HedgeDoc 1.x deployments backed by MySQL or MariaDB when the allowFreeURL feature is enabled. Attackers can create a note with an alias matching the lower-cased ID of an existing note. Because MySQL and MariaDB perform case-insensitive matching by default, the malicious alias is resolved first and shadows the legitimate note. The result is content spoofing and denial of access to the original note. The flaw is tracked under CWE-1289: Improper Validation of Unsafe Equivalence in Input and was addressed in HedgeDoc 1.10.0.
Critical Impact
Attackers who know a target note's ID can hide the original and substitute a manipulated copy with malicious links, effectively achieving a denial of service against the original content.
Affected Products
- HedgeDoc 1.x prior to 1.10.0
- HedgeDoc instances configured with MySQL as the database backend
- HedgeDoc instances configured with MariaDB as the database backend
Discovery Timeline
- 2024-09-02 - CVE-2024-45308 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-45308
Vulnerability Analysis
HedgeDoc identifies notes either by a randomly generated ID or by an alias when the freeURL feature is enabled. When the application resolves a URL, it queries the database for a matching alias or ID. On MySQL and MariaDB, string comparisons use case-insensitive collations by default. HedgeDoc stored aliases in lower case and did not enforce case-sensitive matching against the note ID column. An attacker with permission to create notes can register an alias equal to the lower-cased form of an existing note ID. Subsequent requests for the original note return the attacker's note instead. The original content is not deleted or modified in the database.
Root Cause
The root cause is reliance on database default collation for equivalence checks between user-supplied aliases and system-generated note identifiers. The patch introduces an isMySQL helper in lib/utils.js and adjusts note lookup logic in lib/models/note.js to force case-sensitive queries when the Sequelize dialect is mysql or mariadb. Without this normalization, the alias namespace and ID namespace collide.
Attack Vector
Exploitation is network-based and requires knowledge of the target note's ID. Depending on the instance's permission model, either authenticated users or unauthenticated visitors can create notes. The attacker visits a URL such as https://<host>/<lowercased-target-id>, which creates a new note under that alias. From then on, requests for the legitimate note resolve to the attacker-controlled content, enabling link substitution or full content replacement.
// Patch excerpt: lib/utils.js — dialect detection helper
return sequelize.options.dialect === 'sqlite'
}
+exports.isMySQL = function isMySQL (sequelize) {
+ return ['mysql', 'mariadb'].includes(sequelize.options.dialect)
+}
+
exports.getImageMimeType = function getImageMimeType (imagePath) {
const fileExtension = /[^.]+$/.exec(imagePath)
// Source: https://github.com/hedgedoc/hedgedoc/commit/380587b7fd65bc1eb71eef51a3aab324f9877650
Detection Methods for CVE-2024-45308
Indicators of Compromise
- Newly created notes whose alias values match the lower-cased form of an existing note ID in the Notes table.
- Sudden user reports that a known note URL is displaying unexpected content or altered outbound links.
- Web access logs showing unauthenticated POST or GET requests that create notes at paths mirroring known note IDs.
Detection Strategies
- Query the HedgeDoc database for rows where alias equals LOWER(id) of another note. Any match indicates an alias collision.
- Compare the createdAt timestamps of alias notes against the original ID's createdAt to identify shadowing entries.
- Monitor application logs for freeURL note creation events originating from unauthenticated sessions when requireFreeURLAuthentication is disabled.
Monitoring Recommendations
- Enable audit logging on the HedgeDoc database and alert on INSERTs into the notes table with aliases matching a hex-string pattern consistent with existing IDs.
- Track HTTP request volume for freeURL note creation and flag spikes from single source IPs.
- Review reverse proxy logs for requests that create notes at previously nonexistent alias paths.
How to Mitigate CVE-2024-45308
Immediate Actions Required
- Upgrade HedgeDoc to version 1.10.0 or later, which enforces case-sensitive alias lookups on MySQL and MariaDB.
- If upgrading is not immediately possible, disable freeURL mode by setting allowFreeURL to false or unsetting CMD_ALLOW_FREEURL.
- Restrict freeURL note creation to trusted, authenticated users by enabling requireFreeURLAuthentication or CMD_REQUIRE_FREEURL_AUTHENTICATION.
- Audit the notes table for any alias values that collide with existing note IDs and remove or quarantine offending records.
Patch Information
The fix is delivered in HedgeDoc 1.10.0 via commit 380587b7fd65bc1eb71eef51a3aab324f9877650. The patch adds a dialect helper (isMySQL) and enforces BINARY or case-sensitive comparisons for note lookups when running against MySQL or MariaDB. Full details are available in the GitHub Security Advisory GHSA-pjf2-269h-cx7p and the upstream commit.
Workarounds
- Set CMD_ALLOW_FREEURL=false in the HedgeDoc environment to prevent arbitrary alias creation.
- Set CMD_REQUIRE_FREEURL_AUTHENTICATION=true to restrict freeURL creation to logged-in users when freeURL must remain enabled.
- Consider migrating the notes table columns to a case-sensitive collation such as utf8mb4_bin as a defense-in-depth measure.
# Configuration example: disable freeURL or require authentication
export CMD_ALLOW_FREEURL=false
# Or, if freeURL is required, restrict it to authenticated users
export CMD_ALLOW_FREEURL=true
export CMD_REQUIRE_FREEURL_AUTHENTICATION=true
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

