Stealing local files using Safari Web Share API
The Safari Web Share API allowed sharing a file: URL, so a malicious page could trick a user into sharing a local file such as /etc/passwd or the Safari history database. The attacker could exfiltrate local files if the user interacted with the share dialog.
Published on blog.redteam.pl
The original lives on blog.redteam.pl
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 Web Share API implementation did not restrict the URL scheme to http/https and allowed file: URLs to be shared as attachments.
Impact
A user could unknowingly share local files, including the Safari history database, with a recipient chosen by the attacker; the attack requires user interaction and the visibility of the attachment varies by sharing app.
What the attacker needed
Safari or Mobile Safari; victim visits a malicious page; victim clicks share and sends
The fix
The Web Share API should reject file: URLs and only allow http or https URLs to be shared.
How it was found
- Visit the proof-of-concept page in Safari or Mobile Safari.
- Click the share button.
- Select a sharing method such as Mail or Messages.
- Send or share the message, or inspect the attachment.
- Observe that the local file /etc/passwd has been attached.
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 Web Share API lets a website open the phone or computer's share menu so you can send a link to a friend. Safari did not check that the link was a normal web address, so a page could put a local file path in the share message. If you then chose to share, the file itself was attached and sent, even though you only saw a harmless link.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.