This man thought opening a TXT file is fine, he thought wrong. macOS CVE-2019-8761
macOS TextEdit could be tricked into parsing HTML inside a .TXT file, allowing an attacker to make the victim's machine load local files and leak their contents or IP address. The bug bypassed Gatekeeper and could leak the real IP even when using Tor.
Published on paulosyibelo.com
CVE-2019-8761 is an interesting macOS bug I found that lets attackers execute HTML within a TXT file, leak files, and do all sorts of other funky things when a TXT file is opened.
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 TextEdit's file-type detection trusted the file's content over its extension, so HTML inside a .TXT file was parsed as HTML.
Impact
An attacker could learn when a TXT file is opened and leak the victim's real IP address, even through a proxy or Tor, and could potentially steal local files using dangling markup.
What the attacker needed
Victim opens a .TXT file; macOS with TextEdit; attacker controls a server
The fix
The vulnerability was likely fixed by Apple after being reported in Q4 2019, but the text does not confirm the exact fix.
How it was found
- Create a .TXT file that starts with HTML doctype and tags.
- Include a style tag with an @import rule pointing to a file:///net/ URL.
- Send the file to the victim; when opened, TextEdit loads the CSS from the remote host.
- Observe the incoming request on the attacker's server, revealing the victim's IP.
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 .TXT file is normally just plain text, so people trust it. But the default text viewer on macOS could be fooled into treating a .TXT file as a web page, so it would follow instructions meant for web pages. That let an attacker make the victim's computer contact the attacker's server or read local files, without the victim knowing.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.