Skip to content
Path traversal Write-up Advanced

Escalating a Blind Upload to RCE via Path Traversal into Cron and DNS-Restricted Callback Bypass

An unauthenticated file upload endpoint accepted a caller-controlled destination directory, allowing path traversal to write files anywhere on the host filesystem. Because the backend ran as root and cron processed a generated .png file placed in /etc/cron.d, the attacker achieved remote code execution as root.

infosecwriteups.com

Published on infosecwriteups.com

I found an unauthenticated file upload on one of bug bounty target website. The endpoint accepted a file and a caller-controlled destination directory, allowing the write to escape the intended upload folder and reach sensitive locations on the underlying server.

Alvin Ferdiansyah, on infosecwriteups.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

Impact

An unauthenticated attacker could execute arbitrary commands as root on the host, though the report notes the program considered the application vendor-operated and out of scope, so no bounty was awarded and remediation could not be confirmed.

What the attacker needed

No authentication required; backend runs as root; cron processes .png files in /etc/cron.d

The fix

The application should map logical destination names to fixed server-side paths, canonicalise and validate the resolved path against an upload root, require authentication, run the service as an unprivileged account, and return uniform error responses.

How it was found

  1. Send a multipart upload with a benign file and a directory field containing traversal sequences to confirm the path is reflected.
  2. Probe /proc versus /tmp, /etc, and /root to prove the write reaches the real filesystem and that the process has elevated privileges.
  3. Use directory-creation errors as a yes/no oracle to fingerprint the host and confirm cron paths exist.
  4. Upload a file containing a valid crontab into /etc/cron.d; the server stores it with a generated .png name.
  5. Wait one cron cycle and use the oracle to confirm the command ran and the crontab removed itself.
  6. Encode command output into a filename and check for its existence to confirm the executing user is root.

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.

A file upload feature let anyone tell the server where to save the file, and the server did not check that the location stayed inside the upload folder. By using '../' sequences, the attacker could save a file in a system folder that the cron scheduler reads automatically, so the file's contents ran as commands with the highest privileges.

What is Path traversal?

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

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.