GithubHelp home page GithubHelp logo

joe12387 / detectincognito Goto Github PK

View Code? Open in Web Editor NEW
323.0 19.0 40.0 214 KB

JavaScript detection of Incognito & other private browsing modes on Chrome, Edge, Safari, Brave, Firefox, Opera and MSIE.

License: MIT License

HTML 33.01% TypeScript 44.72% JavaScript 22.27%
incognito chrome edge safari firefox internet-explorer private-browsing incognito-mode incognito-browsing incognito-window

detectincognito's Introduction

I'm a software developer specializing in information security, reverse engineering, browser fingerprinting & bot detection.

I maintain several open source repositories here on GitHub.

You can contact me at [email protected]. My PGP key is available here if for some reason you require increased confidentiality.

That's about it.

--

Here are my current active projects as of June 2024:

  • detectIncognito - A TypeScript/JavaScript library for detecting the use of incognito mode or a similar private browsing mode when a browser visits a site. Works with all browsers with compatability for old browsers going back approximately 10 years.
  • Browser Fingerprinting Resistance Research Repo - Documentation on the current state of browser fingerprinting, browsers' attempts at mitigating such techniques, and the current trackability of all browsers (hint: it's basically all of them).

These project(s) are currently stagnant or deprecated in favor of an unreleased replacement project:

  • Overpowered Browser Fingerprinting Script (OPFS) - Released in 2022, this is a browser fingerprinting library that featured certain techniques that were non-public at the time of publishing such as [brave/brave-browser] Issue #24681. I am currently working on a replacement for this library that allows a certain level in change in the browser fingerprint while still being trackable, increasing the lifespans of fingerprint IDs from weeks or months to potentially multiple years. It also includes improved techniques including non-public ones. If you are a company that is interested in this technology and may be interested in purchasing licensing for commercial purposes, send me an email and if we make a deal I'll expedite development. There will also be an open source version of this library for non-commercial use only at some point, but some techniques will remain closed source in order to attempt to prevent Orwellian cross-site surveillance. Potential licencees may be required to sign a contract that requires user consent regardless of applicable privacy regulations prior to fingerprinting similar to a cookie dialog, so I can sleep at night knowing I haven't completely killed privacy.

--

Also, I don't have anywhere to put my list of reported security vulnerabilities, so here they are:

detectincognito's People

Contributors

deokti avatar joe12387 avatar michaelkolesidis avatar mykolashevchuk avatar napthedev avatar p810 avatar surferjeff avatar toxic-johann avatar xiren7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

detectincognito's Issues

False positives

From what I see, the Chrome detection is based on storage quota < physical memory from here, but this condition is not exclusive to incognito mode. It's also in:

  • Guest mode
  • Privacy and security settings
    • Clear cookies and site data when you close all windows
    • Sites that clear cookies when you close them
  • Anytime storage quota < jsHeapSizeLimit. Example: 3.99GB quota and 4GB jsHeapSizeLimit would get detected as incognito

Firefox can also produce false positives if the user disables Service Workers and Push API

  • dom.serviceWorkers.enabled
  • dom.push.enabled

chrome/v8 106+ support

106's update comes with jsHeapSizeLimit matching incongnito and normal browsing. Arms race continues.. I will update if I find a new way... any ideas are welcome

check error Chrome 107.0.5304.108

image

function storageQuotaChromePrivateTest() {
      navigator.webkitTemporaryStorage.queryUsageAndQuota(
        function (usage, quota) {
          console.log(quota, getQuotaLimit()); // 1119775232 1098907648
          _resolveFn(quota < getQuotaLimit());  // false
        },
        function (e) {
          reject(new Error("detectIncognito somehow failed to query storage quota: " + e.message));
        }
      );
    }

new/easier safari method

navigator.storage.getDirectory().then(ok => {
  console.log('not private')
}, err => {
  console.log('private')
})

Email broken?

Trying to send you an email, but...

