Replay Attacks Network Systems Security Mort Anvari 9232004

  • Slides: 29
Download presentation
Replay Attacks Network Systems Security Mort Anvari 9/23/2004

Replay Attacks Network Systems Security Mort Anvari 9/23/2004

A Scenario of Replay Attack n n n Alice authorizes a transfer of funds

A Scenario of Replay Attack n n n Alice authorizes a transfer of funds from her account to Bob’s account An eavesdropping adversary makes a copy of this message Adversary replays this message at some later time 9/23/2004 2

Replay Attacks n Adversary takes past messages and plays them again n whole or

Replay Attacks n Adversary takes past messages and plays them again n whole or part of message to same or different receiver Encryption algorithms not enough to counter replay attacks 9/23/2004 3

Freshness Identifiers n n Sender attaches a freshness identifier to message to help receiver

Freshness Identifiers n n Sender attaches a freshness identifier to message to help receiver determine whether message is fresh Three types of freshness identifiers n nonces timestamps sequence numbers 9/23/2004 4

Nonces n n A random number generated for a special occasion Need to be

Nonces n n A random number generated for a special occasion Need to be unpredictable and not used before Disadvantage is not suitable for sending a stream of messages Mostly used in challenge-response protocols 9/23/2004 5

Timestamps n n Sender attaches an encrypted real-timestamp to every message Receiver decrypts timestamp

Timestamps n n Sender attaches an encrypted real-timestamp to every message Receiver decrypts timestamp and compares it with current reading n n n if difference is sufficiently small, accept message otherwise discard message Problem is synchronization between sender and receiver 9/23/2004 6

Sequence Numbers n n Sender attaches a monotonically increasing counter value to every message

Sequence Numbers n n Sender attaches a monotonically increasing counter value to every message Sender needs to remember last used number and receiver needs to remember largest received number 9/23/2004 7

Operation of Sequence Numbers n n Sender increments sequence number by 1 after sending

Operation of Sequence Numbers n n Sender increments sequence number by 1 after sending a message Receiver compares sequence number of received message with largest received number n n If larger than largest received number, accept message and update largest received number If less than largest received number, discard message 9/23/2004 8

Problem with Sequence Numbers n n IPsec uses sequence number to counter replay attacks

Problem with Sequence Numbers n n IPsec uses sequence number to counter replay attacks However reorder can occur in IP Messages with larger sequence number may arrive before messages with smaller sequence numbers When reordered messages with smaller sequence numbers arrive later, they will be discarded 9/23/2004 9

Anti-Replay Window Protocol in IPsec n n n Protect IPsec messages against replay attacks

Anti-Replay Window Protocol in IPsec n n n Protect IPsec messages against replay attacks and counter the problem of reorder Sender puts a sequence number in every message Receiver uses a sliding window to keep track of the received sequence numbers 9/23/2004 10

Anti-Replay Window sequence numbers • • • 1 2 3 • • • w

Anti-Replay Window sequence numbers • • • 1 2 3 • • • w • • • received before r-w+1 right edge r not yet received assumed received n n w is window size r is right edge of window Assume s is sequence number of next received message Three cases to consider 9/23/2004 11

Cases of Anti-Replay Window n Case i: if s is smaller than sequence numbers

Cases of Anti-Replay Window n Case i: if s is smaller than sequence numbers in window, discard message s 1 s 9/23/2004 w r 12

Cases of Anti-Replay Window n Case ii: s is in window n n if

Cases of Anti-Replay Window n Case ii: s is in window n n if s has not been received yet, then deliver message s if s has been received, then discard message s 1 9/23/2004 w s s (discard) (deliver) r 13

Cases of Anti-Replay Window n Case iii: if s is larger than sequence numbers

Cases of Anti-Replay Window n Case iii: if s is larger than sequence numbers in window, then deliver message s and slide the window so that s becomes its new right edge window before shift 1 1 w w r s window after shift 9/23/2004 14

Properties of Protocol n Discrimination: receiver delivers at most one copy of every message

Properties of Protocol n Discrimination: receiver delivers at most one copy of every message sent by sender n w-Delivery: receiver delivers at least one copy of each message that is neither lost nor suffered a reorder of degree w or more, where w is window size 9/23/2004 15

Problem with Anti-Replay Window Receiver gets s, where s >> r Window shifts to

Problem with Anti-Replay Window Receiver gets s, where s >> r Window shifts to right Many good messages that arrive later will be discarded n n n window before shift 1 window after shift w r 9/23/2004 1 discarded good msgs w s 16

