Professional Documents
Culture Documents
We first outline how the WiSC system works (§2.1). We then explain
② ⑥
Consistency
in detail our detection schemes for LAN (§2.2) and WAN (§2.3) Checking ③ Transport-layer
Detection
Upload
attacks. Finally, we describe our large-scale deployment (§2.5).
⑤ ⑤
Detection Result Detection Result
2.1 WiSC System Overview
LAN Attack Detection Log & Encrypt WAN Attack Detection
To address the three design challenges mentioned in §1, we develop Client
a novel two-stage pipeline to detect the abovementioned LAN and WiFiManager
Transport-layer
Send ST TCP Decoys Send SD DNS Decoys Detection Notation Definition
𝑆𝑇 Amount of TCP decoys sent to the AP
≥RT ≥RD 𝑆𝐷 Amount of DNS decoys sent to the AP
Responses? Responses? 𝑅𝑇 Threshold for the amount of TCP decoys’ responses
𝑅𝐷 Threshold for the amount of DNS decoys’ responses
Suspicious Else Both Are No 𝑃𝑚 Probability of receiving responses from a malicious AP
𝑃𝑏 Probability of receiving responses from a benign AP
Application-layer 𝑅 Amount of received responses
Detection P(𝑅 ≥ 𝑘) Probability of an AP’s requiring app-layer scrutinizing
Checking Our Checking DNS P(𝑅 = 𝑘 | ○
+) Probability of receiving 𝑘 responses for a malicious AP
Web Page Responses P(𝑅 = 𝑘 | ○
- ) Probability of receiving 𝑘 responses for a benign AP
Percentage of APs
10% 4%
Percentage of APs
Estimated Recall
False Positive
Estimated Recall
95%
False Negative
% of APs Requiring 95% 8%
10% App-layer Scrutinizing 10% 3%
Estimated Recall 6% False Positive
90% 90%
False Negative 2%
5% 8% 4%
85% % of APs Requiring 85% 1%
App-layer Scrutinizing 2%
Estimated Recall
0% 80% 6% 80% 0% 0%
1 2 3 4 5 6 7 8 1 2 3 1 2 3 4 5 6 7 8
RT RD RT
Figure 6: % of APs that need app-layer Figure 7: % of APs that need app-layer Figure 8: False positive and false nega-
scrutinizing, and estimated recall for scrutinizing, and estimated recall for tive rates for different TCP thresholds.
different TCP thresholds. different DNS thresholds.
1.5% 10%
TP-LINK Phicomm
8% MERCURY TP-LINK
False Positive
False Negative
False Positive
1% FAST Tenda
False Negative
6% Tenda MERCURY
HUAWEI FAST
4% Private Private
0.5% Phicomm Huawei
2% ZTE ZTE
China Mobile Fenglian
0% 0% Xiaomi Reijie
1 2 3
RT 0 1 2 3 4 5 6 7 0 1 2 3 4
Number of APs 10 6 Number of APs 10 5
Figure 9: False positive and false nega- Figure 10: Top 10 WiFi AP brands or- Figure 11: Top 10 AP brands ordered by
tive rates for different DNS thresholds. dered by the number of examined APs. the number of malicious APs detected.
With Eq. (1) (3) and the values of P(𝑅 = 𝑘) from our empirical data, these IP addresses have been publicly reported as malicious, 2) they
we can solve that 𝑃𝑚 = 98%. This is generally consistent with the are private IP addresses, and 3) they are identical, all of which should
measurement result in prior work [37]. As shown in Figure 6, 𝑅𝑇 = 5 not be observed in benign DNS interceptions.
is empirically a “sweet spot” as it efficiently filters out 96.6% APs For TCP hijacking, we perform the detection at the web page level.
while incurring little loss of recall. Specifically, we host an instrumented decoy web page on WiSC’s
For 𝑅𝐷 (the DNS case), we apply the same mechanism and find server, and let the client query for it. To detect attacks, a direct
𝑃𝑚 = 94.12%. Figure 7 shows the corresponding recall and 𝑅𝐷 = 2 method is to compare the received web page at the client with the
is found to be a proper balance for our tradeoff. original one. However, this can have false positives when legitimate
log-in web portal exists. To rule out these cases, we insert 256-bit
2.3.3 Application-Layer Detection. After the transport-layer de- random strings into the HTML of our web page as its “fingerprints.”
tection, the set of suspicious APs for TCP/DNS hijacking behaviors By checking the fingerprints, we can have high precision in detecting
may have false positives. For example, possible benign intercep- the attacks that do not completely replace web pages but only modify
tions of APs that intercept and respond to users’ packets in a similar them, e.g., inserting new content [60]. In the design of our web page,
way as that in adversaries’ attacks. Besides, ISPs may implement we also insert HTTPS links to capture HTTPS-targeted attacks like
DNS interceptions [41] for routing optimizations. To rule out these SSLStrip [65], which undermines HTTPS by replacing HTTPS links
possibilities, we further employ two scrutinizing strategies at the in web pages with HTTP links.
application layer for confirming TCP and DNS hijacking behaviors
respectively. Note that the trade-off here is that we conservatively 2.4 Evaluation
determine an AP as benign as long as we do not detect application-
layer attacks, which is thus able to avoid false positives but can Setup. To evaluate WiSC’s performance (in terms of false positive
introduce some false negatives. and false negative rates), we conduct controlled experiments by
For DNS hijacking, we examine the received resolution results respectively replaying the targeted attacks (i.e., ARP/DHCP spoofing
of our DNS decoys (if any). Recall that the decoys’ carried domain and TCP/DNS hijacking) on 10 APs of different brands (as listed in
names are randomly selected from a list of popular websites. Thus, Figure 10) and detecting them with WiSC. For environment settings,
for the suspicious APs, we determine them as malicious if the re- we setup our experiments in a campus area where 5 WiFi signals
solved IP addresses conform to any of the following 3 criteria: 1) simultaneously exist (a common scenario in public places according
to WiFiManager’s user data); all the signals lie in different channels Table 2: Top 15 countries ordered by the number of examined
so that they do not pose direct interference to each other. WiFi APs.
Percentage
0.8
CDF
40% 60%
50% 0.75
30% 40%
0.7 Benign
30%
20% ARP Spoofing
20% 0.65 DHCP Spoofing
10% 10%
0.6
0% 50 100 150 200 250 300 350 400
0% Support Default to Enable Proper HSTS
Poor Average Good Excellent HTTPS HTTPS HSTS Configuration LAN Latency (ms)
Figure 12: Internet connectivity for APs Figure 13: Status quo of top websites’ Figure 14: Connectivity for benign APs
with strong and weak/no encryption. HTTPS/HSTS adoption in China and and APs under spoofing attacks.
the US.
0.95 1 1
CDF
0.85 0.6
CDF
CDF
Median = 0.11
0.8 0.4 0.4
Mean = 0.17
DNS Hijacking Benign APs Max = 1
0.75 TCP Hijacking 0.2 0.2
APs under WAN Attacks
Benign APs under LAN Attacks
0.7 0
0 0 0.2 0.4 0.6 0.8 1
50 100 150 200 250 300 350 400 0 400 800 1200 1600 2000
LAN Latency (ms) Movement (m) Frequency of Injecting Ads
Figure 15: Connectivity for benign APs Figure 16: Physical movement of benign Figure 17: Frequency of attackers in-
and APs under hijacking attacks. APs and malicious APs. jecting ads to victims’ web pages.
distribution of the detected WiFi attacks in China, we confirm that supported in both countries, quite a few websites do not use HTTPS
WiFi attacks pervasively exist in almost all areas across the country, as default. Besides, more websites (60% in China and 36% in the
without being confined to specific areas or ISPs. Also, the density of US for the top 100 websites) do not enable HSTS (HTTP Strict
attacks is basically proportional to the population density. Transport Security [30]), leaving themselves vulnerable to HTTPS
downgrade attacks such as SSLStrip.
3.2 WiFi-based Attack Techniques Worse still, even for those websites who have enabled HSTS, we
The WiFi-based attack techniques used in the wild are found to be notice that the vast majority of them (92.5% in China and 78.1% in
heterogeneous and somewhat unexpected. The ratios of the four the US for the top 100 websites) fail to properly configure HSTS
attack techniques WiSC can detect are: TCP hijacking (57%), DNS parameters (e.g., timeout threshold and preload list), rendering HSTS
hijacking (17%), ARP spoofing (16%), and DHCP spoofing (12%). ineffective in practice. For example, TMall [83], a major online
Multiple attack techniques can happen to one AP, so their percent- shopping platform in China, configures its HSTS timeout threshold
ages add up to more than 100%. Although the techniques themselves as zero, resulting in an immediate expiration of HSTS upon accesses,
have all been studied in prior work [2, 17, 41, 72], we have several thereby letting HSTS be completely bypassed.
findings that are unknown or significantly different. In terms of LAN attacks, recall that WiFiManager helps user
First, we observe that TCP hijacking accounts for over a half of devices examine their connectivity (LAN connectivity) with APs.
the detected attacks. This can be attributed to TCP’s dominating use Specifically, it measures the connection latency on a user device by
today for Internet applications, and the attackers’ strong capability periodically pinging the gateway. Figure 14 and Figure 15 depict the
in undermining TCP connections or even encryptions. In principle, distributions of connectivity for benign APs and the APs under dif-
the increasingly wide deployment of HTTPS across the globe should ferent attacks. As shown in Figure 14, both spoofing attacks are more
be able to provide protection against TCP hijacking. However, our detected on the APs with poorer LAN connectivity, because they can
results clearly indicate that such attacks are still rampant. succeed more easily under worse LAN environments, which allow
To deeply understand the situation, we further measure the HTTPS spoofed responses to reach user devices faster than the legitimate
adoption in the wild, and reveal a staggering lack of effective HTTPS ones. Interestingly, Figure 15 makes an opposite observation: DNS
deployment in many countries. Figure 13 shows the case of top and TCP hijacking attacks are more likely to occur on good network
100 and top 10,000 websites in China and the US according to the conditions. We will elaborate this in §3.3.
Alexa Traffic Ranking [5]. We find that although HTTPS is widely
In previous studies, DHCP spoofing was mostly a hypothetical of 724 m, average of 47.3 km) than APs under WAN attacks and
attack under WiFi networks, since all DHCP Discovery messages benign APs (median of 31 m and 21 m, average of 20.4 km and
must be first sent to and then broadcast by the AP. Thus, the AP 20.5 km, respectively). Here the average is much larger than the
should be able to respond to such messages more quickly than adver- median due to the existence of mobile APs such as smartphone-based
saries [56, 87], rendering any spoofed DHCP Offer messages invalid. hotspots, and small movements (<50 m) are mostly due to user-side
However, our observation refutes this by revealing that DHCP spoof- localization errors. We attribute this phenomenon to our observation
ing is as feasible as other popular techniques in practice. We suspect that ARP/DHCP spoofing attacks are more likely to succeed under
that the attackers adopt some extreme strategies, such as flooding poor LAN environments (see Figure 14), which can be more easily
DHCP Offer messages, to practically increase the success rate. Such noticed by network administrators and then get fixed, compared
strategies can be especially effective when the LAN connectivity is to the finer networks of WAN-based attacks. Thus, attackers need
poor (also suggested by Figure 14). to strategically relocate (similar events have been noticed in other
To sum up, the root cause of ARP/DHCP spoofings lies in the attacks [39]) to better success and evade detection. Notably, we find
AP’s unconditionally forwarding all the broadcasts within the LAN, that 10% of the APs under LAN attacks even manifest a clear pattern
which conforms to the design of Ethernet for historical reasons, and of shifting around several locations, forming one or multiple loops.
can be thoroughly address them by performing packet checking or Next, we go deeper into the most detected events—ad injections,
encryption at the AP, e.g., through S-ARP [13] and DHCP snoop- and make several intriguing findings. We discover that the injected
ing [2]. However, they can also incur non-trivial storage/computation ads are not deliberately hidden through techniques like impression
overhead since they rely on recording all DHCP traffic or asymmet- fraud [76], although in this way adversaries can better cover them-
ric cryptography, which may incur additional attack surfaces and are selves up to avoid being directly captured by users. This is probably
impractical for residential APs with low-cost hardware. because advertisers require ads to be explicitly displayed for achiev-
An alternative may be MAC-forced forwarding [44] that enables ing real advertising effect. This suggests that there might exist an
an AP to recognize ARP/DHCP messages within the LAN, and ecosystem behind these widespread AP-based ad injection activities,
selectively forward them instead of simply broadcasting them all. In thus motivating us to dig deeper in the next section.
fact, this technique has been deployed in some public places (e.g., More surprisingly, ad injection is detected on 2.33% of the APs
metro stations) to defend against spoofing [89]. In our data, we find using strong encryption (WPA/WPA2) while on 1% of the APs us-
that 3,208 APs are using this technique, and the MAC addresses for ing no or weak encryption (WEP). Our investigation sheds light
all the connected user devices within the LAN obtained by ARP on this counter-intuitive observation. WiFiManager measures the
requests are exactly the gateway’s MAC address, indicating that Internet connectivity of an AP when checking its LAN connectivity
all ARP traffic within the LAN has been explicitly directed to and (§3.2). The result falls into four categories: Excellent, Good, Average,
managed by the AP (gateway). It is encouraging to see that no Poor, representing that in monthly examinations, >90%, 70%∼90%,
spoofing attack was detected on any of these 3,208 APs. 50%∼70%, <50% connections can be established, respectively. Fig-
ure 12 shows that better protected APs tend to have better Internet
3.3 Malicious Behaviors and Objectives connectivity, thereby providing a better network environment for per-
forming ad injection. The above results probably indicate that solely
Our measurement collects 1.4M attack event traces, including both relying on strong link-layer cryptography may be ineffective against
transport- and application-layer responses for detailed attack behav- complex real-world threats, whose mitigation requires a cross-layer
ior analysis. We make several interesting observations regarding the approach spanning multiple dimensions including encryption, au-
“semantics” of such attacks. thentication, protocol verification, human factor, to name a few. For
• First, we analyze the collected web pages, and notice that 55% of example, mitigating the ad-injection attack requires the synergy from
the attack events involve web pages being injected with advertise- secure app-layer protocol (e.g., HTTPS) and robust authentication
ments (ad injection) mainly through TCP hijacking. (e.g., dynamic authentication offered by 802.1X [16]).
• Second, 26% are typical DoS and passive traffic monitoring
through ARP/DHCP spoofing, where attackers manage to trick
user devices into recognizing their devices as the network gateway,
3.4 Fundamental Motives Behind the Attacks
thereby dropping packets or peeping at users’ network traces. According to our results, ad injection currently accounts for the
largest portion of the detected attacks events and thus has the broad-
• Third, we observe DNS hijacking where users’ DNS queries re-
est impact on end users. Also, user devices being injected with ads
ceive false resolution results, leading to potential phishing attacks,
can fall victim of various kinds of frauds and abuses, leading to
i.e., redirection to malicious websites elaborately disguised as the
possible severe outcomes. Therefore, in this section, we leverage our
originally requested ones.
in-situ attack event traces to understand the fundamental motives
• Fourth, HTTPS-targeted attacks such as SSLStrip are also identi- behind the AP-based ad injections. By analyzing the injection code,
fied, where HTTPS links have been surreptitiously replaced with we first observe that adversaries adopt various techniques to evade
HTTP links to compromise users’ encryption. common security checks, such as domain altering that constantly
The last two account for <8% of all attacks, which is much smaller changes ads’ domains to prevent security or ad-blocking software
than the percentages reported in prior studies [19, 28]. from recognizing them, and code obfuscation to hide the attack
Delving deep, as shown in Figure 16, we notice that APs under logic. Clearly, the attackers are trying hard to conceal their malicious
LAN attacks exhibit much longer physical movements (median activities while profiting by (visible) ad impression.
60% 100% 1.8
Ad-injection Probability = 0.15
Percentage of APs
Percentage of APs
% of Recovered APs 1.5 Relative Profit = 1.63
Relative Profit
50% Fitting Curve 80%
40% 1.2
60%
30% 0.9
40% 0.6
20%
20% % of Recovered APs 0.3
10%
Fitting Curve
0% 0% 0
0 2 4 6 8 10 12 14 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
t (week) Probability of Injecting Ads Probability of Injecting Ads
Figure 18: Percentage of APs that re- Figure 19: Percentage of recovered APs Figure 20: Our inferred profit model
cover through reset/upgrade for each influenced by ad injection probabilities that shows how the profit varies for dif-
week and our fitting curve. and our fitting curve. ferent ad injection probabilities.
Meanwhile, we find that a malicious AP only probabilistically we calculate the average ad injection probability for each week with
injects ads instead of compromising all intercepted web pages. As our dataset. Figure 19 then plots the percentage of recovered APs
shown in Figure 17, for 77% of the malicious APs, the ad injection (P𝐿 ) due to intentional defense actions for different ad injection
probabilities are below the average, 17%. We believe that qualita- probabilities, which exhibits the curve of an S-function [35]. Among
tively, this is because excessive ad injection can be easily noticed common S-functions, we find that the Bertalanffy function [86] can
by users, henceforth incurring AP reset, firmware upgrade, or even best fit our data with 𝑅 2 being 0.99:
disconnection, causing the attacker to lose the comprised AP. Nev- P𝐿 (𝑃𝑎𝑑 ) = 0.95 ∗ (1 − 1.99𝑒 −10.12𝑃𝑎𝑑 −0.67 ) 3, (5)
ertheless, we are more interested in the quantitative explanation:
for an injection probability 𝑃𝑎𝑑 . We therefore have the probability
how do attackers choose the injection probability (frequency) we
for an AP’s remaining malicious (P𝑚 ) at time 𝑡:
observe? Is it the result of a mature market’s selection or simply
the aggregation of random standalone cases? These are essential to P𝑚 (𝑃𝑎𝑑 , 𝑡) = (1 − P𝐿 (𝑃𝑎𝑑 ))(1 − P𝐹 (𝑡)). (6)
further decoding the WiFi attack ecosystem (if it exists). Suppose there are a total number of 𝑀 APs, each AP is in-
To answer the above questions, we analytically model the econ- jected with an average of 𝑁 ads, and each ad brings a unit profit of
omy behind ad-injection attacks. Instead of assuming a fixed number 𝑃𝑟𝑜 𝑓 𝑖𝑡𝑢𝑛𝑖𝑡 ; then the adversaries’ profit would be:
of malicious APs, we notice that more realistically, malicious APs Õ∞
are only under adversaries’ control for a period of time, before they 𝑃𝑟𝑜 𝑓 𝑖𝑡 (𝑃𝑎𝑑 ) = 𝑀 ∗ 𝑁 ∗ 𝑃𝑟𝑜 𝑓 𝑖𝑡𝑢𝑛𝑖𝑡 ∗ 𝑃𝑎𝑑 ∗ P𝑚 (𝑃𝑎𝑑 , 𝑡) (7)
gradually recover to the benign state—a dynamic process. Intuitively, 𝑡 =0
malicious APs’ recovery can be attributed to users’ intentional de- for injection probability 𝑃𝑎𝑑 . Although the exact values of 𝑀, 𝑁 ,
fense actions triggered by relatively high ad injection probabilities. and 𝑃𝑟𝑜 𝑓 𝑖𝑡𝑢𝑛𝑖𝑡 are unknown, we can know how 𝑃𝑟𝑜 𝑓 𝑖𝑡 (𝑃𝑎𝑑 ) varies
Moreover, the APs can also recover through users’ unintentional relative to 𝑃𝑟𝑜 𝑓 𝑖𝑡 (𝑃𝑎𝑑 = 1) for different 𝑃𝑎𝑑 values as:
actions, e.g., AP reset or firmware upgrade. We expect these two
factors to independently influence APs’ recovery. 𝑃𝑟𝑜 𝑓 𝑖𝑡 (𝑃𝑎𝑑 ) 𝑃𝑎𝑑 (1 − P𝐿 (𝑃𝑎𝑑 ))
To obtain the percentage of APs recovered through unintentional 𝑃𝑟𝑜 𝑓 𝑖𝑡𝑟𝑒𝑙𝑎𝑡𝑖𝑣𝑒 (𝑃𝑎𝑑 ) = = . (8)
𝑃𝑟𝑜 𝑓 𝑖𝑡 (1) 1 − P𝐿 (1)
actions (when ad injection probability is low), we choose to inspect
We plot 𝑃𝑟𝑜 𝑓 𝑖𝑡𝑟𝑒𝑙𝑎𝑡𝑖𝑣𝑒 (𝑃𝑎𝑑 ) for different 𝑃𝑎𝑑 values in Figure 20
the 35,782 APs that experience the lowest ad injection probability
to showcase how different ad injection probabilities impact adver-
(0.02) during our measurement to exclude the influence of high-
saries’ profit. As shown, the maximum profit appears at 𝑃𝑎𝑑 = 15%,
probability ad injections arousing users’ vigilance. We track their
which matches real-world adversaries’ choices (averaging at 17%).
recovery process for 14 weeks, and plot the percentage of recovered
With this finding, we suspect that most adversaries have carefully
APs (P𝐹 ) for each week (𝑡) in Figure 18. As an AP’s recovery is an
tuned their behaviors to achieve maximum profit in the long run.
independent and random event, we fit the measurement data using
In summary, we notice that most adversaries carry out ad-injection
Exponential distribution [10]:
attacks in a rather mature manner through rate throttling, which can
P𝐹 (𝑡) = 1 − 𝑒 −0.054𝑡 . (4) not only prevent users from easily noticing them but also maximize
We find that the coefficient of determination [46] is as high as (𝑅 2 ) their profits. The high consistency between our analytical results
0.89, suggesting that P𝐹 (𝑡) can well fit our data. and attackers’ real-world practices suggests these attackers are both
Recall that for all recovered APs, we divide them into two parts: judicious and rational, revealing a rather mature ecosystem, which
1) the APs recovered due to intentional defense actions, and 2) the we discuss next.
APs recovered through unintentional actions. Since we know the
number of all recovered APs (Part 1 + Part 2) for each week, we 4 UNDERMINING ATTACK ECOSYSTEM
can estimate the size of Part 1 by first approximating the size of In this section, we first describe how we figure out the underground
Part 2 with Eq. (4) and then removing it from the total size. Next, WiFi attack ecosystem. Then, we present the interplay among the
Table 3: Attackers that stop serving ads after our action.
Official Documents
Adversary % of All Ads Entity We Report to
t.7gg.cc 35.8% Baidu Analytics
Web Page Code Files Unknown hm.baidu.com Web Analytics 5myr.cn 8.9% OeeBee
Injected with (Obfuscated) Code
Collect agtsjb.com 8.7% UMeng/Adblock Plus
JavaScript Code 103.49.209.27 1.2% 360zlzq/Adblock Plus
(Two Code Files) Statistics
withad.com 0.4% UMeng/Adblock Plus
Display zfkmw.com 0.3% UMeng/Adblock Plus
js.union-wifi.com 0.06% 360zlzq/Adblock Plus
172.81.246.180 0.05% 360zlzq/Adblock Plus
Ad-injection Code Web Page with Ads