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

canvas fingerprint is different for different zoom levels on Firefox #103

Open
Valve opened this issue Dec 20, 2015 · 13 comments
Open

canvas fingerprint is different for different zoom levels on Firefox #103

Valve opened this issue Dec 20, 2015 · 13 comments

Comments

@Valve
Copy link
Member

Valve commented Dec 20, 2015

When I zoom the page in FF, I get different FPs, because the canvas.toDataURL returns different results for different zoom levels.

@Valve Valve added this to the v.2.0 milestone Dec 20, 2015
@Valve Valve added the hard label Dec 20, 2015
@RobertBorg
Copy link

I'm working on this.

In addition to toDataURL, both getScreenResolution and getAvailableScreenResolution is changing.
diff after toDataURL fix: https://www.diffchecker.com/8nunklnj
as can be seen here it is the first text that is causing the change for the image generated on canvas.
diff

by using a 12pt font instead of 11pt for that text this issue goes away as far as i can tell. the other issues still remain.

both getScreenResolution and getAvailableScreenResolution are returning vaules in virtual pixels as if it was lowering my screens dpi. I need some input on how to work around this. how much entropy will we loose by simply disabling getScreenResolution and getAvailableScreenResolution on firefox?

@Valve
Copy link
Member Author

Valve commented Feb 26, 2016

Thanks! You may be interested in some of the work I had been doing in this area too here:
https://github.com/Valve/fingerprintjs2/commits/dev

As for skipping the resolution keys on FF - it's a step I'm reluctant to make, we should try to solve this ideally :)

@RobertBorg
Copy link

Awesome! Unfortunetly I was wrong about the 12pt fix. But setting transform: scale(1); on it does work. Now for the resolution thing. I don't think we can actually calculate it, as it is throwing away information when it rounds it. Had that been the only issue we could've brute forced it similar to how hashed passwords are cracked. But as we have multiple widths mapping to the same virtual width.
I propose we use a lookup table for common resolutions, what do you think? Also, is the problem in IE same as in FF? i don't have IE readily available.

@Valve
Copy link
Member Author

Valve commented Feb 26, 2016

IE is similar conceptually but different in JavaScript API and rounding precision
I don't have IE too, unfortunately.

I propose we use a lookup table for common resolutions, what do you think?

I don't entirely understand your idea. Please explain in more detail

@RobertBorg
Copy link

list common resolutions
like

var commonWidth = [640,768,800,800];
var commonHeigth = [480,480,480,600];

var lower = Math.round((virtualWidth-0.5)*zoom);
var upper = Math.round((virtualHeigth+0.5)*zoom); 

//find indcies matching [lower, upper] in commonWidth
//do same for heigth
//find indicies in both widthIndicies and heigthIndicies, there will probably just be 1, otherwise use virtualScreenRatio to make an educated guess.

PS. i was wrong about the toDataURL again -.-

RobertBorg added a commit to RobertBorg/fingerprintjs2 that referenced this issue Feb 27, 2016
RobertBorg added a commit to RobertBorg/fingerprintjs2 that referenced this issue Feb 27, 2016
RobertBorg added a commit to RobertBorg/fingerprintjs2 that referenced this issue Feb 27, 2016
RobertBorg added a commit to RobertBorg/fingerprintjs2 that referenced this issue Feb 27, 2016
@jesantana
Copy link

I have been doing tests on this and I guess these are separated issues.

  • On one side, the getDataUrl returns different values in firefox 45.0.1 almost everytime you generate a new fingerprint.
  • On the other, when you zoom in or out in the same browser the available resolution changes as described by @RobertBorg

So maybe it is worth to address them separately, in my team, we think we have a solution for the first issue, so maybe we soon we will send a pull request.

@kevindice
Copy link
Contributor

Would zoom variability not be a problem if the fingerprinting was done inside of a hidden iframe with

<meta name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,user-scalable=no" />

in its <head>?

@eisman
Copy link

eisman commented Jun 20, 2016

@kevindice It does not work.

@Valve Valve modified the milestones: v.3.0, v.2.0 Aug 8, 2016
@sgarciafer
Copy link

sgarciafer commented Apr 16, 2017

I've noticed that when enabling the inspector on mobile mode the fingerprint is also different. This is probably related to the same zoom issue.

Somehow the script on this demo site (minified, cutted in pieces and loaded through ajax) has a very good behaviour: https://browserleaks.com/canvas

I would strongly encourage to beautify it and replace the one char variables and function names to make it readable and correct the behaviour based on what they do.

@sgarciafer
Copy link

Here you have it: https://github.com/sgarciafer/canvasfingerprint

@markogresak
Copy link

Question: Is this a duplicate of #98? Given that it's set for V3 milestone, where IE support is dropped.

@Valve
Copy link
Member Author

Valve commented Oct 9, 2020

Yes, it duplicates the same issue: zoom changes the resolution and by extension, the fingerprint.

@Finesse Finesse removed this from the v.3.0 milestone Oct 16, 2020
@Finesse
Copy link
Member

Finesse commented Mar 30, 2021

The canvas image difference is mitigated in d3e359c by extracting the text into a separate canvas image (the text changes with the zoom level while the geometry stays the same). The image with text is still used to calculate the hash, but it can be removed in a custom components hash function.

The image before:

geometry + text

The images after:

geometry + text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants