4

I am working on an extension for Chrome that would alter my "Hash of WebGL fingerprint" as per https://panopticlick.eff.org/results?aat=1&dnt=111#fingerprintTable

I started off using the code provided in the following link https://intoli.com/blog/making-chrome-headless-undetectable/, basically copying it in my concept.js file, which looks as follows:

const getParameter = WebGLRenderingContext.getParameter;
WebGLRenderingContext.prototype.getParameter = function(parameter) {
  // UNMASKED_VENDOR_WEBGL
  if (parameter === 37445) {
    return 'Intel Open Source Technology Center';
  }
  // UNMASKED_RENDERER_WEBGL
  if (parameter === 37446) {
    return 'Mesa DRI Intel(R) Ivybridge Mobile ';
  }

  return getParameter(parameter);
};

My manifest json is fairly simple and is set to run at document_start, which it does. However, using the above stated extension there is no difference in my WebGL hash. I know that the code in the extension actually runs as I have tested it with a bunch of small javascript alerts.

I am completely at a loss and have worked on this problem for several hours to no avail, all help is greatly appreciatedj

EDIT: For completeness sake following is my manifest.json

{
  "manifest_version": 2,
  "name": "JavaScript Injection",
  "version": "1.0.0",

  "content_scripts": [
    {
      "matches": ["*://*/*"],
      "js": ["injected-javascript.js"],
      "run_at": "document_start"
    }
  ]
}
J. Doe
  • 183
  • 2
  • 9

1 Answers1

1

The answer is - isolated code.
You can use this code, but it is not work perfectly. I'am still in search for better solution, because this snippet depends on page load time. If you hit Shift + Ctrl + C it will works well, but simple Ctrl + C don't, becase page loads faster than interval starts.

const getParameter = WebGLRenderingContext.getParameter;
const a = setInterval(() => {
  if (!document.body) {
    return
  }
  clearInterval(a);
  var script_tag = document.createElement('script');
  script_tag.type = 'text/javascript';
  script_tag.text = 'WebGLRenderingContext.prototype.getParameter = function(parameter) {' +
    'if (parameter === 37445) { return "Intel Open Source Technology Center"; };' + 
    'if (parameter === 37446) { return "Mesa DRI Intel(R) Ivybridge Mobile "; }; return getParameter(parameter);' +
  '}';
  document.body.appendChild(script_tag);
}, 1);

Read more about this issue in this stackoverflow question