Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-color-4] Security: handling of color-profiles #5552

Closed
jsalowey opened this issue Sep 26, 2020 · 14 comments
Closed

[css-color-4] Security: handling of color-profiles #5552

jsalowey opened this issue Sep 26, 2020 · 14 comments
Assignees
Labels
Closed Accepted by Editor Discretion Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-color-4 Current Work

Comments

@jsalowey
Copy link

I've been assigned to security review this document. I have some concerns with the handling of color profiles and how they might introduce security and privacy risks. My understanding of them is incomplete.

  1. Are the .icc files listed in the color-profile meant to be retrieved and parsed in real time?

If so there is a potential risk that these requests could be used to track a user or deliver a malicious payload.

  1. Are .icc files something that browsers already parse or is this a file-format that is new to them? Can these files contain any "scripts" or "code"?

What are the ways an implementation can mitigate any risks associated with handling this new file type?

  1. Can a script determine if the profile was used or if a fallback was used?

If so it seems this could be used in fingerprinting

  1. How would color-profiles interact with content security policy?

Do you envision any special treatment of these requests by content security policy?

@svgeesus svgeesus self-assigned this Sep 28, 2020
@svgeesus svgeesus added css-color-4 Current Work privacy-needs-resolution Issue the Privacy Group has raised and looks for a response on. security-needs-resolution Issue the security Group has raised and looks for a response on. labels Sep 28, 2020
@tabatkins
Copy link
Member

Are the .icc files listed in the color-profile meant to be retrieved and parsed in real time?

Yes. The "track a user" concern is identical to any resource specified in CSS, tho - in particular, images like background-image.

The "malicious payload" concern is relative to whatever parsers browsers use for their ICC parsing - a broken parser is def an issue, but it's also a clear bug. I'm not sure - how severe is this kind of thing? It's part of any new file format being introduced, right?

Are .icc files something that browsers already parse or is this a file-format that is new to them? Can these files contain any "scripts" or "code"?

New file format.

Dunno about their contents - @svgeesus?

Can a script determine if the profile was used or if a fallback was used?

Yes. Can you elaborate on how it enables fingerprinting? The only profiles available are those predefined by the spec, and those explicitly loaded by the page. The latter aren't a fingerprinting vector - they're the same for everyone visiting the page - and the former is the generic "new features aren't supported by old browsers, and thus allow UA detection" leak intrinsic to the entire web platform.

How would color-profiles interact with content security policy?

The interaction between CSS's resource loading and CSP is ill-defined in general right now, but I suspect this interacts identically to CSS image loading.

@svgeesus
Copy link
Contributor

Color profiles are in practice mostly used to give the (large) amount of measured color information needed to accurately convert colors on a Web page into CMYK for printing on a specific printer/ink/paper combination. The specification recommends some widely used profiles (FOGRA, SWOP) for particular characterised printers, which being standard are less of a tracking risk and will enable accurate printing at a commercial print shop. But if someone needs to print on an unusual printer they can do that too. Such workflows are in practice more likely to be intranet than internet, for example a publishing house generating a printed book from HTML/CSS sources.

Color profiles can be used for RGB colorspaces as well, but the CSS Color 4 specification already predefines the most commonly used ones, so that color profiles do not need to be downloaded.

@svgeesus
Copy link
Contributor

svgeesus commented Sep 29, 2020

Adding on to (or in one case contradicting) what Tab said:

Are the .icc files listed in the color-profile meant to be retrieved and parsed in real time?

Yes

If so there is a potential risk that these requests could be used to track a user or deliver a malicious payload.

Malicious payload is unlikely, the contents of an ICC profile are declarative and contain measured color information. There are no scripts in color profiles and no script execution mechanism.
They are defined by the International Color Consortium (ICC)
http://www.color.org/v4spec.xalter

Are .icc files something that browsers already parse or is this a file-format that is new to them?

Tab was incorrect here.
Browsers already parse them, embedded in images such as JPEG or (ore rarely) PNG.
Having the ICC files standalone and linked to the content was first introduced by SVG in 1998 and was implemented by browser plugins such as Adobe and Corel.
It is new to CSS (It was previously in CSS Color 3 but was dropped because there was only one implementation, in IE for Mac.
But browsers have been handling ICC profiles in raster images for over a decade.

Can these files contain any "scripts" or "code"?

No, see above.

What are the ways an implementation can mitigate any risks associated with handling this new file type?

Security bugs get reported to the ICC, which discloses them after fixes have been tested and deployed. See
http://color.org/profilesecurity.xalter
W3C is an ICC Member; I'm the W3C representative to the ICC, so I do now hear about these.

Can a script determine if the profile was used or if a fallback was used?

Possibly but unlikely. For example a profile could be used to swap the red and green channels, which would give a different visual result. However, browsers already have pretty good defenses to stop a script reading colors back off the screen.

@x-Jake-x
Copy link

Hi there! The only way I can see color profiles being different than the background-image problem in this case would be a gamut-mapping-detection possibility. To avoid duplicating detail, I just mentioned it in: #5553 (comment)

@svgeesus
Copy link
Contributor

Thanks, I was actually just reading that comment :)

