Skip to main content
Vulnerability Database/CVE-2024-38353

CVE-2024-38353: HackMD CodiMD Auth Bypass Vulnerability

CVE-2024-38353 is an authentication bypass flaw in HackMD CodiMD that allows unauthenticated attackers to access uploaded image data without authorization. This post explains its impact, affected versions, and mitigation steps.

Published:

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-38353 Overview

CodiMD is an open-source realtime collaborative markdown editor maintained by HackMD. CVE-2024-38353 is a missing authentication and access control weakness affecting CodiMD versions prior to 2.5.4. The application does not require authentication to upload images or to retrieve previously uploaded image data. An unauthenticated attacker who knows or predicts an image URL can read the underlying file. The issue is compounded by insecure random filename generation in the bundled Formidable library, which reduces the entropy an attacker must overcome to enumerate valid URLs. The maintainers fixed the flaw in CodiMD 2.5.4.

Critical Impact

Unauthenticated remote attackers can read uploaded images and upload new image data, exposing potentially confidential content stored in CodiMD notes.

Affected Products

  • HackMD CodiMD versions prior to 2.5.4
  • Deployments relying on the bundled Formidable filename generator
  • Self-hosted CodiMD instances exposed to untrusted networks

Discovery Timeline

  • 2024-07-10 - CVE-2024-38353 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-38353

Vulnerability Analysis

CodiMD exposes an image upload endpoint that stores uploaded files on the server and returns a URL for embedding inside collaborative notes. The endpoint neither authenticates the uploader nor gates read access to the stored files. Any client that reaches the CodiMD web tier can push new image data and retrieve any image whose URL it can construct. Because notes frequently contain screenshots, credentials, diagrams, or internal documents, unauthorized retrieval can expose sensitive organizational data. The weakness is tracked as CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG), reflecting the filename generation flaw that amplifies the missing access control.

Root Cause

Two defects combine to produce the vulnerability. First, CodiMD omits authentication checks on the image upload and retrieval routes, treating uploaded media as public regardless of note visibility. Second, the underlying Formidable library assigns filenames using a weak random source, so attackers can enumerate or predict valid image paths rather than needing to guess long, high-entropy identifiers.

Attack Vector

Exploitation requires only network access to a vulnerable CodiMD instance. An attacker enumerates candidate image filenames using knowledge of Formidable's weak random generator, then issues HTTP GET requests to the image directory. Successful responses return the raw image bytes. The same endpoint accepts anonymous POST requests to upload attacker-controlled content, which can be abused for storage abuse or as staging for phishing links that appear to originate from a trusted CodiMD host.

No verified proof-of-concept code has been published. Refer to the HackMD security advisory GHSA-2764-jppc-p2hm for maintainer guidance.

Detect Identity Attacks the Moment Authentication Fails

Singularity™ Identity surfaces credential misuse, lateral movement, and privilege escalation in real time, so you can contain the breach before it spreads.

Stop Identity Attacks

Detection Methods for CVE-2024-38353

Indicators of Compromise

  • Unauthenticated HTTP GET requests to /uploads/ returning image content with 200 OK from unknown source IPs
  • Sequential or high-volume enumeration patterns against the CodiMD image directory
  • Unexpected image files stored under the CodiMD uploads path that do not correspond to any active note

Detection Strategies

  • Inspect reverse proxy or web server access logs for requests to CodiMD image paths lacking a valid session cookie or referer from an authenticated note
  • Alert on high request rates to /uploads/ from a single source that indicate filename brute forcing
  • Baseline normal upload volume and flag anomalous POST activity to the image endpoint

Monitoring Recommendations

  • Forward CodiMD and fronting web server logs to a centralized analytics platform for retention and correlation
  • Track outbound egress from the CodiMD host for signs of bulk image exfiltration
  • Review file system growth on the uploads directory to detect anonymous upload abuse

How to Mitigate CVE-2024-38353

Immediate Actions Required

  • Upgrade CodiMD to version 2.5.4 or later on all self-hosted instances
  • Restrict network exposure of CodiMD to authenticated users through a VPN or authenticating reverse proxy until patched
  • Audit the uploads directory for unexpected files and rotate any secrets that may have appeared in exposed images

Patch Information

The vulnerability is fixed in CodiMD 2.5.4. Review the HackMD security advisory GHSA-2764-jppc-p2hm for release notes and upgrade guidance. Container operators should pull the updated image tag and redeploy.

Workarounds

  • Place CodiMD behind an authenticating reverse proxy that requires a valid session before proxying requests to /uploads/
  • Block anonymous HTTP methods on the image endpoint at the web application firewall layer
  • Disable public image upload functionality if it is not required for the deployment
bash
# Example nginx reverse proxy snippet enforcing auth on the uploads path
location /uploads/ {
    auth_request /auth;
    proxy_pass http://codimd_backend;
}

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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.