Websites can circumvent measures by Tor Browser / NoScript to reject fonts.
Fonts can be injected as “application/font” data in base64 format, directly into the CSS! I discovered this at CSS Tricks... go figure. I've noticed this on another website since.
To replicate, go to the above site in Tor's highest security setting.
You'll see that the fonts are not your usual fonts.
Inspect the CSS and you'll see code like this to "import" the fonts:
The thing that struck me is that the embedded mime type is ‘application/x-font-woff2’. What other “application” types might be embed-able and usable/executable?
I did a search and didn't see this as a ticket.
Trac: Username: dcent
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Thanks for reporting this. While I was partially joking about a "malicious font", I did take this seriously. This could be a attack vector, so I dug into it a bit and it looks like we can flip gfx.downloadable_fonts.enabled on Safest and it will ignore webfonts.
Trac: Summary: Fonts can be injected into a website via CSS (as base64 encoded application) to Disable downloadable fonts on Safest security level Keywords: N/Adeleted, TorBrowserTeam202002 added
I verified this works by loading the provided example page on Safer (before disabling the pref), I opened the webtools Inspector, I selected an element on the page (any of them should work), from the panel on the right-side I selected the "fonts" tab, at the bottom of the fonts tab there is an "All fonts on page" arrow/toggle (at least in English). Clicking this shows all fonts used on the page, and indeed it shows the data: webfonts.
After disabling the downloadable_fonts pref, I refreshed the page and repeated the above steps. It shows only system fonts were used.
In parallel, I went code-diving and this seems reasonable.
Trac: Status: new to needs_review Reviewer: N/Ato acat
It might be advantageous to determine what Firefox allows as application data when parsing urls in CSS. Is it only fonts or are other things that can draw to the screen permitted eg. svgs (which are also not permitted in Tor), other media etc.
If so it might be safest to prevent the parsing of "application" data at the CSS level?
I don't necessarily agree with this approach. At some stage safest is going to become practically useless. Downloadable fonts are often used for glyphs/icons (although it's only visual and usually users can intuitively tell what the tofu means). This is not something obscure like graphite.
What is a malicious font?
sysrqb: you kinda jested, but I'm asking in earnest. Can you point me at any documentation?
it might be safest to prevent the parsing of "application" data at the CSS level
This seems like the better approach (and to confirm no other types can be downloaded via this method and exploited). Can a downloadable font used by this method do anything more than one than isn't?
I'm not an expert on data URIs, but my understanding is that security threats from this are (probably) already mitigated by Mozilla upstream - so I'm seriously asking why this needs to be done, or at least some discussion / clarity around it
I don't necessarily agree with this approach. At some stage safest is going to become practically useless.
In the highest security level fonts are already blocked and I understand that's for a reason. If we want to bundle the free Font Awesome fonts (or any other fonts for that matter) into Tor, then that's another issue, I'd personally be interested in Fira Sans (cannot-sell-font-individually license) and Roboto Slab (fully free license) being added as they serve a different purpose to Arimo but every font added will result in a larger download for Tor Browser.
What is a malicious font?
I did read about this once, it might be on these forums.
[Preventing the parsing of "application" data at the CSS level] seems like the better approach (and to confirm no other types can be downloaded via this method and exploited). Can a downloadable font used by this method do anything more than one than isn't?
In the highest security level fonts are already blocked and I understand that's for a reason
No they're not, only some fonts types are blocked: graphite and opentype_svg. That doesn't mean we should just block all downloadable fonts. All I'm asking is what is the actual threat here - because TBH I'm not seeing one yet, and this affects usability (ligatures and icon fonts are widespread)
x Fixed CapsCSP bug allowing data: URLs to bypass font
blocking (thanks dcent and skriptimaahinen)
x [XSS] Prevent DOS detection from being triggered for
already aborted requests (thanks therube)
SVGs are prevented from loading in Tor, and I don't believe that has anything to do with NoScript.
To restate what Thorin said:
[Preventing the parsing of data at the CSS level] seems like the better approach (and to confirm no other types can be downloaded via this method and exploited). Can a downloadable font used by this method do anything more than one than isn't?