Skip to content
Path traversal Write-up Intermediate

The Exploit

A markdown parser in Hashnode's bulk importer allowed local file inclusion via image paths, enabling attackers to read internal files such as /etc/passwd and SSH private keys. The leaked SSH key and server IP (obtained from /proc/net/tcp) could have led to remote code execution, though Hashnode stated SSH was IP-whitelisted.

Aditya Dixit Follow

Published on blog.dixitaditya.com

Hashnode is a blogging platform for developers where you can host your blogs for free with your custom domains. This is packed with features and one such feature is the "Bulk Markdown Importer".

Aditya Dixit (@zombie007o), on blog.dixitaditya.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the markdown parser did not validate or restrict image file paths, allowing directory traversal to read arbitrary local files.

Impact

An attacker could read arbitrary files from the server, including SSH private keys, and potentially gain SSH access if the IP were not whitelisted; Hashnode stated the SSH was IP-whitelisted so unauthorised access was not possible.

What the attacker needed

Ability to upload a ZIP with markdown files; a Hashnode account

The fix

The vulnerability was fixed by the Hashnode team in the Markdown parser and they rotated all private keys.

How it was found

  1. Upload a ZIP containing a markdown file with an image reference to a local path.
  2. Observe that the server attempts to fetch the image and returns an ENOENT error for missing files.
  3. Modify the image path to traverse directories and point to /etc/passwd.
  4. The server uploads the file contents to the CDN and returns the CDN URL in the response.
  5. Use the leaked username and home directory to fetch the SSH private key via a similar path.
  6. Read /proc/net/tcp to extract the server's IP address and port 22.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The blogging platform let users upload markdown files that could include images by path. The server tried to read whatever path was given, even files outside the intended folder, so attackers could read sensitive files like password lists and private keys. This is called local file inclusion.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by Aditya Dixit

View all

6 more disclosed reports, best first.

More from Hashnode

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.