paulirish / headless-cat-n-mouse

Is headless chrome currently detectable? Let's pit the detections and detection evasions against eachother.
Apache License 2.0
640 stars 56 forks source link

Why is the webdriver property not being overridden? #16

Open demian85 opened 5 years ago

demian85 commented 5 years ago

My results are:

Page console:  Chrome headless detected via navigator.webdriver present

Headless detection *succeeded*.
🔍  Detectors are winning!

Why is this logic not working? https://github.com/paulirish/headless-cat-n-mouse/blob/master/apply-evasions.js#L13

paulirish commented 5 years ago

Interesting. It's possible Chrome changed the binding so the getter doesn't work any longer. Will need some investigation.

antoinevastel commented 5 years ago

Because it doesn't remove navigator.webdriver, it simply returns false. Thus, if you do feature detection the following way if(navigator.webdriver) you can escape the detection. Nevertheless, if you do it like this if('webdriver' in navigator) you are detected since it does't care about the value of webdriver (true/false).

demian85 commented 5 years ago

So can we delete a non-writable property using Object.defineProperty? I don't get the point of having a non-writable property that can be rewritten -_- (but sounds good to me, since I want to bypass detection!)

antoinevastel commented 5 years ago

You can delete the webdriver property using this code:

await page.evaluateOnNewDocument(() => {
    const newProto = navigator.__proto__;
    delete newProto.webdriver;
    navigator.__proto__ = newProto;
  });
demian85 commented 5 years ago

That works like a charm! I've been trying to delete a non-configurable property with no luck. Is that property non-configurable? I'd love to understand how it can be deleted anyway using the proto hack. Thanks!

On Fri, Sep 14, 2018 at 6:14 AM antoine vastel notifications@github.com wrote:

You can delete the webdriver property using this code: await page.evaluateOnNewDocument(() => { const newProto = navigator.proto; delete newProto.webdriver; navigator.proto = newProto; });

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulirish/headless-cat-n-mouse/issues/16#issuecomment-421287057, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcuZnbhxv2CeKVc-7Fvi2BkBqltBQH1ks5ua3NfgaJpZM4WjseD .

0xjocke commented 5 years ago

I created a PR based on the new proto method https://github.com/paulirish/headless-cat-n-mouse/pull/17

demian85 commented 5 years ago

Unfortunately, the fix is still not enough to pass headless detection from Spotify. Please check my project if you have time. Sounds challenging!

https://github.com/demian85/spotify-cli

On Wed, Sep 19, 2018 at 8:31 AM Joachim notifications@github.com wrote:

I created a PR based on the new proto method

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulirish/headless-cat-n-mouse/issues/16#issuecomment-422766263, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcuZv9ich3nLz4dkcc38HdK6rU2qxc2ks5ucislgaJpZM4WjseD .

hashtafak commented 5 years ago

Unfortunately, the fix is still not enough to pass headless detection from Spotify. Please check my project if you have time. Sounds challenging! https://github.com/demian85/spotify-cli On Wed, Sep 19, 2018 at 8:31 AM Joachim @.**> wrote: I created a PR based on the new proto* method — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#16 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcuZv9ich3nLz4dkcc38HdK6rU2qxc2ks5ucislgaJpZM4WjseD .

FYI spotify have binded local API when you open the app, that's how you can play/pause from web to app (windows app) i have tested.

demian85 commented 5 years ago

Sorry, I don't understand. What do you mean with 'binded local API'?

hashtafak commented 5 years ago

@demian85 if your project do a simple job like play/pause a track from spotify, so u can check out "SpotifyWebHelper".

This project : https://github.com/onetune/spotify-web-helper

Hope it help

r1si commented 5 years ago

how can re-initializate navigator ?? 'webdriver' in navigator;

return true here... https://antoinevastel.com/bots/ because the def is undefined...