Malware that redirects every visitor is noisy.
Customers complain. Administrators can reproduce the problem. Search engines, hosting providers, security researchers, and automated scanners have more opportunities to encounter the same malicious behavior.
Selective execution gives an attacker another option.
A compromised website can evaluate the visitor and decide whether exposing the malicious behavior is worth the increased chance of detection.
Depending on the campaign, that decision can involve characteristics such as:
- geographic location;
- browser or device type;
- operating system;
- HTTP User-Agent;
- referral source;
- search-engine traffic;
- cookies or previous visits;
- session state;
- interaction with the page.
Several conditions can also be combined.
An employee visiting the website directly from an office desktop may therefore receive the legitimate page while a customer arriving from search on a mobile device is redirected elsewhere.
The website is the same domain.
The experience is not necessarily the same.
The website can evaluate the scanner tooWebsite scanning is often imagined as a one-way process:
scanner → website → resultModern web applications complicate the relationship.
The website can also observe characteristics of the system examining it.
JavaScript can expose properties of the browser environment. Servers can evaluate network, geographic, header, and session information. Referral data can show how the request arrived. Cookies and browser storage may reveal whether the visitor has been there before.
A malicious system can use those signals to make another decision:
Does this visitor resemble the person we want to attack, or the security system we want to avoid?That makes detection an adversarial problem.
The security system is trying to determine what the website does.
At the same time, the malicious website may be trying to determine who is looking.
Security research has measured the problemAcademic research has demonstrated how practical this can be.
At USENIX Security 2021, Bhupendra Acharya and Phani Vadrevu presented
“PhishPrint: Evading Phishing Detection Crawlers by Prior Profiling”.
The researchers evaluated 23 security crawlers and identified weaknesses that could reveal automated visitors through browser characteristics and fingerprinting behavior. They then deployed 20 test pages designed to exploit the weaknesses they found.
Eighteen remained accessible despite aggressive reporting to the crawler services.
The study concerned phishing detection rather than compromised business websites, but the defensive problem applies more broadly: if an attacker can distinguish an automated security visitor from the intended victim, it can decide to serve each of them something different.
Two years later, Iskander Sanchez-Rola, Leyla Bilge, Davide Balzarotti, Armin Buescher, and Petros Efstathopoulos presented
“Rods with Laser Beams: Understanding Browser Fingerprinting on Phishing Pages” at USENIX Security 2023.
Their study analyzed more than
1.7 million phishing pages over 21 months. More than one in four of the analyzed pages used some form of browser fingerprinting.
Fingerprinting itself is not malicious. Legitimate websites use browser and device information for many valid reasons.
The security problem appears when the same information is used to answer a different question:
Should this visitor see the malicious experience?Researchers examined another variation at USENIX Security 2024.
In
“PhishDecloaker: Detecting CAPTCHA-cloaked Phishing Websites via Hybrid Vision-based Interactive Models”, Xiwen Teoh, Yun Lin, Ruofan Liu, Zhiyong Huang, and Jin Song Dong studied phishing sites that placed CAPTCHA challenges between automated crawlers and the actual malicious content.
Their research showed that CAPTCHA cloaking could severely reduce the effectiveness of existing detectors until the security system was able to interact with the page more like a real user.
Again, the specific research domain was phishing.
The broader lesson is about
observation: reaching the correct URL does not guarantee that an automated system has been allowed to see the same experience presented to the intended target.