Skip to content
Path traversal Write-up Intermediate

Path Traversal in MobileSafari

Safari on iOS 14.0 used the web page's title tag as a filename when saving a page as PDF, without sanitising it, allowing path traversal. An attacker could create files in Safari's container, potentially crashing Safari permanently.

David Schütz Follow

Published on feed.bugs.xdavidhu.me

I have found a path traversal issue in Safari, present in iOS 14.0. When saving a web page as PDF into Files, Safari uses the page’s <title> tag as a file name, without sanitising it first, leading to path traversal.

David Schütz, on feed.bugs.xdavidhu.me

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 app failed to sanitise the user-controlled page title before using it as a file path component.

Impact

An attacker could create files in Safari's container, potentially causing a permanent crash by writing a file Safari cannot parse; writes outside the app folder are blocked by the sandbox.

What the attacker needed

IOS 14.0 device; victim opens malicious page in Safari; victim saves page as PDF to Files

The fix

The issue was fixed in iOS/iPadOS 14.5 and watchOS 7.4.

How it was found

  1. Host an HTML page with a crafted title tag.
  2. Open the page in Safari.
  3. Tap Share.
  4. Tap Options, set Send As to PDF, then tap the back arrow.
  5. Tap Save to Files.
  6. Observe that a file named 'pdf' was created in Safari's Library/Preferences folder.

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.

When you save a web page as a PDF on an iPhone, Safari uses the page's title as the file name. The bug is that it doesn't clean the title, so a malicious page can include slashes and dots to make Safari save the file in a different folder than intended. This lets an attacker write files inside Safari's own storage area.

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 David Schütz

View all

6 more disclosed reports, best first.

More from Apple

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.