(Wireless network security - WEP, WPA, WPA2 encryptions)

46
Wireless Networks Security CSSE 572- Software Security Loizos Markides

Transcript of (Wireless network security - WEP, WPA, WPA2 encryptions)

Page 1: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wireless Networks Security

CSSE 572- Software SecurityLoizos Markides

Page 2: (Wireless network security - WEP, WPA, WPA2 encryptions)

IntroductionWireless networks broadcast their packets using radio frequency or optical wavelengths. A modern laptop computer can listen in, but also an attacker can manufacture new packets on the fly and persuade wireless stations to accept his packets as legitimate.

This presentation covers the following subjects:• WLAN Overview – Basic Concepts• The IEEE 802.11 Standards • IEEE 802.11 Security Measures • WEP Encryption and Related Attacks• WPA Encryption and Related Attacks• WPA 2 Encryption• Wireless Networks Best Practices

Workshop subject : How much time you need to crack into a WEP network?

Page 3: (Wireless network security - WEP, WPA, WPA2 encryptions)

Before we start…Who is a hacker?

(originally) Someone who makes furniture with an axe!

From the Jargon Dictionary (http://info.astrian.net/jargon/ ) • A person who enjoys exploring the details of programmable systems and

how to stretch their capabilities, as opposed to most users, who prefer to learn only the minimum necessary.

• One who programs enthusiastically or who enjoys programming rather than just theorizing about programming.

• A person capable of appreciating hack value.• A person who is good at programming quickly.• An expert at a particular program, or one who frequently does work using

it or on it.• One who enjoys the intellectual challenge of creatively overcoming or

circumventing limitations.

Page 4: (Wireless network security - WEP, WPA, WPA2 encryptions)

Before we start…Who is a hacker?

(originally) Someone who makes furniture with an axe!

From the Jargon Dictionary (http://info.astrian.net/jargon/ ) • A person who enjoys exploring the details of programmable systems and

how to stretch their capabilities, as opposed to most users, who prefer to learn only the minimum necessary.

• One who programs enthusiastically or who enjoys programming rather than just theorizing about programming.

• A person capable of appreciating hack value.• A person who is good at programming quickly.• An expert at a particular program, or one who frequently does work using

it or on it.• One who enjoys the intellectual challenge of creatively overcoming or

circumventing limitations.

Page 6: (Wireless network security - WEP, WPA, WPA2 encryptions)

WLAN Overview MAC Address, SSID and Channels

• Media Access Control (MAC) address:– The station and AP each contain a network interface that has a MAC address. – World-wide-unique 48-bit number. – Represented as a string of six octets separated by colons (00:02:2D:17:B9:E8). – Can be changed in software.

• Service Set Identifier (SSID):– Every AP has a SSID, which is used to segment the airwaves for usage.– If two wireless networks are physically close, the SSIDs label the respective

networks and allow the components of one network to ignore those of the other.

– It is possible that two unrelated networks use the same SSID.

• Channels– The stations communicate with each other using radio frequencies between 2.4

GHz and 2.5 GHz. – Neighboring channels are only 5 MHz apart. – Networks with neighboring channels may interfere with each other.

Page 7: (Wireless network security - WEP, WPA, WPA2 encryptions)

WLAN Overview Frames

Both the station and AP radiate and gather 802.11 frames as needed.

There are three classes of frames:•Management Frames: Establish and maintain communication

– Association request, Association response, Probe request, Probe response, Beacon, Announcement traffic indication message, Disassociation, Authentication, Deauthentication etc

– Management messages are always sent in the clear, even when link encryption (WEP or WPA) is used.

•Control Frames: Help in the delivery of data•Data Frames: Encapsulate the OSI Network Layer packets

– These contain the source and destination MAC address, the BSSID, and the TCP/IP datagram.

– The payload part of the datagram is WEP-encrypted.Image taken from http://www.cs.wright.edu/~pmateti/InternetSecurity/Lectures/WirelessHacks/Mateti-WirelessHacks.htm#_Toc77524650

Page 8: (Wireless network security - WEP, WPA, WPA2 encryptions)

WLAN Overview Authentication

Authentication is the process of proving identity of a station to another station or AP. •Open system authentication -> all stations are authenticated without any checking. •Shared key authentication -> standard challenge and response along with a shared secret key.

authentication management frame

recognition frame

Page 9: (Wireless network security - WEP, WPA, WPA2 encryptions)

WLAN Overview Association

• Data can be exchanged between the station and AP only after a station is associated with:– an AP in the infrastructure mode – another station in the ad hoc mode.

• A station can be authenticated with several APs at the same time, but associated with at most one AP at any time.

• Association implies authentication. There is no state where a station is

associated but not authenticated.

Image taken from http://www.cs.wright.edu/~pmateti/InternetSecurity/Lectures/WirelessHacks/Mateti-WirelessHacks.htm#_Toc77524650

Page 10: (Wireless network security - WEP, WPA, WPA2 encryptions)

IEEE 802.11 StandardsIEEE 802 is a dominant collection of networking standards developed by IEEE.

IEEE 802.11 is a family of standards for wireless LANs.

•Baseline IEEE Std 802.11-1997 was approved in June 1997.– Offering 1 Mbps and 2Mbps rates.– Typical indoor range of 20m.

•802.11b added 5.5 Mbps and 11 Mbps in 1999– range of 30-40m (indoor)

•802.11g added 54 Mbps in 2002– range of 30-40m (indoor)• 802.11n was published in October 2009.– Aiming for typical 75Mbps and maximum of 600Mbps– Range of 70m (indoor).– Products already available, based on draft standard.

Page 11: (Wireless network security - WEP, WPA, WPA2 encryptions)

IEEE 802.11 ModesInfrastructure Mode

• Basic Service Set (BSS)– A set of stations that are logically associated with each other

and controlled by a single AP• Extended Service Set– Two or more BSSs forming a single subnet.

BSS

Extended Service Set (ESS)

Access Point

Station

Page 12: (Wireless network security - WEP, WPA, WPA2 encryptions)

IEEE 802.11 ModesAd-hoc Mode

• Also called peer-to-peer.• Independent Basic Service Set.• Set of 802.11 wireless stations that

communicate directly without an access point.– Useful for quick & easy wireless networks.

Page 13: (Wireless network security - WEP, WPA, WPA2 encryptions)

IEEE 802.11 ModesJoining a Basic Service Set

• When 802.11 client enters range of one or more APs:– APs send beacons.– AP beacon can include SSID.– AP chosen on signal strength and observed error

rates.– After AP accepts client.

• Client tunes to AP channel.• Periodically, all channels surveyed.– To check for stronger or more reliable APs.– If found, may reassociate with new AP.

Page 14: (Wireless network security - WEP, WPA, WPA2 encryptions)

Security of IEEE 802.11 WLANsOpen System Authentication

• Relies on Service Set Identifier (SSID).• Station must specify SSID to Access Point

when requesting association.• APs can broadcast their SSID as a beacon.• Some clients allow * as SSID.– Associates with strongest AP regardless of SSID.

Page 15: (Wireless network security - WEP, WPA, WPA2 encryptions)

Security of IEEE 802.11 WLANsSSID Hiding

• AP can choose not to transmit SSID in its beacons.

• Can still attack APs that don’t transmit SSID:– Send deauthenticate frames to client. – SSID then captured when client sends

reauthenticate frames containing SSID. • Open System Authentication only provides

trivial level of security.– Even with SSID hiding.

Page 16: (Wireless network security - WEP, WPA, WPA2 encryptions)

Security of IEEE 802.11 WLANsMAC Access Control Lists

• Access points may have Access Control Lists (ACLs).

• ACL is a list of allowed MAC addresses.– E.g. only allow access to:

• 00:01:42:0E:12:1F• 00:01:42:F1:72:AE• 00:01:42:4F:E2:01

• But MAC addresses are sniffable and spoofable.• Hence MAC ACLs are of limited value.– Will not prevent determined attacker.

Page 17: (Wireless network security - WEP, WPA, WPA2 encryptions)

Interception

• Wireless LAN uses radio signal.• Not limited to physical building.• Signal is weakened by:– Walls– Floors– Interference

• Directional antenna allows interception over longer distances.– Record is 124 miles for an unamplified 802.11b signal

(using a 4 metre dish).

Page 18: (Wireless network security - WEP, WPA, WPA2 encryptions)

Directional Antennae• Directional antenna provides focused reception.• DIY plans available, using:

– Aluminium cake tins– Chinese cooking sieves.

Page 19: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wired Equivalence Privacy (WEP)

• Shared key between stations and an Access Point.• Key used in stream cipher to encrypt WLAN traffic.• Uses RC4 stream cipher – RC4 algorithm generates a stream of pseudo-random

bits using key and Initialisation Vector (IV) as input.– RC4 is also used in the decryption of the ciphertext.

• Uses 32-bit Cyclic Redundancy Check (CRC32)– Basically a hash function– Used to compute Integrity Check Vector (ICV)

Page 20: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP Encryption

RC4

ICV computation using CRC32

IV

Ciphertext

||

||Plaintext

Secret key

InitialisationVector (IV) Key-stream

|| append XOR

Page 21: (Wireless network security - WEP, WPA, WPA2 encryptions)

Shared Key Authentication

• Station requests association with AP.• AP sends challenge to station.• Station encrypts challenge using WEP to

produce response.• Response received by AP, decrypted by AP

and result compared to initial challenge. If they match AP sends a successful message and the station is authenticated.

Page 22: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP Safeguards

• Shared secret key required for:– Associating with an access point.– Sending data.– Receiving data.

• Messages are encrypted.– Confidentiality.

• Messages have checksum.– Intended to provide integrity.

• But has serious vulnerabilities…

Page 23: (Wireless network security - WEP, WPA, WPA2 encryptions)

Initialization Vector (IV)• IV should be different for every message

transmitted.• But 802.11 standard doesn’t specify how IV is

calculated.• Wireless cards use several methods:– Some use a simple ascending counter for each message.– Some switch between alternate ascending and descending

counters.– Some use a pseudo-random IV generator.

• If 24-bit IV is an ascending counter, and if AP transmits at 11 Mbps, then all IVs are exhausted in roughly 5 hours!

Page 24: (Wireless network security - WEP, WPA, WPA2 encryptions)

Insecurity of SKA• Rogue station records run of authentication protocol.• Uses known plaintext (challenge) to compute portion of key-

stream for the (known) IV.– C = P XOR key-stream.

• Rogue station can now respond to any future authentication challenge from AP encrypted with same key and same IV.– Rogue receives fresh challenge.– Wireless station gets to choose IV in protocol.– But same IV (and same secret key) means that RC4 produces the

same key-stream bits.– Hence rogue who repeats IV can reuse old key-stream portion to

encrypt, producing correct response

Page 25: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacksPacket injection

• A packet sent in a WEP protected network which has been intercepted by an attacker, can later be injected into the network again, as long as the key has not been changed and the original sending station is still in the network.

• WEP was never designed to be resistant against such an attack.

Page 26: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacksFake authentication

• Allows an attacker to join a WEP protected network, even if the attacker has not got the secret root key.

• Open System Authentication– Attacker can perform handshake without knowing

the secret root key• Shared Key Authentication– The attacker has to be able to sniff an SKA

handshake between the AP and another station.

Page 27: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacksChopchop attack (I)

• Allows an attacker to interactively decrypt the last m bytes of plaintext of an encrypted packet by sending m128 packets in average to the network.

• Procedure:– Select a captured packet for decryption– Truncate the packet by one byte, correct the checksum

and send the packet to the oracle to find out if the guess is correct

– If the guess is correct, we know the last byte of plaintext and we can continue with the second last byte

– If the guess war incorrect make another different guess for that byte (at most 256 guesses and an average of 128 guesses per byte)

Page 28: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacksChopchop attack (II)

Using the AP as an oracle:• The attacker could join the network with two stations A

and B and send the packet from station A to station B. – Correct checksum -> the packet will be replayed by the AP

to station B. – Incorrect checksum -> the packet will be discarded.

• The attacker could send the packet from a station which is not in the network to the AP. – Correct checksum -> the AP will send an error-message to

the station, telling it, that it needs to rejoin the network. – Incorrect checksum -> the packet will be discarded.

Page 29: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacksFMS attack

• First key recovery attack against the RC4 algorithm.

• Main idea:– If the RC4 key is composed from a known IV and an unknown secret part

by concatenation;– And if the attacker knows the first byte of key-stream for enough different

IVs;– Then the whole RC4 key can be determined in a statistical attack.– Attack only makes use of some of the IVs – so-called “weak” IVs.

• Complexity of attack grows only linearly with key size rather than exponentially.

• http://www.drizzle.com/~aboba/IEEE/rc4_ksaproc.pdf

Page 30: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacksGenerating traffic for the FMS attack• Capture encrypted ARP request packets

(associate an IP address with its physical associate an IP address with its physical address)address).

• Replay encrypted ARP packets to generate encrypted ARP replies.

• These replies provide more traffic, potentially with IVs indicating weak keys.

Page 31: (Wireless network security - WEP, WPA, WPA2 encryptions)

WEP attacks Other WEP attacks

• PTW attack• Bit-flipping attack• Brute-force key attack• KoreK’s fragmentation attack• ….

Page 32: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wi-Fi Protected Access (WPA)

• The IEEE 802.11 community has responded to the many security problems identified in WEP.

• Intermediate solution: Wi-Fi Protected Access (WPA).

• Longer-term solution: WPA2.• WPA and WPA2 are standardised in IEEE

802.11i • Recently WPA has been cracked in just 60

seconds by Japanese researchers http://www.itpro.co.uk/blogs/daveyw/2009/08/30/wifi-security-gone-in-60-seconds/

Page 33: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wi-Fi Protected Access (WPA)

• Wi-Fi Protected Access (WPA)– Works with 802.11b, a and g.– An intermediate solution to address WEP’s problems.– Existing hardware can still be used; only firmware upgrade needed.

• WPA introduced new authentication protocol, improved integrity protection measure and per-packet keys.– To provide stronger authentication than in WEP.– To prevent spoofing attacks (i.e. bit flipping on WEP CRC).– To prevent FMS-style attacks.

Page 34: (Wireless network security - WEP, WPA, WPA2 encryptions)

Temporal Key Integrity Protocol (TKIP)

WPA introduced Temporal Key Integrity Protocol (TKIP).

•It is designed to be usable on already existing hardware by installing a new firmware.

•It is known to have several security weaknesses, but raises bar considerably compared to WEP.

Page 35: (Wireless network security - WEP, WPA, WPA2 encryptions)

TKIP Security Measures (I)

• A cryptographic message integrity code (MIC) is added to every packet before fragmentation.– Prevents attacks like fragmentation or chopchop, where

fragments of a packet are rearranged or packets are modified

– Protects the plaintext of the fragments to prevent an attacker from modifying the source or destination address of a packet.

• TKIP exchanges the per packet key completely after every single packet.– WEP changes only the first 3 bytes of the per packet key.

Page 36: (Wireless network security - WEP, WPA, WPA2 encryptions)

TKIP Security Measures (II)• TKIP only allows a small number of messages where

the CRC32 checksum is correct but the MIC is incorrect.– If more than two such messages are received by a station

within a minute, TKIP is disabled for a minute and a renegotiation of the keys is suggested.

• A per packet sequence counter is used to prevent replay attacks.– If a packet is received out of order, it is dropped by the

receiving station.– This prevents all kind of injection attacks where a packet is

replayed.

Page 37: (Wireless network security - WEP, WPA, WPA2 encryptions)

WPA attacks

• Dictionary attack on pre-shared key mode• Denial of service attack – If WPA equipment sees two packets with invalid

MICs in 1 second, then:• All clients are disassociated.• All activity stopped for one minute.• So two malicious packets per minute is enough to stop a

wireless network.

Page 38: (Wireless network security - WEP, WPA, WPA2 encryptions)

WPA2Supersedes WPA’s interim solution to WEP issues but does require new hardware.

•An enterprise level key management was added to IEEE 802.11, which allows a lot of modes of authentication:

– No need for a single secret pre-shared key – Use of a username and a password, smartcards, certificates, hardware

security tokens etc

•Every station uses individual keys to communicate with an AP– Eavesdropping by another station in the same network is not possible

anymore.

Page 39: (Wireless network security - WEP, WPA, WPA2 encryptions)

Workshop

Automation of attacks: How much time is needed for an inexperienced

attacker to break into your WEP network?http://lifehacker.com/5305094/how-to-crack-a-wi+fi-networks-wep-password-with-backtrack

Page 40: (Wireless network security - WEP, WPA, WPA2 encryptions)

If you liked the workshop…Have in mind that:• June 2004, Michigan, Lowes DIY store– Salcedo convicted for stealing credit card numbers via

unprotected WLAN, received 9 year sentence.– Botbyl convicted for checking email & web browsing via

unprotected WLAN, received 26 month sentence.

• June 2004, Connecticut, Myron Tereshchuk guilty of drive-by extortion via unprotected WLANs.– 63 month prison sentence.

• July 2005, London, Gregory Straszkiewicz found guilty of dishonestly obtaining a communications service.– £500 fine and 12 month suspended sentence under

Communications Act (2003).

Page 41: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wireless Security Best PracticesProper Configuration

• Change default SSID names of the AP, such as “Default SSID”, “WLAN”, “Wireless”, “Compaq”, “intel”, and “linksys”. – Default admin passwords are well known for all

manufacturers. – Single-word passwords are easier to crack

• The IEEE 802.11 does not describe an automated way of distributing the shared-secret keys. – Manual distribution is expensive in large installations– But it is better to change them periodically.

Page 42: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wireless Security Best PracticesSecure Protocols

• Avoid the use of protocols that send passwords and data in the clear.– Rlogin family;– Telnet;– POP3.

• Instead prefer – SSH(Secure Shell);– VPN (Virtual private networks)

• Always use the newest standards and protocols available.

Page 43: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wireless Security Best PracticesDiscover Unauthorized Use

• A wireless intrusion detection system (WIDS) is often a self-contained computer system with specialized hardware and software to detect anomalous behavior. – Need of special wireless hardware – Can detect unknown MAC addresses by maintaining a

registry of MAC addresses of known stations and APs. – Can detect spoofed known MAC addresses because

the attacker could not control the firmware of the wireless card to insert the appropriate sequence numbers into the frame.

Page 44: (Wireless network security - WEP, WPA, WPA2 encryptions)

Wireless Security Best PracticesWireless Auditing

• Begins with the definition of a well-established security policy. – i.e. a policy for wireless networks should include a

description of the geographical volume of coverage.

• The main goal of an audit is to verify that there are no violations of the policy.

• Several audit firms provide this service for a fee. • The typical auditor employs the tools and

techniques of an attacker.

Page 45: (Wireless network security - WEP, WPA, WPA2 encryptions)

Q&A

Page 46: (Wireless network security - WEP, WPA, WPA2 encryptions)

ReferencesPapers:[1] Attacks on the WEP protocol. Diploma Thesis 2007 by Eric Tews [2] Practical attacks against WEP and WPA. Martin Beck, Eric Tews,

2008[3] Weaknesses in the key scheduling algorithm of RC4 Scott Fluhrer,

Itsik Mantin, Adi Shamir

Links:• http://www.cs.wright.edu/~pmateti/InternetSecurity/Lectures/

WirelessHacks/Mateti-WirelessHacks.htm• http://www.saunalahti.fi/~elepal/antennie.html• www.drizzle.com/~aboba/IEEE/• http://www.offensive-security.com/