@svgeesus
Copy link
Contributor

OS-level color management systems are certainly a possible attack surface, but this has already been probed and cleaned up over the last decade or so from fuzzing image decoders. The ICC profiles used in CSS Color 4 as the same as those embedded in raster images or PDFs.

See for example https://www.real-sec.com/2020/09/fuzzing-image-parsing-in-windows-part-one-color-profiles/

@svgeesus
Copy link
Contributor

svgeesus commented Oct 5, 2020

As a further indication that ICC is not a new format on the Web, the Internet Media Type application/vnd.iccprofile was registered in 2008.

@svgeesus
Copy link
Contributor

svgeesus commented Oct 5, 2020

Do you envision any special treatment of these requests by content security policy?

Currently, CSS accesses external resources such as fonts, images, color profiles via the url() function. We have discussed specifying a similar but more full-featured function, (tentatively called src())which is CORS-aware and usable with CSP, plus some other improvements like usabiity with string concatenation. This would provide a consistent improvement for all external resources referenced from CSS, rather than solving it multiple times:

So I guess the answer to your question is "we are working on that, and the solution will not be specific to color profiles"

@tabatkins
Copy link
Member

As a further indication that ICC is not a new format on the Web, the Internet Media Type application/vnd.iccprofile was registered in 2008.

It's "a new format on the web" because browsers do not currently parse ICC files; this is a new parser being exposed to the web.

The presence of it in standards doesn't matter here, it's the exposure of potential new parsing vulnerabilities due to new parsers being exercised by potentially malicious actors.

@jsalowey
Copy link
Author

Adding this to the list of resources to address for CORS and CSP sound like a good idea. Much better to handle this generically.

There will be some added attack surface exposed by the processing of the color profiles, however the file format does not have potentially dangerous functionality such as scripting. It would be a good to review and fuzz implementations that handle this format, but I'm not sure that is something that goes in this spec.

@svgeesus
Copy link
Contributor

Okay so for the security & privacy appendix I added a note that ICC profiles are downloaded on demand and do not contain executable code.

Beyond that, I am not hearing any requests for changes to the specification, is that correct?

@jsalowey
Copy link
Author

Correct. I don't think there is anything actionable for this specification.

@svgeesus svgeesus added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Timed Out (Assumed Satisfied) labels Oct 31, 2020
@svgeesus svgeesus added privacy-tracker Group bringing to attention of Privacy, or tracked by the Privacy Group but not needing response. security-tracker Group bringing to attention of security, or tracked by the security Group but not needing response. and removed privacy-needs-resolution Issue the Privacy Group has raised and looks for a response on. security-needs-resolution Issue the security Group has raised and looks for a response on. labels Mar 9, 2021
@w3cbot w3cbot added the privacy-needs-resolution Issue the Privacy Group has raised and looks for a response on. label Mar 10, 2021
@w3cbot w3cbot added security-needs-resolution Issue the security Group has raised and looks for a response on. and removed privacy-tracker Group bringing to attention of Privacy, or tracked by the Privacy Group but not needing response. security-tracker Group bringing to attention of security, or tracked by the security Group but not needing response. labels Mar 10, 2021
@samuelweiler samuelweiler removed privacy-needs-resolution Issue the Privacy Group has raised and looks for a response on. security-needs-resolution Issue the security Group has raised and looks for a response on. labels Mar 15, 2021
@dveditz
Copy link
Member

dveditz commented Oct 12, 2021

It's "a new format on the web" because browsers do not currently parse ICC files; this is a new parser being exposed to the web.

How different is an ICC file from the ICC chunk in images? I haven't checked other browsers, but Firefox parses ICC in JPEG, PNG, BMP, WebP, AVIF so I imagine most browsers do. That parser is effectively exposed to the web already.

@svgeesus
Copy link
Contributor

How different is an ICC file from the ICC chunk in images?

That was my point in comment - identical, just transferred as a separate resource rather than included inside a raster image.

For example definition of the iCCP Embedded ICC profile chunk in PNG:

Profile name 1-79 bytes (character string)
Null separator 1 byte (null character)
Compression method 1 byte
Compressed profile n bytes

I haven't checked other browsers, but Firefox parses ICC in JPEG, PNG, BMP, WebP, AVIF so I imagine most browsers do. That parser is effectively exposed to the web already.

Correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by Editor Discretion Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-color-4 Current Work
Projects
None yet
Development

No branches or pull requests

7 participants