11 Networkattacks Notes
11 Networkattacks Notes
These notes were scribed by students in CSE 127 during Winter 2021. They
have been lightly edited but may still contain errors.
1 Introduction
These are three basic security properties that come up often in classical infor-
mation security. They are often referred to the CIA triad.
Network attacks can be categorized into a few broad types as listed below
from most local to least local:
Here are the layers of the OSI model that we’ll be focusing on:
1
4. Data Link (e.g. Ethernet, WiFi, ARP)
5. Physical (e.g. physical wires, photons, RF modulation)
Each layer is vulnerable to its own classes of attacks and layers can sometimes
interact with each other.
2
Figure 2: A photo of a room used by
the NSA to spy on traffic handled by
AT&T in the same building Figure 3: Fiber splitters used by the
NSA to intercept network traffic
3
Figure 4: Snowden document on program Prism, 3rd slide
Figure 5 is an photograph taken by artist Trevor Paglen, who has done a lot
of really interesting art on government surveillance. To take this photograph,
4
he studied leaked NSA documents to figure out which undersea cables had
been tapped by the NSA, studied publicly available documents to locate these
tapped cables on the sea floor, and learned to deep water dive to find the cables
themselves on the sea floor.
This photograph reminds us that the Internet is a collection of physical
objects. Traffic we send crosses thousands of miles of physical cable, some of
which may be at the bottom of the ocean. These cables can get dragged up
by currents, broken by boat anchors, or damaged in any number of ways. The
physical manifestation of the internet as cables and routers and other physical
network infrastructure means that we cannot entirely eliminate the possibility
of physical taps or disruption.
2.2 Injection
Injection is an active form of attack that takes place on the physical and link
layers. Since Ethernet packets are unauthenticated, attackers can send valid
packets with any source, destination, or MAC address information they like.
Using this to their advantage, a potential attacker can impersonate anybody on
the network. These types of attacks violate network integrity.
5
2.3 Jamming
Jamming is an attack that prevents signals from reaching their destination.
Jamming attacks violate the goal of availability.
Since the network must interact with the physical world to function, it can
be subject to jamming. Jamming over a physical medium of the network such
as an Ethernet cable can occur when the signal is overwhelmed or disrupted
by some outside source. Likewise, radio communications such as WiFi can be
jammed by overwhelming the frequencies it is broadcast on.
3 Network threats
3.1 Spoofing
As with Ethernet packets at the link layer, IP is vulnerable to injection at the
network layer. The source and destination addresses of IP packets are com-
pletely arbitrary and can be set to anything without verification. An attacker
can take advantage of this by creating a situation where a phony packet “races”
a legitimate packet to respond to a request. This is called spoofing.
An example of an application protocol that is vulnerable to such spoofing is
DHCP. If a client sends a packet requesting a DHCP configuration from a local
server, an attacker on the same network can send a response forged to look as
if it’s from the DHCP server. This allows the attacker to trick the client into
setting its network gateway and DNS server to hacker-controlled values. The
attacker can then resolve hostnames asked for by the client to whatever they
want. From here, the attacker can reroute traffic intended for legitimate hosts
to the themselves.
6
in response. A scanner can easily enumerate all 216 port numbers on a single
machine. Nmap is a popular tool for doing this.
It is also possible for network scanners to enumerate all 232 possible IPv4
addresses to find un-advertised services. Zmap and Shodan are examples of
tools that scan the publicly visible internet for services running on particular
ports. Researchers use these tools to understand network usage and patterns.
If you’ve ever run an ssh server, you have probably observed attackers using
network scanning to find ssh servers to attempt to brute-force passwords on.
In 2018, an attacker used network scanning to cause 50,000 printers print a
message telling them to “Subscribe to PewDiePie” and that their printer was
“exposed to the internet” urging them to “please fix that”. [1]
3.3 Misdirection
Misdirection means causing network traffic to be sent to the wrong location.
The BGP protocol is unauthenticated, and has permitted a number of such
attacks on the real internet. Recall that the BGP protocol is how ASes learn
routes to IP prefixes over the internet. ASes will advertise routes to prefixes
that they learn about, and each AS will choose the path that is optimal for it
given its constraints. Route changes propagate over the network. This is the
intended functionality: we want the internet to be able to adapt to changes like
parts of the network going down or new routes being added. The weakness of
this system is that routes are not authenticated, allowing malicious or incorrect
routes to be propagated by a bad BGP node.
A famous instance of BGP hijacking was in 2008, when the government of
Pakistan required the national ISP to block a YouTube video. They responded
to this request by having their BGP servers route YouTube’s IPs to a location
that doesn’t accept network traffic (a black hole). Because they used BGP to
do this, other BGP nodes outside of Pakistan began to propagate this black
hole for YouTube. This resulted in all of YouTube’s global traffic being routed
through Pakistan, effectively crashing Pakistan’s internet and making YouTube
unusable until the routing information was corrected.
7
BGP hijacking can be less noticeable as well. Here is an example from a
report by Renesys that documented cases of BGP routes sending traffic through
unusual paths across the world. The speculation was that these hijacked routes
were propagated by parties or governments interested in spying on traffic that
they would otherwise not have had access to.
There have also been several documented cases of BGP hijacking attacks
used to steal cryptocurrency.
Figure 7: Traffic from Denver, Colorado to Denver being routed through London
and Reykjavik, Iceland [2]
4 TCP threats
Recall that Transmission Control Protocol (TCP) sessions are identified by a
source address, source port, destination address, and destination port, and that
each TCP packet contains a sequence number that determines where in the
stream it belongs. Attackers can exploit these pieces of information to tamper
with TCP connections.
One way an attacker can tamper with a TCP connection is called on-path
injection.
An example of an on-path injection attack is connection hijacking. Con-
nection hijacking is an attack where an on-path attacker injects data into a
TCP connection by sending packets with the same port and sequence number
as legitimate packets for the TCP session. In this scenario, since the attacker is
on-path, the attacker is able to see the port numbers and sequence addresses of
the current stream, and can construct their own packets with malicious payloads
to inject into the stream with the fully correct values.
Another example is RST injection, where the attacker injects a reset (RST)
packet to close the connection. This reset packet will always be accepted by
8
the network if the sequence number is within the acceptable window. China’s
Great Firewall uses RST injection to block traffic for Chinese Internet users.
9
upon inspection. It works by sending a packet to an IP address that accepts TLS
connections for multiple domain names. The outer, unencrypted “handshake”
portions of the connection appear to be requesting a connection to a non-blocked
site, but then the inner encrypted HTTP request will include a GET request
for a blocked site.
A famous incident of domain fronting occurred in 2015 when GreatFire.org
was targeted by the Great Firewall of China for using domain fronting on Ama-
zon CloudFront and GitHub.
China was unable to block GitHub without causing problems for their tech-
nology industry, so they wanted to force CloudFront and GitHub to take down
GreatFire.org’s content themselves. To do this, the Chinese government adopted
a new active technique to mount a Distributed Denial of Service (DDoS) attack
against GitHub and CloudFront. This was called the “Great Cannon”. In this
attack, the Great Firewall used TCP injection to inject a JavaScript payload
into requests for Baidu, a Chinese search engine, that would cause a fraction
of Baidu visitors from outside China to send unwanted traffic to GitHub. This
DDoS attack continued for five days before they stopped.
10
Figure 10: Process of opening a TCP connection
11
5.1.2 Local/On-Path Attacker
Recall that an on-path attacker can see and add packets, but cannot block
packets. The original DNS specification is not authenticated by default. This
gives on-path attackers an opportunity to impersonate a DNS server and send
fake responses.
The victim first visits the attacker’s website where they download a malicious
JavaScript script. The script causes the victim to make a bunch of DNS look up
queries for various subdomains of the bank’s website. If the user browser makes
at least 256 queries and the attacker simultaneous makes at least 256 responses
with a random query ID to the local DNS server, there is a good chance that
one of the query IDs will match. This works because if the victim is relying on
216 = 65536 √ possible random values and an attacker is sending values at the
rate of the 216 = 28 = 256 the attacker has a 50 percent chance of success by
the Birthday bound.
12
One way to mitigate this is to add another 16 bits of randomness by ran-
domizing the source port of the DNS query from the user.
Figure 12 outlines the process of DNS hijacking with the Kaminsky attack.
Defenses against this attack include doing DNS queries inside of encrypted pro-
tocols (TLS or HTTPS) to provide authentication and privacy for queries.
6 Conclusion
The Internet was build built on top of protocols that assumed trustworthy
network operators. This has allowed a number of clever attacks abusing the
protocols in ways that were never expected by their designers, and which have
caused problems for decades. There are countermeasures in place against many
of the attacks we have discussed. The most effective ones use cryptography.
References
[1] Patricia Hernandez. Someone hacked printers worldwide, urging people to
subscribe to pewdiepie. The Verge, Nov 2018.
13
[2] Andrea Peterson. Researchers say u.s. internet traffic was re-routed through
belarus. that’s a problem. The Washinton Post, Nov 2013.
14