<[[email protected]](mailto:[email protected])>: host aspmx.l.google.com[142.250.27.27] said: 550-5.1.1 The
    email account that you tried to reach does not exist. Please try 550-5.1.1
    double-checking the recipient's email address for typos or 550-5.1.1
    unnecessary spaces. Learn more at 550 5.1.1
    https://support.google.com/mail/?p=NoSuchUser
    gb41-20020a170907962900b0078db6f56d51si11074896ejc.808 - gsmtp (in reply to
    RCPT TO command)

Error: File '/node_modules/detectincognitojs/dist/detectIncognito.d.ts' is not a module.ts(2306)

I install the package, I follow the instructions and I try to import it

import { detectIncognito } from "detectincognitojs";

And I get an error:

File '/node_modules/detectincognitojs/dist/detectIncognito.d.ts' is not a module.ts(2306)

I am using create-react-app with the TypeScript template

I have also created a minimal reproducible example, an empty test project and when I tried to import it, I had the exact same problem.

The previous version (1.1.2) works fine, the error only occurs in the latest version (1.2.0).

Version: 1.2.0
Browsers: All

Firefox displays incorrect isPrivate value when the site URL is HTTP

OS:- MacOs ventura(13.2.1)
Browser: Firefox(113.0.1)

When the site URL is HTTP, the isPrivate value is incorrectly displayed as true instead of false in normal mode.

Solution:

const firefoxPrivateTest = () => {
  const db = indexedDB.open('test');

    db.onerror = function () {
      __callback(true);
    };
    db.onsuccess = function () {
      __callback(false);
    };
};

Vivaldi always shows as isPrivate

I use Vivaldi and it is a Major boon to my workflow, However, we need to stop incognito in browsers for most of our pages. Unfortunately this also throws Vivaldi users under the bus. We have tried several of the work-arounds that no longer work with the current version of Vivaldi.

This is probably a know issue, but would appreciate feedback.

iPhone QR Code scanner

Hi,
Thanks for your great work.

There is one case I'm not sure how you see it, but would help me and possibly many others a LOT:
When opening an URL from the camera app, it will open in normal Safari, either in normal or private mode (whatever was last opened). But when scanning a QR code from the quick access menu (Control Center) shortcut, it will open some single browser window without a URL bar. And this window will not share it's session with Safari, meaning that if someone is authenticated in Safari, he will not be authenticated in this session, which seems to me to be very similar like being in Incognito mode.
Is this something your script could detect as well?
Thank you

firefox 108.0 is not correct when http access

my firefox is not in private mode, but i access web page with http, when i get navigator.serviceWorker, it is undefined, and it will be judged to be private mode.

the firefox version is 108.0

Doesn't work on Safari 16.0 on MacOS and Mobile

Hello and thank you for your job! But the last update of safari crashes everything. On 1.1.1 it doesn't work and even doesn't throw any errors on safari 16.0. Do you have some thoughts about it? Can you fix it?

TypeError: undefined is not an object (evaluating 'iframe.contentWindow.applicationCache.addEventListener') on iOS 16

error

image

code

try {
    const result = await detectIncognito();

    if (result.isPrivate) {
      alert(
        'using private mode',
      );
      window.addEventListener('beforeunload', (e) => {
        e.preventDefault();
        e.returnValue =
          'using private mode';
      });
    }
  } catch (error) {
    console.error(error);
  }

environment

safari 16
iOS 16
iPhone 14 on Xcode simulator

code base

ESbuild
react
typescript


btw awesome package ! work well on chrome and iOS 15

macOs Safari 15 automated tests detected as Private Mode

Hello,
thank's for your job. It is currently the only library that works on all versions of all major vendors.

In my job I have to integrate the control on the verification of the private mode through automated tests using webdriver.io and selenium-standalone.
While testing with Safari 15 on macOS I found that the library detects the browser as private mode even though it is not.
For other browsers such as Chrome, Firefox and Edge / IE the detection occurs correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.