Automatic Shift vs. Controlled Shift n n Automatic shift: window automatically shifts to the

Automatic Shift vs. Controlled Shift n n Automatic shift: window automatically shifts to the right to cover the newly received sequence number without any consideration of how far the newly received sequence number is ahead Controlled shift: if the newly received sequence number is far ahead, discard it without shifting window in the hope that those skipped sequence numbers may arrive later 9/23/2004 17

Three Properties of Controlled Shift n Adaptability n n Rationality n n receiver determines

Three Properties of Controlled Shift n Adaptability n n Rationality n n receiver determines whether to sacrifice a newly received message according to the current characteristics of the environment receiver sacrifices only when messages that could be saved are more than messages that are sacrificed Sensibility n receiver stops sacrificing if it senses that the messages it means to save are not likely to come 9/23/2004 18

Additional Case with Controlled Shift n Case iv: s is more than w positions

Additional Case with Controlled Shift n Case iv: s is more than w positions to the right of window n n n receiver estimates number of good messages it is going to lose if it shifts the window to s if the estimate is larger than d+1, where d is the counter of discarded messages, and d+1 is less than dmax, then receiver discards this message and increments d by 1 otherwise, receiver delivers the message, shifts the window to the right, and resets d to 0 9/23/2004 19

Another Problem with Anti-Replay Window n n Computer may reset due to transient fault

Another Problem with Anti-Replay Window n n Computer may reset due to transient fault If either sender or receiver is reset and restarts from 0, then synchronization on sequence numbers is lost 9/23/2004 20

Scenario of Sender Reset If p is reset, unbounded number of fresh messages are

Scenario of Sender Reset If p is reset, unbounded number of fresh messages are discarded by q n p q seq# : 50 reset 49 48 • • • 3 2 1 0 seq# : 0 fresh yet discarded by q 9/23/2004 21

Scenario of Receiver Reset If q is reset, it can accept unbounded number of

Scenario of Receiver Reset If q is reset, it can accept unbounded number of replayed messages n inserted by adversary p seq# : 50 49 48 • • • 3 2 q 1 0 seq# : 50 reset seq# : 0 replayed yet accepted by q 9/23/2004 22

Overcome Reset Problems n n IPsec Working Group: if reset, the SA is deleted

Overcome Reset Problems n n IPsec Working Group: if reset, the SA is deleted and a new one is established -very expensive Our solution: periodically push current state of SA into persistent memory; if reset, restore state of SA from this memory 9/23/2004 23

SAVE and FETCH n n When SAVE is executed, the last sequence number or

SAVE and FETCH n n When SAVE is executed, the last sequence number or right edge of window will be stored in persistent memory When FETCH is executed, the last stored sequence number or right edge of window will be loaded from persistent memory into memory 9/23/2004 24

SAVE at Sender n n n s is sequence number at p Every Kp

SAVE at Sender n n n s is sequence number at p Every Kp messages, p executes SAVE(s) to store current s in persistent memory In spite of execution delay, SAVE(s) is guaranteed to complete before message numbered s+Kp is sent 9/23/2004 25

FETCH at Sender n n n When p wakes up after reset, p executes

FETCH at Sender n n n When p wakes up after reset, p executes FETCH(s) to fetch s stored in persistent memory After FETCH(s) completes, p executes SAVE(s+2 Kp) and waits After SAVE(s+2 Kp) completes, p can send next message using seq# s+2 Kp 9/23/2004 26

Convergence of Sender n n n Assume when p resets, SAVE(s) has not yet

Convergence of Sender n n n Assume when p resets, SAVE(s) has not yet completed, and the last sent seq# is s+t, t < Kp When p wakes up, s-Kp will be fetched Therefore, adding 2 Kp to fetched seq# guarantees that next sent seq# is fresh 9/23/2004 27

Results of SAVE and FETCH n n n When p is reset, some sequence

Results of SAVE and FETCH n n n When p is reset, some sequence numbers will be abandoned by p, but no message sent from p to q will be discarded provided no message reorder occurs When q is reset, the number of discarded messages is bounded by Kq When p or q is reset, no replayed message will be accepted by q 9/23/2004 28

Next Class n n n Address Resolution Protocol (ARP) and its security problems Secure

Next Class n n n Address Resolution Protocol (ARP) and its security problems Secure ARP Read paper on website 9/23/2004 29