Skip to content
Path traversal Write-up Advanced

CVE-2019–5418: on WAF bypass and caching

A file content disclosure vulnerability in Rails allowed an attacker to read arbitrary files by manipulating the Accept header with glob patterns. In production, view caching limited the attack to one file per server restart, but a race condition could be used to read multiple files simultaneously.

blog.pentesterlab.com

Published on blog.pentesterlab.com

The original lives on blog.pentesterlab.com

We do not hold its text, 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 template resolver used a glob pattern from the Accept header without proper sanitisation, allowing path traversal and file disclosure.

What the attacker needed

Rails application vulnerable to CVE-2019-5418; Ability to send HTTP requests with custom headers; For RCE: marshal serialiser and access to credentials files

The fix

The vulnerability was fixed in Rails; the article does not detail the fix but implies updating Rails.

How it was found

  1. Send a request with a crafted Accept header containing a glob pattern to traverse directories.
  2. The server returns the content of the targeted file.
  3. In production, the response is cached, so subsequent requests for different files may return the cached one.
  4. To read multiple files, wait for cache clear or use a race condition to get multiple files at once.

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.

This is about a bug in a web framework called Rails that let an attacker trick the server into showing files it should not. The attacker could read secret files, and if they got the right ones, they might take over the server. The article explains that a caching feature made it harder to read many files, but a timing trick could help.

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.