News for hackers. Stuff that matters.
Re:Detecting Chrome headless by westoque on Saturday August 05, 2017 @11:18AM (#14936110)
Your solutions in detecting Chrome headless is good.

But someone who really wants to do web scraping or anything similar will use a real browser like Firefox or Chrome run it through xvfb and control it using webdriver and maybe expose it through an API. I find these to be almost undetectable.. The only way you can mitigate this is to do more interesting mitigation techniques. Liie IP detection, Captchas, etc.

edit: when I say real browser, I mean running the full browser process including extensions etc.

Re:Detecting Chrome headless by ivanhoe on Saturday August 05, 2017 @12:38PM (#14936534)
Yes, but it's slower and more expensive that way. If you want to run a few hundred parallel spider processes with full browser in each, it's neither easy nor cheap anymore. It takes a lot more resources than running it headless, plus adds a significant overhead to automate and control all that.

Ultimately, no protection is unbreakable, there's a work around for almost everything. If your site has thousands of pages (e.g. big online stores, that are common target for spidering) it's probably the best approach to make things as slow and complicated for spider author as possible. That's exactly the same logic like with captchas, they can be broken fairly easy nowadays, but they'll still slow down the spidering rate and pump up the cost.

Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @01:46PM (#14936876)
> If you want to run a few hundred parallel spider processes with full browser in each, it's neither easy nor cheap anymore. It takes a lot more resources than running it headless, plus adds a significant overhead to automate and control all that.

This is not true. I've seen it done in AWS for less than $2,000 monthly, and I can do it from my home for less than $500 per month (minus the costs of my workstation and networking gear, which you'd amortize over the expected lifetime of the project). I have a home server with 128GB of RAM and an i7-6900K, with 125 static IPs and a bunch of Ubiquiti networking gear. You don't even need that much memory or compute power, but I also use my workstation for other research projects. I use my own static IPs to parallelize without having to sacrifice latency or cede control to a shady proxy farm.

It's a pretty straightforward setup - each static IP is given its own route across the switches from the gateway, and the switches have link aggregated connections for 40GbE bandwidth. You have pub sub and queuing, and each scraping target is its own headless Chrome process. The requests to the target from each process are round robin sent across the available interfaces. Then you've got parsing and a local database.

I'm not a particularly invasive scraper (I make my User Agent deliberately obvious with an explicit way to opt out), but it's really not true that it's prohibitively expensive. This is a pretty cheap setup; I don't even profit from the work, I use it for personal research. If someone was actively selling valuable data, this would absolutely be worth it.

Re:Detecting Chrome headless by nullpage on Saturday August 05, 2017 @06:45PM (#14938373)
Curious about your home setup, what ISP are you using at home that lets you have essentially a /25 block of public IPs, let alone 40GbE of bandwidth? Especially if this is costing you $500/month.
Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @07:46PM (#14938705)
I have Verizon Fios set up as a business account to my home. However that bandwidth is for SAN to workstation data processing and analysis. There's only half a gigabit of external internet bandwidth, but I have hundreds of terabytes of data (and high tens of gigabytes are downloaded per day) in local storage.

With 128GB of RAM I can only load small amounts into memory for targeted analysis. Processing the rest of the data requires loading it directly from storage. To improve I/O performance I parallelize the transfer across link aggregated ethernet interfaces. Naturally that would cause disk reads to become a bottleneck; to take proper advantage of the network transfer speeds I hold all data in RAID 0 with 7200 RPM drives.

Re:Detecting Chrome headless by cft on Sunday August 06, 2017 @01:34AM (#14939903)
if your IPs are in a contiguous /25 , they can all be blocked with a single firewall rule. And detection is also easy. It only helps with rate limits.

To avoid a block, you need a list of good socks5 proxies

Re:Detecting Chrome headless by dsacco on Sunday August 06, 2017 @01:42AM (#14939930)
> if your IPs are in a contiguous /25

They're not.

> To avoid a block, you need a list of good socks5 proxies

No; furthermore, that leaks your data to a third party and introduces significant latency.

Re:Detecting Chrome headless by stordoff on Saturday August 05, 2017 @07:51PM (#14938738)
Certainly curious about getting 40GbE bandwidth, but the IP addresses doesn't seem like much of a hurdle. I was looking at business broadband a couple of weeks ago, and getting 13 static IPs was only £5 extra a month. Going all the way up to a leased line included unlimited "subject to internet regulations".
Re:Detecting Chrome headless by elorant on Saturday August 05, 2017 @04:27PM (#14937725)
I'd love to read more details about your hardware setup. Care writing a blog post or something similar?
Re:Detecting Chrome headless by ivanhoe on Saturday August 05, 2017 @03:10PM (#14937338)
It's a matter of a personal perspective. If you're based in US and have a luxury of working with enterprise clients than sure. On the other hand, few years ago when I was doing data scrapping as a freelancer, price tag of $2K just for the infrastructure would be a huge show stopper for the most of my average clients back then. We were charging them way less than that.
Re:Detecting Chrome headless by toomuchtodo on Saturday August 05, 2017 @01:57PM (#14936944)
Would you be willing to chat more about this one on one for research (non-commercial) purposes?
Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @02:07PM (#14937004)
Sure. I don't sell data but I'm happy to talk shop or help with interesting research projects.
Re:Detecting Chrome headless by Dolores12 on Saturday August 05, 2017 @01:45PM (#14936869)
Every spider process is a browser tab. People have hundreds tabs opened without any problem on ordinal computers. On a dedicated server with 128GB of ram you can run thousands of those and it will cost you 100$-200$/month.
Re:Detecting Chrome headless by jasonjayr on Saturday August 05, 2017 @05:01PM (#14937872)
True -- But the user is not interacting with all 100's of those tabs at the same time -- something an automated scraper would be.

Firefox + Chrome both lower the priority of background tabs, and may be doing other tricks so the background tabs can stick around and be switched to quickly.

Re:Detecting Chrome headless by Dolores12 on Sunday August 06, 2017 @02:58AM (#14940131)
Well, most of the time spiders are idle while waiting for IO operations to complete. Main bottleneck is not CPU, but RAM and bandwidth.
Re:Detecting Chrome headless by rileymat2 on Sunday August 06, 2017 @09:31AM (#14941225)
It depends on what analysis is being done on each page.
Re:Detecting Chrome headless by Dolores12 on Sunday August 06, 2017 @11:05AM (#14941580)
What kind of analysis are you expecting from a crawler which main purpose is to grab a webpage?
Re:Detecting Chrome headless by ivanhoe on Sunday August 06, 2017 @04:55PM (#14943479)
Main purpose is to render the page, crawl the dom for the data, and then load the next page as fast as possible... so it's equivalent of having a thousand bookmarks and opening them all at the same time, and as soon each loads running the scraper script and reloading them with the new link. Try it for yourself, it's easy to script, and check the load...
Re:Detecting Chrome headless by rileymat2 on Sunday August 06, 2017 @06:29PM (#14944045)
Presumably, there is some reason you are crawling.
Re:Detecting Chrome headless by MuffinFlavored on Monday August 07, 2017 @09:48AM (#14947378)
Where can I get a dedicated server with 128GB of RAM for $100-$200/mo?
Re:Detecting Chrome headless by jordanpg on Saturday August 05, 2017 @01:07PM (#14936670)
In addition to complicated, making things unpredictable makes things very difficult for programmatic scraping:

  * machine-generated HTML and CSS identifiers
  * randomly inserted, unused HTML elements
  * images instead of text
Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @02:45PM (#14937214)
To be honest (and speaking from experience), the only thing that would actually make life hard for a scraper is the last suggestion. I've never personally dealt with that, which is the only reason why I concede it.

Machine generated HTML is a pain, but I wouldn't call that "very difficult" - it's more like "annoying" in the same way that having to parse HTML instead of finding a neat JSON endpoint is.

And I'm not sure how randomly inserted HTML elements would help - if you're already parsing the HTML, you can extract the relevant data. Unless you're trying to parse the HTML with regex, in which case: https://stackoverflow.com/questions/1732348/regex-match-open...

Re:Detecting Chrome headless by ivanhoe on Sunday August 06, 2017 @05:49PM (#14943805)
The first two bullets combined can make it hard to parse the page reliably, but it's also making very hard the maintenance and using of any 'good' javascript and/or css too. Not worth the trouble usually.
Re:Detecting Chrome headless by ChrisSD on Saturday August 05, 2017 @02:57PM (#14937272)
In addition to dsacco's reply it should be mention that using images instead of text hurts accessibility and, depending on your industry and country, it may also run afoul of equal access laws.
Re:Detecting Chrome headless by ivanhoe on Sunday August 06, 2017 @05:44PM (#14943752)
Depending on a page and data it can make life a bit harder for the spider, but all that can be taken care of.

IMHO the best way to stop spiders is to control access to your pages. Require users to register and then login each time to see the data, and then have some pro-active monitoring & counter measures in place, monitoring the patterns per users, and per IPs, and across the whole system for an unexpected increase in activity or bot-like behavior (moving too fast or at unusually uniform speed, following links too sequentially, etc.).

If it's not an option, the next best approach is to make it hard for spider to fetch the whole dataset. Don't let user just browse all the pages, instead force them to use search, it makes it much harder to cover everything (and it will not affect normal users too much). You can, for example, return just the 100 products at once, and ask user to refine the search if there's more products than that. Then you can create some monitoring system to watch over unusual search queries that look like dictionary attacks. I've actually built a system like this for one client and it worked fairly well (combined with a few more tricks they were already using).

Of course, all of this can be tricked too, it's all a game of cat & mouse, trying constantly to outsmart the other side.

Re:Detecting Chrome headless by ris on Sunday August 06, 2017 @11:09AM (#14941593)
And there goes your accessibility.
Re:Detecting Chrome headless by hyder_m29 on Saturday August 05, 2017 @01:32PM (#14936800)
I don't believe Google's Recaptcha2 has been broken yet (at least not publicly). Though you can parcel it off to low wage workers who click on captchas all day long.
Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @11:35AM (#14936206)
Interesting. I've done a lot of scraping and I never did this. Do you have a treatise that explains how it's done? I've actually been experimenting with headless Chrome recently because I like it more than PhantomJS.

Practically speaking I don't think IP detection is useful at all these days, and the only Captcha that can't be bypassed is Google's most recent version. The much more successful anti-scraping tactic is to use a sophisticated reverse proxy that analyzes all requests to identify patterns and unusual behavior, indiscriminate from the IP source (because any large scale scraping will come from many IPs anyway).

Re:Detecting Chrome headless by pebers on Saturday August 05, 2017 @12:03PM (#14936336)
It's not terribly hard using Selenium; you can use one of their Docker images (e.g. selenium/standalone-chrome) and connect to that using Webdriver.

Having said that, it has flaws compared to headless Chrome (more moving parts, terrible security, extra memory usage / dependencies for the JVM to run Selenium) so unless that camouflage is proving crucial, I'd avoid it where possible. I've recently migrated a project to headless Chrome and definitely prefer it.

Re:Detecting Chrome headless by taeric on Saturday August 05, 2017 @02:37PM (#14937182)
I'm curious on what makes the security worse. The rest, I can see. Though, I have to confess I have been more critical of the whole headless browser binary push than I'd care to acknowledge. I just feel like this is solving a problem that didn't actually exist anymore. Selenium has worked solidly for quite a while. And, you almost certainly should test in multiple browsers/scenarios.
Re:Detecting Chrome headless by pebers on Saturday August 05, 2017 @03:33PM (#14937454)
The main security issues I know of so far are:

  - Neither Selenium nor Webdriver (at least the Python client, but I assume others too) support HTTPS at all.
  - By default it opens browsers configured to accept any SSL certificate. I can see why that's useful for local testing, but it's a terrible choice to default to.
  - It logs way too much. Logs every keypress sent to it, including passwords.
At least the latter two are fixable, but not trivially so, and better defaults with easy client-side options to opt into insecure mode would have been much better. The former is not fixable without patching both the client and server and in 2017 it's pretty poor to not even have an option for.
Re:Detecting Chrome headless by taeric on Saturday August 05, 2017 @05:31PM (#14938028)
Odd, I'm pretty sure both of the first two are wrong. We used to have to make sure we had legit certs for selenium to work with https. That or configure the Firefox profile to have already accepted the self signed one.

And, really, the first two points are clearly contradictory. I'm guessing I just misunderstand what you mean?

Do you mean the communication between the driver? I'm curious why ssl would be important there? Should just be done locally and a standard ssh tunnel can help with any remote encryption you might want.

Re:Detecting Chrome headless by pebers on Sunday August 06, 2017 @06:22AM (#14940726)
The first two are not contradictory, the first refers to communication between the client and server and the second to the browser's communication with a remote server. Maybe that wasn't clear from how I wrote it.

On further investigation, I think I was wrong on the second though; it might be that it's built into Chromedriver, not Selenium, which would explain why you didn't have the same issue with Firefox.

SSL between the client & Selenium server would be of benefit to keep any bad actor on the network from man-in-the-middle attacks on it. I'm not familiar with how I'd set up an ssh tunnel for that, I'm happy to believe it can be done, but it'd be a lot easier if it just supported HTTPS to begin with.

Re:Detecting Chrome headless by taeric on Tuesday August 08, 2017 @01:28PM (#14960161)
Apologies, I should have relaxed more of my verbiage. I was writing on my phone, and only about halfway through my post did it "click" what you meant.

HTTPS would be an odd choice, if only because I don't want to do any cert management for my selenium test runner. An encrypted channel makes some sense, but I'm not sure what the best mechanism for the shared secret would be. Ssh kind of gets you there, but is not as straight forward, as you ntoed.

Instead, I'd urge to keep the communication at localhost (or tunneled over SSH, at worst). Preferably with a locked down security model on the network so that you will see any traffic going off.

Re:Detecting Chrome headless by figgis on Saturday August 05, 2017 @09:41PM (#14939205)
We both must be misunderstanding, because those first two points are blatantly false as far as I can tell. Selenium can handle(?) invalid SSL certs but the defaults certainly don't freely accept them.

As for the third point.. That's why we have DMZ's..

Re:Detecting Chrome headless by kuschku on Saturday August 05, 2017 @08:25PM (#14938902)
> and the only Captcha that can't be bypassed is Google's most recent version

That can also be easily bypassed (I’ve done that, without actually planning to do so) if you can make your behaviour seem completely human.

So if you have a bot that can browse in a way that seems statistically human you can actually get around that. You can still scrape the same datasets – you just need to keep instances of bots, with all cookies around, and have them browse in certain ways. Classify what category a site might likely belong to, put them into buckets of queues, and have bots pull from queues they’re likely to browse, or search for certain terms they’re likely to search for.

In my case, this all happened by accidents – I had IRC bots for a few channels, each kept a perpetual session and would visit every site that was linked (to get the title) and would be able to search Google by scraping. One day I was accessing a bot remotely, and told it to access a page that was NoCaptcha protected (because the site wasn’t working on my home system), yet it passed the captchas perfectly fine. Tried a few more times, always worked. So I tried figuring out why it worked.

Re:Detecting Chrome headless by _e on Saturday August 05, 2017 @11:07PM (#14939462)
Were the irc bots able to render javascript or were the bots using a cli lib like python requests?

I thought that a client which doesnt run javascript would be a huge red flag.

Re:Detecting Chrome headless by kuschku on Sunday August 06, 2017 @08:44AM (#14941067)
They used Firefox with off-screen rendering, as otherwise they wouldn’t be able to get the title of many pages – even many blogspot blogs can’t be read without JS anymore.
Re:Detecting Chrome headless by heipei on Saturday August 05, 2017 @11:43AM (#14936235)
If you know how to interface with Chrome headless then you're 95% there already. Just run xvfb, start a Chrome instance on the DISPLAY with the appropriate flags (for exposing the debugging port) and you're done.
Re:Detecting Chrome headless by IgorPartola on Saturday August 05, 2017 @11:45AM (#14936247)
IP detection, especially IPv4, should still work fine because the cost to get a new IP will often outweigh the benefit of the scraping.

Having said that, just let them scrape?

Re:Detecting Chrome headless by jalfresi on Saturday August 05, 2017 @12:32PM (#14936501)
There exists an entire industry that provide rotating IPs across fleets of proxies for very cheap prices. Proxy services like this make it pretty much impossible to prevent scraping.
Re:Detecting Chrome headless by tyingq on Saturday August 05, 2017 @12:30PM (#14936492)
>Having said that, just let them scrape?

Depends on who you are. Hotel and airline websites, for example, are pummeled with scrapers wanting pricing and availability info. Letting them scrape with no limits is costly.

Re:Detecting Chrome headless by IgorPartola on Saturday August 05, 2017 @05:21PM (#14937979)
And why is that a good thing for them? I mean if they provided an API to get their pricing, wouldn't it be in their interest? Does anyone buy airline tickets from the airline website ever? I don't. I use sites like Expedia and Priceline. And if an airline is not listed or has shitty prices, I don't buy it. Wouldn't it be in their interest to be listed on there? Moreover, wouldn't they want the other companies to have similar API's to have dynamic pricing?

I get that at one point not having this info out there was a good thing for them. But now the car is out of the bag. You can't keep pretending that booking sites don't exist.

Re:Detecting Chrome headless by tyingq on Saturday August 05, 2017 @07:48PM (#14938717)
Lots of wannabe sites with heavy scraping, but no sales.

There are several airlines where 50+% of all sales are on their own website. Lowest distribution cost.

Re:Detecting Chrome headless by ValentineC on Sunday August 06, 2017 @12:21PM (#14941911)
> Does anyone buy airline tickets from the airline website ever?

All other things being equal, I will strongly prefer buying directly from the airline, because I've personally experienced the shifting of responsibility if things go wrong during a flight.

I've also been denied boarding (not in my home country) because the airline claimed that the OTA (Netflights) didn't pay for my ticket, leaving me to spend the night in the airport and having to book a one-way flight with a different airline the next morning.

That was a horrible experience I'm determined to not repeat.

Re:Detecting Chrome headless by vacri on Saturday August 05, 2017 @10:19PM (#14939302)
Adding to tyingq's comment, not all scrapers are efficient, either.

Also, if you don't have the rock-bottom cheapest prices, you may not want to cater to aggregators that promote those.

Re:Detecting Chrome headless by mateo411 on Sunday August 06, 2017 @01:57PM (#14942454)
People who have miles or points buy airline tickets directly from the airline.
Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @01:17PM (#14936719)
> Hotel and airline websites, for example, are pummeled with scrapers wanting pricing and availability info.

Yes, and they make it very cumbersome to discourage it. I've successfully written scrapers for airlines. It's significantly more difficult than crawling other websites for a few reasons:

1. Session management is wacky - they really like to manage state entirely through cookies, and you typically need to visit a specific set of pages in a specific sequence before you can access the resources you want, like the number of seats available or their prices.

2. Sessions have time limits because anyone who looks at the seats initiates a "soft" reservation on them (this works in a similar way for theatre, concert and movie seating).

3. You don't usually have nice JSON endpoints, so you'll be doing a lot of HTML parsing (which, given the type of HTML you encounter, can be hell).

Re:Detecting Chrome headless by tyingq on Saturday August 05, 2017 @01:24PM (#14936756)
>You don't usually have nice JSON endpoints, so you'll be doing a lot of HTML parsing

That is changing. Most scrapers haven't caught on, but the more modern things airlines are pushing out (their mobile sites and native mobile apps) often have really nice REST/JSON api interfaces. The scrapers are often still scraping the old desktop site which will be the last to get that underpinning.

Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @02:47PM (#14937231)
Yes, whenever I'm looking for a source to crawl I prefer mobile applications for precisely this reason. Request signing and certificate pinning are an upfront annoyance, but the maintainability is far higher.
Re:Detecting Chrome headless by heipei on Saturday August 05, 2017 @11:49AM (#14936262)
There are multiple ways to hide your IP for free: Public proxies, VPNs which are not so well-known, and lastly there is a wealth of browser extensions which aim at hiding your IP to some extent. This would be one example where your traffic will exit with actual users on consumer ISP lines: http://hola.org/
Re:Detecting Chrome headless by ficklepickle on Saturday August 05, 2017 @09:01PM (#14939071)
I'd say don't use Hola. They've had some issues, like selling their users bandwidth for botnets[1].

If you do some googling, you will see many reasons not to use that extension.

[1]http://www.theverge.com/2015/5/29/8685251/hola-vpn-botnet-se...

Re:Detecting Chrome headless by ant6n on Saturday August 05, 2017 @02:01PM (#14936964)
What about tor.
Re:Detecting Chrome headless by heipei on Saturday August 05, 2017 @02:26PM (#14937110)
TOR is an easy one to detect. Case in point: Try to browse the web with TOR and see how many CloudFlare captchas you have to solve in the first 10 minutes ;)

Also TOR has public lists of exit nodes (https://torstatus.blutmagie.de/), and unless you exit via a non-listed one you're trivially identifiable.

Lastly, TOR is rather slow, which prohibits using for large-scale scraping tasks. Plus you get switched around different exits and countries, which might break your scraping logic.

Re:Detecting Chrome headless by crtasm on Sunday August 06, 2017 @01:47PM (#14942401)
I believe you could use the ExitNodes option to only use a specific exit.

There's no such thing as an unlisted exit node, only unlisted entry nodes (bridges). I agree that Tor isn't a good choice for scraping.

Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @02:45PM (#14937221)
Tor would introduce pretty intolerable latency into a professional data crawling setup.
Re:Detecting Chrome headless by skinnymuch on Saturday August 05, 2017 @11:50AM (#14936269)
I'm thinking OP meant if you want to never be detected, but like you said, you usually never get detected anyway.

Bypassing captcha automatically or with captcha bypass services where you pay per captcha completion?

Re:Detecting Chrome headless by aleem on Saturday August 05, 2017 @01:09PM (#14936680)
The simplest and most effective trick is to have a link that is not visible to humans but only to crawlers. When an IP ends up on that link you know it's a crawler. You can then proceed to block it. A honeypot in other words.

Typically display none will do but you can also have white on white text with no tabindex or off screen absolute positioning, etc.

Re:Detecting Chrome headless by dsacco on Saturday August 05, 2017 @01:41PM (#14936849)
This is harder to do than you think. An industrious developer who works on these things will quickly notice that their distributed crawler has started failing, look through logs and ultimately identify the problem. Then they'll switch to another set of IPs and continue, this time without requesting that link. The other issue is that you need to set an explicit rule that is aware of how each and every API endpoint should be accessed, and whether or not it should logically be directly accessible.

I say this as someone who has had to combat this specific technique - I'd suggest that if you believe it works, it's probably because you saw obvious scraping activity stop when you did it, but you were never aware of the more professional scraping that adapted to it or was never caught by it in the first place.

Whenever I've scraped a website, I am extremely careful not to request more pages than I need. A better method for blocking them is to flag requests for resources that do not proceed in a logical manner. For example, if you have an API endpoint that displays the information scrapers want, that endpoint should have a specific "route" through the user interface. If you find requests directly to that resource without first proceeding through the typical UI flow, that is more accurate for identifying a scraper.

This is still not foolproof, because the scraper can just script requests to the requires series of pages in order. But it's a good start for getting rid of most scrapers. The most effective method for getting rid of scrapers is IP agnostic behavior analysis, because it can catch e.g. scrapers trying to parallelize requests that increment across a proxy farm or requests that don't obey typical behavior constraints in the UI.

Re:Detecting Chrome headless by chongli on Saturday August 05, 2017 @01:20PM (#14936735)
Be careful with that. Users with screen readers may fall into your trap.
Re:Detecting Chrome headless by stordoff on Saturday August 05, 2017 @08:02PM (#14938790)
Could you have the content of the page explain that its a bot trap (so screen reader users know its not worth visiting) and only block if, say, an IP visits it multiple times in a short window?

Wouldn't block specialised scrapers as they would know to avoid that URL/link (though they'd probably work it out anyway), but would still limit more broad crawlers.

Re:Detecting Chrome headless by downandout on Saturday August 05, 2017 @01:33PM (#14936808)
I do something similar to this on PPC campaigns, but not for the purpose of blocking IPs. Bots tend to come in waves from a given site. If more than X% of clients from a given referrer wind up on the fake link (or other techniques show that the clients are bots), my code can automatically suspend the display of ads on the offending site for a period of time. If it continually happens, then the site's owner is the likely culprit, so I have a threshold at which that site is automatically and permanently blacklisted from all of my campaigns.

I have found that advanced bot mitigation is the single most significant determining factor of PPC ROI, which is a sad commentary on the current state of the paid advertising ecosystem.

Re:Detecting Chrome headless by iagovar on Saturday August 05, 2017 @01:35PM (#14936822)
Can you comment more on the results? Like, how many of your clicks come from bots?
Re:Detecting Chrome headless by downandout on Saturday August 05, 2017 @01:57PM (#14936941)
Depends entirely on the niche and traffic source. I have abandoned some niches because even with automated, realtime suspension of campaigns/referrers, there were so many bots (more than 50%) that I couldn't make the niche profitable. There are two primary sources for bots that click on PPC ads: competitors looking to drain budgets, and site owners looking to profit by having bots click on their ads. The latter is the easiest to defend against, since you can simply blacklist their site(s), plus any other sites that are likely on the same server (fortunately, most criminals are pretty lazy/cheap in this regard). I know one marketer that auto-blacklists all domains that have private Whois information after 1 click, and he has done very well with that.

To answer your question, based on my personal experience, I'd say on average, for display campaigns (specifically not referring to Google search ads, which tend to have a lower percentage of bot traffic - while Bing is the Wild Wild West)...I'd say overall it's somewhere in the 30% neighborhood. Not all of those have malicious intent, but in PPC, every non-human click on your ads is malicious.

Regardless of niche, realtime bot mitigation is probably the best competitive advantage that one can have in the PPC arena.

Re:Detecting Chrome headless by iagovar on Monday August 07, 2017 @01:04PM (#14949081)
Jesus that's a lot! Did you tried with FB ads?
Re:Detecting Chrome headless by threatofrain on Saturday August 05, 2017 @01:19PM (#14936732)
That sounds like a great trick, but I'd want a solution against someone getting large swathes of IP's banned, because the bot crawled my site and posted the link somewhere.
Re:Detecting Chrome headless by dboreham on Saturday August 05, 2017 @01:45PM (#14936873)
Determining link visibility is a standard crawler thing. So you'd need to be way more clever than that to succeed against someone who is moderately clueful.
Re:Detecting Chrome headless by yes_or_gnome on Saturday August 05, 2017 @09:18PM (#14939131)
Safari has navigator.webdriver, and others will soon follow. The idea was first introduced as a Fx bug, but hasn't gone any where.

https://bugzilla.mozilla.org/show_bug.cgi?id=1169290

There's a webdriver protocol mailing list with a long thread that describes how it should be implemented and how people could avoid it; ex. recompile without the feature. I just can't find it right this minute.

Re:Detecting Chrome headless by baybal2 on Saturday August 05, 2017 @02:54PM (#14937261)
Yes, it will do nothing against sophisticated botters.

It has been a standard tactic to run browsers in purpose built VMs. The last bastion were smarter, more disruptive captchas and rendering performance profiling, but even that got grinded by now.

The situation is even more grave with mobile ads as you have zero opportunity to shove captchas, or rely on single unique per-system ID or cookie that was vetted outside of embedded webkit environment.

Re:Detecting Chrome headless by kccqzy on Saturday August 05, 2017 @06:27PM (#14938285)
I've done similar detections. Basically just use keyboard dynamics: by measuring the precise timing of keystrokes (key down, key up) you can tell if it is likely typed by a user manually.

I haven't done it but I think mouse movements could be used too. Add onMouseMove event listeners all over the page and see how they are triggered.

Re:Detecting Chrome headless by notgood on Saturday August 05, 2017 @06:53PM (#14938414)
Yeah, that's why I use Math.random() * 5 and similar stuff in my scrapers.

A lot of people access the web through smartphones so only allowing people with mouse movements seems a bit overkill.

Re:Detecting Chrome headless by amelius on Saturday August 05, 2017 @02:33PM (#14937145)
Do you also use OCR?

Because I guess you could defeat webscrapers by making the HTML structurally totally different from what is visually present in the browser window.

Re:Detecting Chrome headless by kbutler on Saturday August 05, 2017 @05:56PM (#14938133)
As has been mentioned elsewhere in the thread, you need to be careful about accessibility and screen reader access.
Re:Detecting Chrome headless by tehlike on Sunday August 06, 2017 @03:13AM (#14940162)
There is a sevice for solving captchas. Death by captcha is one
Re:Detecting Chrome headless by feelin_googley on Saturday August 05, 2017 @07:05PM (#14938476)
Long time ago we used Crowbar with xvfb. Nice to see the same method still works.

http://web.archive.org/web/20121127001253/http://simile.mit....

Re:Detecting Chrome headless by feelin_googley on Saturday August 05, 2017 @05:04PM (#14937889)
Long time ago we used Crowbar with xvfb. Nice to see the same method still works.

http://web.archive.org/web/20121127001253/http://simile.mit....

Re:Detecting Chrome headless by feelin_googley on Saturday August 05, 2017 @07:10PM (#14938504)
One can also use a microcontroller such as Teensy to script timed keyboard and mouse action.

Demonstrations have usually been by security researchers, but these tiny boards can be used wherever one wants to avoid the labor of repetitive navigating, typing and mouse clicking.

http://samy.pl/usbdriveby