Hash-flooding DoS reloaded: Hash flooding begins? attacks and - - PowerPoint PPT Presentation

hash flooding dos reloaded hash flooding begins attacks
SMART_READER_LITE
LIVE PREVIEW

Hash-flooding DoS reloaded: Hash flooding begins? attacks and - - PowerPoint PPT Presentation

Hash-flooding DoS reloaded: Hash flooding begins? attacks and defenses July 1998 article Jean-Philippe Aumasson, Designing and attacking Kudelski Security (NAGRA) port scan detection tools by Solar Designer (Alexander D. J. Bernstein,


slide-1
SLIDE 1

Hash-flooding DoS reloaded: attacks and defenses Jean-Philippe Aumasson, Kudelski Security (NAGRA)

  • D. J. Bernstein,

University of Illinois at Chicago & Technische Universiteit Eindhoven Martin Boßlet, Ruby Core Team Hash flooding begins? July 1998 article “Designing and attacking port scan detection tools” by Solar Designer (Alexander Peslyak) in Phrack Magazine: “In scanlogd, I’m using a hash table to lookup source addresses. This works very well for the typical case ✿ ✿ ✿ average lookup time is better than that of a binary search. ✿ ✿ ✿

slide-2
SLIDE 2

Hash-flooding DoS reloaded: attacks and defenses Jean-Philippe Aumasson, Kudelski Security (NAGRA) Bernstein, University of Illinois at Chicago & echnische Universiteit Eindhoven Boßlet, Core Team Hash flooding begins? July 1998 article “Designing and attacking port scan detection tools” by Solar Designer (Alexander Peslyak) in Phrack Magazine: “In scanlogd, I’m using a hash table to lookup source addresses. This works very well for the typical case ✿ ✿ ✿ average lookup time is better than that of a binary search. ✿ ✿ ✿ However, choose her likely spo collisions, hash table

  • search. Dep

entries w scanlogd new pack ✿ ✿ ✿ solved this the numb discarding the same limit is reached.

slide-3
SLIDE 3

DoS reloaded: defenses Aumasson, y (NAGRA) Illinois at Chicago & Universiteit Eindhoven Hash flooding begins? July 1998 article “Designing and attacking port scan detection tools” by Solar Designer (Alexander Peslyak) in Phrack Magazine: “In scanlogd, I’m using a hash table to lookup source addresses. This works very well for the typical case ✿ ✿ ✿ average lookup time is better than that of a binary search. ✿ ✿ ✿ However, an attack choose her addresse likely spoofed) to cause collisions, effectively hash table lookup

  • search. Depending

entries we keep, this scanlogd not be able new packets up in ✿ ✿ ✿ solved this problem the number of hash discarding the oldest the same hash value limit is reached.

slide-4
SLIDE 4

reloaded: GRA) Chicago & Eindhoven Hash flooding begins? July 1998 article “Designing and attacking port scan detection tools” by Solar Designer (Alexander Peslyak) in Phrack Magazine: “In scanlogd, I’m using a hash table to lookup source addresses. This works very well for the typical case ✿ ✿ ✿ average lookup time is better than that of a binary search. ✿ ✿ ✿ However, an attacker can choose her addresses (most likely spoofed) to cause hash collisions, effectively replacing hash table lookup with a linea

  • search. Depending on how many

entries we keep, this might mak scanlogd not be able to pick new packets up in time. ✿ ✿ ✿ solved this problem by limiting the number of hash collisions, discarding the oldest entry with the same hash value when the limit is reached.

slide-5
SLIDE 5

Hash flooding begins? July 1998 article “Designing and attacking port scan detection tools” by Solar Designer (Alexander Peslyak) in Phrack Magazine: “In scanlogd, I’m using a hash table to lookup source addresses. This works very well for the typical case ✿ ✿ ✿ average lookup time is better than that of a binary search. ✿ ✿ ✿ However, an attacker can choose her addresses (most likely spoofed) to cause hash collisions, effectively replacing the hash table lookup with a linear

  • search. Depending on how many

entries we keep, this might make scanlogd not be able to pick new packets up in time. ✿ ✿ ✿ I’ve solved this problem by limiting the number of hash collisions, and discarding the oldest entry with the same hash value when the limit is reached.

slide-6
SLIDE 6

flooding begins? 1998 article “Designing and attacking scan detection tools” ar Designer (Alexander ak) in Phrack Magazine: scanlogd, I’m using a hash to lookup source addresses.

  • rks very well for the

ypical case ✿ ✿ ✿ average lookup is better than that of a

  • search. ✿ ✿ ✿

However, an attacker can choose her addresses (most likely spoofed) to cause hash collisions, effectively replacing the hash table lookup with a linear

  • search. Depending on how many

entries we keep, this might make scanlogd not be able to pick new packets up in time. ✿ ✿ ✿ I’ve solved this problem by limiting the number of hash collisions, and discarding the oldest entry with the same hash value when the limit is reached. This is acceptable (rememb all scans not be acce

  • ther attacks. ✿ ✿ ✿

worth mentioning issues also

  • perating

example, used there connections, There’re which mak dangerous more resea

slide-7
SLIDE 7

egins? attacking detection tools” Designer (Alexander Phrack Magazine: I’m using a hash source addresses. well for the ✿ ✿ ✿ average lookup than that of a ✿ ✿ ✿ However, an attacker can choose her addresses (most likely spoofed) to cause hash collisions, effectively replacing the hash table lookup with a linear

  • search. Depending on how many

entries we keep, this might make scanlogd not be able to pick new packets up in time. ✿ ✿ ✿ I’ve solved this problem by limiting the number of hash collisions, and discarding the oldest entry with the same hash value when the limit is reached. This is acceptable (remember, we can’t all scans anyway), not be acceptable

  • ther attacks. ✿ ✿ ✿

worth mentioning that issues also apply to

  • perating system k

example, hash tables used there for looking connections, listening There’re usually other which make these dangerous though, more research might

slide-8
SLIDE 8

(Alexander Magazine: hash addresses. the ✿ ✿ ✿

  • kup
  • f a

✿ ✿ ✿ However, an attacker can choose her addresses (most likely spoofed) to cause hash collisions, effectively replacing the hash table lookup with a linear

  • search. Depending on how many

entries we keep, this might make scanlogd not be able to pick new packets up in time. ✿ ✿ ✿ I’ve solved this problem by limiting the number of hash collisions, and discarding the oldest entry with the same hash value when the limit is reached. This is acceptable for port scans (remember, we can’t detect all scans anyway), but might not be acceptable for detecting

  • ther attacks. ✿ ✿ ✿ It is probably

worth mentioning that simila issues also apply to things lik

  • perating system kernels. Fo

example, hash tables are widely used there for looking up active connections, listening ports, There’re usually other limits which make these not really dangerous though, but more research might be needed.

slide-9
SLIDE 9

However, an attacker can choose her addresses (most likely spoofed) to cause hash collisions, effectively replacing the hash table lookup with a linear

  • search. Depending on how many

entries we keep, this might make scanlogd not be able to pick new packets up in time. ✿ ✿ ✿ I’ve solved this problem by limiting the number of hash collisions, and discarding the oldest entry with the same hash value when the limit is reached. This is acceptable for port scans (remember, we can’t detect all scans anyway), but might not be acceptable for detecting

  • ther attacks. ✿ ✿ ✿ It is probably

worth mentioning that similar issues also apply to things like

  • perating system kernels. For

example, hash tables are widely used there for looking up active connections, listening ports, etc. There’re usually other limits which make these not really dangerous though, but more research might be needed.”

slide-10
SLIDE 10

ever, an attacker can

  • se her addresses (most

spoofed) to cause hash collisions, effectively replacing the table lookup with a linear

  • rch. Depending on how many

we keep, this might make scanlogd not be able to pick packets up in time. ✿ ✿ ✿ I’ve this problem by limiting number of hash collisions, and rding the oldest entry with same hash value when the is reached. This is acceptable for port scans (remember, we can’t detect all scans anyway), but might not be acceptable for detecting

  • ther attacks. ✿ ✿ ✿ It is probably

worth mentioning that similar issues also apply to things like

  • perating system kernels. For

example, hash tables are widely used there for looking up active connections, listening ports, etc. There’re usually other limits which make these not really dangerous though, but more research might be needed.” Review of Choose ❵ ✷ ❢ ❀ ❀ ❀ ❀ ❀ ✿ ✿ ✿❣ Hash table: ❵ Store string s ✐ where ✐ = ❍ s ❵ With ♥ entries expect ✙ ♥❂❵ in each link Choose ❵ ✙ ♥ expect very so very fast (What if ♥ Rehash: ❵ ❵

slide-11
SLIDE 11

attacker can ddresses (most to cause hash tively replacing the

  • kup with a linear

ending on how many this might make e able to pick in time. ✿ ✿ ✿ I’ve roblem by limiting hash collisions, and

  • ldest entry with

value when the This is acceptable for port scans (remember, we can’t detect all scans anyway), but might not be acceptable for detecting

  • ther attacks. ✿ ✿ ✿ It is probably

worth mentioning that similar issues also apply to things like

  • perating system kernels. For

example, hash tables are widely used there for looking up active connections, listening ports, etc. There’re usually other limits which make these not really dangerous though, but more research might be needed.” Review of classic hash Choose ❵ ✷ ❢1❀ 2❀ 4❀ ❀ ❀ ✿ ✿ ✿❣ Hash table: ❵ sepa Store string s in list ✐ where ✐ = ❍(s) mo ❵ With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short link so very fast list op (What if ♥ becomes Rehash: replace ❵ ❵

slide-12
SLIDE 12

(most hash replacing the linear many might make pick ✿ ✿ ✿ I’ve limiting collisions, and with the This is acceptable for port scans (remember, we can’t detect all scans anyway), but might not be acceptable for detecting

  • ther attacks. ✿ ✿ ✿ It is probably

worth mentioning that similar issues also apply to things like

  • perating system kernels. For

example, hash tables are widely used there for looking up active connections, listening ports, etc. There’re usually other limits which make these not really dangerous though, but more research might be needed.” Review of classic hash tables Choose ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣ Hash table: ❵ separate linked Store string s in list #✐ where ✐ = ❍(s) mod ❵. With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short linked lists, so very fast list operations. (What if ♥ becomes too big? Rehash: replace ❵ by 2❵.)

slide-13
SLIDE 13

This is acceptable for port scans (remember, we can’t detect all scans anyway), but might not be acceptable for detecting

  • ther attacks. ✿ ✿ ✿ It is probably

worth mentioning that similar issues also apply to things like

  • perating system kernels. For

example, hash tables are widely used there for looking up active connections, listening ports, etc. There’re usually other limits which make these not really dangerous though, but more research might be needed.” Review of classic hash tables Choose ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣. Hash table: ❵ separate linked lists. Store string s in list #✐ where ✐ = ❍(s) mod ❵. With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short linked lists, so very fast list operations. (What if ♥ becomes too big? Rehash: replace ❵ by 2❵.)

slide-14
SLIDE 14

is acceptable for port scans (remember, we can’t detect scans anyway), but might acceptable for detecting

  • attacks. ✿ ✿ ✿ It is probably

mentioning that similar also apply to things like erating system kernels. For example, hash tables are widely there for looking up active connections, listening ports, etc. There’re usually other limits make these not really dangerous though, but research might be needed.” Review of classic hash tables Choose ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣. Hash table: ❵ separate linked lists. Store string s in list #✐ where ✐ = ❍(s) mod ❵. With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short linked lists, so very fast list operations. (What if ♥ becomes too big? Rehash: replace ❵ by 2❵.) e.g. strings ✿ ✿ ✿ ❍(s) = first s ❵ . . . e✦eight f✦four✦ . . . n✦nine

  • ✦one

p q r s✦six✦ t✦two✦ ✦ . . .

slide-15
SLIDE 15

acceptable for port scans can’t detect y), but might table for detecting ✿ ✿ ✿ It is probably mentioning that similar to things like

  • kernels. For

tables are widely

  • king up active

listening ports, etc.

  • ther limits

these not really though, but might be needed.” Review of classic hash tables Choose ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣. Hash table: ❵ separate linked lists. Store string s in list #✐ where ✐ = ❍(s) mod ❵. With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short linked lists, so very fast list operations. (What if ♥ becomes too big? Rehash: replace ❵ by 2❵.) e.g. strings one, two ✿ ✿ ✿ ❍(s) = first byte of s ❵ . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ . . .

slide-16
SLIDE 16

scans detect might detecting ✿ ✿ ✿ robably similar like For widely active rts, etc. limits really needed.” Review of classic hash tables Choose ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣. Hash table: ❵ separate linked lists. Store string s in list #✐ where ✐ = ❍(s) mod ❵. With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short linked lists, so very fast list operations. (What if ♥ becomes too big? Rehash: replace ❵ by 2❵.) e.g. strings one, two, ✿ ✿ ✿ , ten ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . .

slide-17
SLIDE 17

Review of classic hash tables Choose ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣. Hash table: ❵ separate linked lists. Store string s in list #✐ where ✐ = ❍(s) mod ❵. With ♥ entries in table, expect ✙ ♥❂❵ entries in each linked list. Choose ❵ ✙ ♥: expect very short linked lists, so very fast list operations. (What if ♥ becomes too big? Rehash: replace ❵ by 2❵.) e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . .

slide-18
SLIDE 18
  • f classic hash tables
  • se ❵ ✷ ❢1❀ 2❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣.

table: ❵ separate linked lists. string s in list #✐ ✐ = ❍(s) mod ❵. ♥ entries in table, ✙ ♥❂❵ entries each linked list.

  • se ❵ ✙ ♥:

very short linked lists, very fast list operations. if ♥ becomes too big? Rehash: replace ❵ by 2❵.) e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . . ❍(s) = first s is not a go Typical strings Very long In some start with

slide-19
SLIDE 19

hash tables ❵ ✷ ❢ ❀ ❀ 4❀ 8❀ 16❀ ✿ ✿ ✿❣. ❵ separate linked lists. s list #✐ ✐ ❍ s mod ❵. ♥ in table, ✙ ♥❂❵ entries list. ❵ ✙ ♥ rt linked lists,

  • perations.

♥ ecomes too big? ❵ by 2❵.) e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . . ❍(s) = first byte of s is not a good hash Typical strings often Very long t list; very In some applications, start with the same

slide-20
SLIDE 20

tables ❵ ✷ ❢ ❀ ❀ ❀ ❀ ❀ ✿ ✿ ✿❣. ❵ linked lists. s ✐ ✐ ❍ s ❵ ♥ ✙ ♥❂❵ ❵ ✙ ♥ lists, erations. ♥ big? ❵ ❵ e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . . ❍(s) = first byte of s is not a good hash function! Typical strings often start with Very long t list; very slow. In some applications, most strings start with the same letter.

slide-21
SLIDE 21

e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . . ❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter.

slide-22
SLIDE 22

e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . . ❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings.

slide-23
SLIDE 23

e.g. strings one, two, ✿ ✿ ✿ , ten; ❍(s) = first byte of s; ❵ = 256: . . . e✦eight f✦four✦five . . . n✦nine

  • ✦one

p q r s✦six✦seven t✦two✦three✦ten . . . ❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical?

slide-24
SLIDE 24

strings one, two, ✿ ✿ ✿ , ten; ❍ s first byte of s; ❵ = 256: ✦eight ✦four✦five ✦nine ✦ ✦ ✦seven ✦ ✦three✦ten ❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical? Hashing Attacker s1❀ ✿ ✿ ✿ ❀ s♥ ❍ s ❵ ✁ ✁ ✁ = ❍(s♥ ❵ Then all in the same linked lis

slide-25
SLIDE 25

, two, ✿ ✿ ✿ , ten; ❍ s yte of s; ❵ = 256: ✦ ✦ ✦ ✦ ✦ ✦ ✦ ✦ ✦ ✦ten ❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical? Hashing malicious Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s ❵ ✁ ✁ ✁ = ❍(s♥) mod ❵ Then all strings are in the same linked linked list becomes

slide-26
SLIDE 26

✿ ✿ ✿ , ten; ❍ s s ❵ 256: ✦ ✦ ✦ ✦ ✦ ✦ ✦ ✦ ✦ ✦ ❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow.

slide-27
SLIDE 27

❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow.

slide-28
SLIDE 28

❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow. Solution: Replace linked list by a safe tree structure, at least if list is big.

slide-29
SLIDE 29

❍(s) = first byte of s is not a good hash function! Typical strings often start with t. Very long t list; very slow. In some applications, most strings start with the same letter. So we use fast hash functions that look at the whole string s. 60 years of programmers exploring hash functions for hash tables ✮ good speed for typical strings. What if the strings aren’t typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow. Solution: Replace linked list by a safe tree structure, at least if list is big. But implementors are unhappy: this solution throws away the simplicity of hash tables.

slide-30
SLIDE 30

❍ s first byte of s a good hash function! ypical strings often start with t. long t list; very slow. some applications, most strings with the same letter. use fast hash functions

  • k at the whole string s.

rs of programmers exploring functions for hash tables ✮ d speed for typical strings. if the strings aren’t typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow. Solution: Replace linked list by a safe tree structure, at least if list is big. But implementors are unhappy: this solution throws away the simplicity of hash tables. December dnscache ❃41000000000000 from 50

if (++loop /* to hash

Discarding trivially maintains if attacke But what general-purp languages Can’t thro

slide-31
SLIDE 31

❍ s yte of s hash function!

  • ften start with t.

very slow. applications, most strings same letter. ash functions whole string s. rogrammers exploring

  • r hash tables

✮ for typical strings. strings aren’t typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow. Solution: Replace linked list by a safe tree structure, at least if list is big. But implementors are unhappy: this solution throws away the simplicity of hash tables. December 1999, Bernstein, dnscache software ❃41000000000000 from 50 million Internet

if (++loop > 100) /* to protect hash flooding

Discarding cache entries trivially maintains if attacker floods hash But what about ha general-purpose programming languages and libra Can’t throw entries

slide-32
SLIDE 32

❍ s s function! with t. w. most strings functions string s. exploring tables ✮ strings. typical? Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow. Solution: Replace linked list by a safe tree structure, at least if list is big. But implementors are unhappy: this solution throws away the simplicity of hash tables. December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables general-purpose programming languages and libraries? Can’t throw entries away!

slide-33
SLIDE 33

Hashing malicious strings Attacker provides strings s1❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ = ❍(s♥) mod ❵. Then all strings are stored in the same linked list; linked list becomes very slow. Solution: Replace linked list by a safe tree structure, at least if list is big. But implementors are unhappy: this solution throws away the simplicity of hash tables. December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away!

slide-34
SLIDE 34

Hashing malicious strings er provides strings s ❀ ✿ ✿ ✿ ❀ s♥ with ❍(s1) mod ❵ = ✁ ✁ ✁ ❍(s♥) mod ❵. all strings are stored same linked list; list becomes very slow. Solution: Replace linked list safe tree structure, least if list is big. implementors are unhappy: solution throws away the simplicity of hash tables. December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away! Bad solution: Use SHA-3 ❍ SHA-3 is

slide-35
SLIDE 35

malicious strings rovides strings s ❀ ✿ ✿ ✿ ❀ s♥ ❍(s1) mod ❵ = ✁ ✁ ✁ ❍ s♥ d ❵. are stored ed list; ecomes very slow. Replace linked list ructure, big. rs are unhappy: throws away the hash tables. December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant!

slide-36
SLIDE 36

s ❀ ✿ ✿ ✿ ❀ s♥ ❍ s d ❵ = ✁ ✁ ✁ ❍ s♥ ❵ slow. list unhappy: the December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant!

slide-37
SLIDE 37

December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant!

slide-38
SLIDE 38

December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant! Two reasons this is bad:

  • 1. It’s very slow.
  • 2. It doesn’t solve the problem.
slide-39
SLIDE 39

December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests from 50 million Internet users):

if (++loop > 100) return 0; /* to protect against hash flooding */

Discarding cache entries trivially maintains performance if attacker floods hash table. But what about hash tables in general-purpose programming languages and libraries? Can’t throw entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant! Two reasons this is bad:

  • 1. It’s very slow.
  • 2. It doesn’t solve the problem.

❍(s) mod ❵ is not collision-resistant. ❵ is small: e.g., ❵ = 220. No matter how strong ❍ is, attacker can easily compute ❍(s) mod 220 for many s to find multicollisions.

slide-40
SLIDE 40

December 1999, Bernstein, dnscache software (OpenDNS: ❃41000000000000 DNS requests 50 million Internet users):

(++loop > 100) return 0; to protect against hash flooding */

rding cache entries trivially maintains performance attacker floods hash table. what about hash tables in general-purpose programming languages and libraries? throw entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant! Two reasons this is bad:

  • 1. It’s very slow.
  • 2. It doesn’t solve the problem.

❍(s) mod ❵ is not collision-resistant. ❵ is small: e.g., ❵ = 220. No matter how strong ❍ is, attacker can easily compute ❍(s) mod 220 for many s to find multicollisions. 2003 USENIX Symposium, “Denial of algorithmic “We present low-bandwidth attacks ✿ ✿ ✿ hashes to the hash degenerate Attack examples: Perl programming Squid we

slide-41
SLIDE 41

Bernstein, are (OpenDNS: ❃41000000000000 DNS requests Internet users):

100) return 0; protect against flooding */

entries maintains performance ds hash table. hash tables in programming libraries? entries away! Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant! Two reasons this is bad:

  • 1. It’s very slow.
  • 2. It doesn’t solve the problem.

❍(s) mod ❵ is not collision-resistant. ❵ is small: e.g., ❵ = 220. No matter how strong ❍ is, attacker can easily compute ❍(s) mod 220 for many s to find multicollisions. 2003 USENIX Securit Symposium, Crosb “Denial of service algorithmic complexit “We present a new low-bandwidth denial attacks ✿ ✿ ✿ if each hashes to the same the hash table will degenerate to a link Attack examples: Perl programming Squid web cache, etc.

slide-42
SLIDE 42

Bernstein, enDNS: ❃ requests users):

return 0; against

rmance table. tables in rogramming Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant! Two reasons this is bad:

  • 1. It’s very slow.
  • 2. It doesn’t solve the problem.

❍(s) mod ❵ is not collision-resistant. ❵ is small: e.g., ❵ = 220. No matter how strong ❍ is, attacker can easily compute ❍(s) mod 220 for many s to find multicollisions. 2003 USENIX Security Symposium, Crosby–Wallach, “Denial of service via algorithmic complexity attacks”: “We present a new class of low-bandwidth denial of service attacks ✿ ✿ ✿ if each element hashes to the same bucket, the hash table will also degenerate to a linked list.” Attack examples: Perl programming language, Squid web cache, etc.

slide-43
SLIDE 43

Bad solution: Use SHA-3 for ❍. SHA-3 is collision-resistant! Two reasons this is bad:

  • 1. It’s very slow.
  • 2. It doesn’t solve the problem.

❍(s) mod ❵ is not collision-resistant. ❵ is small: e.g., ❵ = 220. No matter how strong ❍ is, attacker can easily compute ❍(s) mod 220 for many s to find multicollisions. 2003 USENIX Security Symposium, Crosby–Wallach, “Denial of service via algorithmic complexity attacks”: “We present a new class of low-bandwidth denial of service attacks ✿ ✿ ✿ if each element hashes to the same bucket, the hash table will also degenerate to a linked list.” Attack examples: Perl programming language, Squid web cache, etc.

slide-44
SLIDE 44

solution: SHA-3 for ❍. is collision-resistant! reasons this is bad: very slow. doesn’t solve the problem. ❍ s mod ❵ collision-resistant. ❵ small: e.g., ❵ = 220. matter how strong ❍ is, er can easily compute ❍ s mod 220 for many s multicollisions. 2003 USENIX Security Symposium, Crosby–Wallach, “Denial of service via algorithmic complexity attacks”: “We present a new class of low-bandwidth denial of service attacks ✿ ✿ ✿ if each element hashes to the same bucket, the hash table will also degenerate to a linked list.” Attack examples: Perl programming language, Squid web cache, etc. 2011 (28C3), “Efficient

  • n web application

Java, JRub Python 2, Ruby, Apache Tomcat, Plone, Rack, Engine.

  • CERT adviso

Application use secre ❍ ✿ ✿ ✿ but is

slide-45
SLIDE 45

❍. collision-resistant! this is bad: w. solve the problem. ❍ s ❵ collision-resistant. ❵ ❵ = 220. strong ❍ is, easily compute ❍ s r many s multicollisions. 2003 USENIX Security Symposium, Crosby–Wallach, “Denial of service via algorithmic complexity attacks”: “We present a new class of low-bandwidth denial of service attacks ✿ ✿ ✿ if each element hashes to the same bucket, the hash table will also degenerate to a linked list.” Attack examples: Perl programming language, Squid web cache, etc. 2011 (28C3), Klink–W “Efficient denial of

  • n web application

Java, JRuby, PHP Python 2, Python Ruby, Apache Geronimo, Tomcat, Oracle Glassfish, Plone, Rack, V8 Javascript Engine.

  • CERT advisory 2011–003.

Application response: use secret key to randomize ❍ ✿ ✿ ✿ but is this secure?

slide-46
SLIDE 46

❍ collision-resistant! roblem. ❍ s ❵ ❵ ❵ ❍ is, compute ❍ s s 2003 USENIX Security Symposium, Crosby–Wallach, “Denial of service via algorithmic complexity attacks”: “We present a new class of low-bandwidth denial of service attacks ✿ ✿ ✿ if each element hashes to the same bucket, the hash table will also degenerate to a linked list.” Attack examples: Perl programming language, Squid web cache, etc. 2011 (28C3), Klink–W¨ alde, “Efficient denial of service attacks

  • n web application platforms”:

Java, JRuby, PHP 4, PHP 5, Python 2, Python 3, Rubinius, Ruby, Apache Geronimo, Apache Tomcat, Oracle Glassfish, Jett Plone, Rack, V8 Javascript Engine.

  • CERT advisory 2011–003.

Application response: use secret key to randomize ❍ ✿ ✿ ✿ but is this secure?

slide-47
SLIDE 47

2003 USENIX Security Symposium, Crosby–Wallach, “Denial of service via algorithmic complexity attacks”: “We present a new class of low-bandwidth denial of service attacks ✿ ✿ ✿ if each element hashes to the same bucket, the hash table will also degenerate to a linked list.” Attack examples: Perl programming language, Squid web cache, etc. 2011 (28C3), Klink–W¨ alde, “Efficient denial of service attacks

  • n web application platforms”:

Java, JRuby, PHP 4, PHP 5, Python 2, Python 3, Rubinius, Ruby, Apache Geronimo, Apache Tomcat, Oracle Glassfish, Jetty, Plone, Rack, V8 Javascript Engine.

  • CERT advisory 2011–003.

Application response: use secret key to randomize ❍. ✿ ✿ ✿ but is this secure?

slide-48
SLIDE 48
slide-49
SLIDE 49

“used in code by Google, Microsoft,

Yahoo, and many others”

slide-50
SLIDE 50

“successor to MurmurHash2”

slide-51
SLIDE 51
slide-52
SLIDE 52
slide-53
SLIDE 53

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { uint64_t k = *(uint64_t*)data; k *= m; k ^= k >> 24; k *= m; h *= m; h ^= k; data += 8; len -= 8;

}

slide-54
SLIDE 54

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed seed ^ len; whi while le (len >= 8) { uint64_t k = *(uint64_t*)data; k *= m; k ^= k >> 24; k *= m; h *= m; h ^= k; data += 8; len -= 8;

}

slide-55
SLIDE 55
slide-56
SLIDE 56

… /* finalization */ swi witch tch (len) { case case 7: h ^= data[6] << 48; case case 6: h ^= data[5] << 40; case case 5: h ^= data[4] << 32; case case 4: h ^= data[3] << 24; case case 3: h ^= data[2] << 16; case case 2: h ^= data[1] << 8; case case 1: h ^= data[0]; h *= m; }; …

slide-57
SLIDE 57
slide-58
SLIDE 58
slide-59
SLIDE 59
slide-60
SLIDE 60

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { /* fi first rst b block

  • ck */

uint64_t k = *(uint64_t*)data; k *= m; /* in injec ject t diff iffer erenc ence e D1 1 */ k ^= k >> 24; k *= m; h *= m; h ^= k; data += 8; len -= 8;

}

slide-61
SLIDE 61

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { /* fi first rst b block

  • ck */

uint64_t k = *(uint64_t*)data; k *= m; /* in injec ject t diff iffer erenc ence e D1 1 */ k ^= k >> 24; k *= m; /* dif diff f in k n k: : 0x8 0x800 000000 00000 00000 00000 0000 */ h *= m; h ^= k; data += 8; len -= 8;

}

slide-62
SLIDE 62

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { /* fi first rst b block

  • ck */

uint64_t k = *(uint64_t*)data; k *= m; /* in injec ject t diff iffer erenc ence e D1 1 */ k ^= k >> 24; k *= m; /* dif diff f in k n k: : 0x8 0x800 000000 00000 00000 00000 0000 */ h *= m; h ^= k; /* di diff ff in in h: h: 0x 0x800 80000 000000 00000 00000 00000 00 */ data += 8; len -= 8;

}

slide-63
SLIDE 63

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { /* se secon cond d bloc lock k */ uint64_t k = *(uint64_t*)data; k *= m; /* in injec ject t diff iffer erenc ence e D2 2 */ k ^= k >> 24; k *= m; /* di diff ff in in k: k: 0x 0x800 80000 000000 00000 00000 00000 00 */ h *= m; h ^= k; data += 8; len -= 8;

}

slide-64
SLIDE 64

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { /* se secon cond d bloc lock k */ uint64_t k = *(uint64_t*)data; k *= m; /* in injec ject t diff iffer erenc ence e D2 2 */ k ^= k >> 24; k *= m; /* di diff ff in in k: k: 0x 0x800 80000 000000 00000 00000 00000 00 */ h *= m; /* di diff ff in in h s h sti till: ll: 0x800 80000 00000 00000 000000 00000 00 */ h ^= k; data += 8; len -= 8;

}

slide-65
SLIDE 65

con const st uint64_t m = (0xc6a4a793 << 32) | 0x5bd1e995; uint64_t h = seed ^ len; whi while le (len >= 8) { /* se secon cond d bloc lock k */ uint64_t k = *(uint64_t*)data; k *= m; /* in injec ject t diff iffer erenc ence e D2 2 */ k ^= k >> 24; k *= m; /* di diff ff in in k: k: 0x 0x800 80000 000000 00000 00000 00000 00 */ h *= m; /* di diff ff in in h s h sti till: ll: 0x800 80000 00000 00000 000000 00000 00 */ h ^= k; /* CO COLLI LLISI SION ! N !!! !! (0 (0x80 x80.. ... ^ ^ 0x 0x80. 80... .. = 0 = 0) ) */ data += 8; len -= 8;

}

slide-66
SLIDE 66

M1 M2 collision M3 M4 collision M5 M6 collision

slide-67
SLIDE 67
slide-68
SLIDE 68
slide-69
SLIDE 69
slide-70
SLIDE 70
slide-71
SLIDE 71
slide-72
SLIDE 72
slide-73
SLIDE 73
slide-74
SLIDE 74
slide-75
SLIDE 75
slide-76
SLIDE 76

http://crypto.junod.info/2012/12/13/hash-dos-and-btrfs/

slide-77
SLIDE 77
slide-78
SLIDE 78
slide-79
SLIDE 79
slide-80
SLIDE 80
slide-81
SLIDE 81
slide-82
SLIDE 82
slide-83
SLIDE 83
slide-84
SLIDE 84
slide-85
SLIDE 85
slide-86
SLIDE 86
slide-87
SLIDE 87
slide-88
SLIDE 88

def ef parse_nested_query(qs, d = nil) params = KeySpaceConstrainedParams.new (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do do |p| k, v = p.split('=', 2).map { |s| unescape(s) } normalize_params(params, k, v) end end return params.to_params_hash end nd

slide-89
SLIDE 89

def ef unescape(s, encoding = Encoding::UTF_8) URI.decode_www_form_component(s, encoding) end nd

slide-90
SLIDE 90

def ef self.decode_www_form_component(str, enc=Encoding::UTF_8) raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str str.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc) end nd

slide-91
SLIDE 91
slide-92
SLIDE 92
slide-93
SLIDE 93

def ef parse_nested_query(qs, d = nil) params = KeySpaceConstrainedParams.new (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do do |p| k, v = p.split('=', 2).map { |s| unescape(s) } normalize_params(params, k, v) end end return params.to_params_hash end nd

slide-94
SLIDE 94

def ef normalize_params(params, name, v = nil) name =~ %r(\A[\[\]]*([^\[\]]+)\]*) k = $1 || '' … end nd

slide-95
SLIDE 95
slide-96
SLIDE 96
slide-97
SLIDE 97
slide-98
SLIDE 98
slide-99
SLIDE 99
slide-100
SLIDE 100
slide-101
SLIDE 101

def ef parse_nested_query(qs, d = nil) params = KeySpaceConstrainedParams.new (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do do |p| k, v = p.split('=', 2).map { |s| unescape(s) } normalize_params(params, k, v) end end return params.to_params_hash end nd

slide-102
SLIDE 102

cla lass ss KeySpaceConstrainedParams def ef []=(key, value) @size += key.size if if key && !@params.key?(key) raise RangeError, 'exceeded available parameter key space‘ if if @size > @limit @params[key] = value end nd end nd

slide-103
SLIDE 103
slide-104
SLIDE 104
slide-105
SLIDE 105
slide-106
SLIDE 106
slide-107
SLIDE 107
slide-108
SLIDE 108
slide-109
SLIDE 109
slide-110
SLIDE 110
slide-111
SLIDE 111
slide-112
SLIDE 112
slide-113
SLIDE 113
slide-114
SLIDE 114

Fix it at the root

slide-115
SLIDE 115

TM

slide-116
SLIDE 116
slide-117
SLIDE 117
slide-118
SLIDE 118

pub publi lic String(byte bytes[], int offset, int length, Charset charset) { … char[] v = StringCoding.decode(charset, bytes, offset, length); … }

problem, byte[] ?

slide-119
SLIDE 119
slide-120
SLIDE 120
slide-121
SLIDE 121
slide-122
SLIDE 122

pub ublic lic String(char value[]) { int size = value.length; this.offset = 0; this.count = size; this.value = Arrays.copyOf(value, size); }

slide-123
SLIDE 123
slide-124
SLIDE 124
slide-125
SLIDE 125
slide-126
SLIDE 126
slide-127
SLIDE 127
slide-128
SLIDE 128
slide-129
SLIDE 129
slide-130
SLIDE 130
slide-131
SLIDE 131
slide-132
SLIDE 132
slide-133
SLIDE 133

http://www.ruby-lang.org/en/news/2012/11/09/ruby19-hashdos-cve-2012-5371/

http://jruby.org/2012/12/03/jruby-1-7-1.html https://github.com/rubinius/rubinius/commit/a9a40fc6a1256bcf6382631b710430105c5dd868

slide-134
SLIDE 134
slide-135
SLIDE 135
slide-136
SLIDE 136
slide-137
SLIDE 137

Don’t use MurmurHash

slide-138
SLIDE 138

CityHash?

slide-139
SLIDE 139

“Inside Google, where CityHash was developed starting in 2010, we use variants of CityHash64() mainly in hash tables such as hash_map<string, int>.”

https://code.google.com/p/cityhash/

slide-140
SLIDE 140

CityHash64( 0Y|L&:$;+[&HASH!, 16 ) CityHash64( JkMR_ 0\7](HASH!, 16 ) CityHash64( <jiI7g;s,`(HASH!, 16 ) CityHash64( e: yn"sg^a(HASH!, 16 ) CityHash64( dt6PG8}?oz(HASH!, 16 ) CityHash64( 8c-lkD%_Eo)HASH!, 16 ) CityHash64( TdIx>DnK-1*HASH!, 16 ) CityHash64( iM:9l=S"|e*HASH!, 16 ) CityHash64( Z,r_|5xM0l*HASH!, 16 ) CityHash64( .QH~S!9P(p*HASH!, 16 ) CityHash64( {pF*"wkd[F+HASH!, 16 ) CityHash64( i< @)`oy+?,HASH!, 16 ) CityHash64( BU9[85WWp/ HASH!, 16 ) CityHash64( 8{YDLn;d.2 HASH!, 16 ) CityHash64( d+nkK&t?yr HASH!, 16 ) CityHash64( {A.#v5i]V{ HASH!, 16 ) = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f = b553de6f34e878f

CityHash is weaker than MurmurHash

slide-141
SLIDE 141

Python’s hash()?

slide-142
SLIDE 142

$ python -V Python 2.7.3 $ time -p python -R poc.py 64 candidate solutions Verified solutions for _Py_HashSecret: 145cc9aade7d2453 275daf6070a41b99 945cc9aade7d2453 a75daf6070a41b99 real 0.32 user 0.17 sys 0.02

slide-143
SLIDE 143

Python 2.x and 3.x

  • Randomization of hash() optional (-R)
  • Instantaneous key recovery
  • Multicollisions with TMTO
slide-144
SLIDE 144

.NET’s Marvin32?

slide-145
SLIDE 145

Something designed to be secure?

slide-146
SLIDE 146

Si SipHash ash: : a fast t short

  • rt-in

input put PRF

New keyed hash to fix hash-flooding:

  • Rigorous security requirements and analysis
  • Speed competitive with that of weak hashes
  • Can serve as MAC or PRF

Peer-reviewed research paper (A., Bernstein). published at DIAC 2012, INDOCRYPT 2012

slide-147
SLIDE 147

SipHash initialization

256-bit state v0 v1 v2 v3 128-bit key k0 k1 v0 = k0 ⊕ 0x736f6d6570736575 v1 = k1 ⊕ 0x646f72616e646f6d v2 = k0 ⊕ 0x6c7967656e657261 v3 = k1 ⊕ 0x7465646279746573

slide-148
SLIDE 148

SipHash initialization

256-bit state v0 v1 v2 v3 128-bit key k0 k1 v0 = k0 ⊕ “somepseu” v1 = k1 ⊕ “dorandom” v2 = k0 ⊕ “lygenera” v3 = k1 ⊕ “tedbytes”

slide-149
SLIDE 149

SipHash compression

Message parsed as 64-bit words m0 m0, m1 m1, …

v3 ⊕= m0 c iterations of SipRound v0 ⊕= m0

slide-150
SLIDE 150

SipHash compression

Message parsed as 64-bit words m0 m0, m1 m1, …

v3 ⊕= m1 c iterations of SipRound v0 ⊕= m1

slide-151
SLIDE 151

SipHash compression

Message parsed as 64-bit words m0 m0, m1 m1, …

v3 ⊕= m2 c iterations of SipRound v0 ⊕= m2

slide-152
SLIDE 152

SipHash compression

Message parsed as 64-bit words m0 m0, m1 m1, …

Etc.

slide-153
SLIDE 153

SipRound

slide-154
SLIDE 154

SipHash finalization

v2 ⊕= 255 d iterations of SipRound Return v0 ⊕ v1 ⊕ v2 ⊕ v3

slide-155
SLIDE 155

SipHash-2-4 hashing 15 bytes

slide-156
SLIDE 156

Family SipHash-c-d Fast proposal: SipHash-2-4 Conservative proposal: SipHash-4-8 Weaker versions for cryptanalysis: SipHash-1-0, SipHash-2-0, etc. SipHash-1-1, SipHash-2-1, etc. Etc.

slide-157
SLIDE 157

Security claims

≈ 2128 key recovery ≈ 2192 state recovery ≈ 2128 internal-collision forgery ≈ 2s forgery with probab. 2s-64

slide-158
SLIDE 158

Fast diffusion of differences, thanks to optimized rotation counts

Combination of ADD and XOR ensures a high nonlinearity (e.g. against cube attacks)

slide-159
SLIDE 159

How fast is SipHash-2-4?

On an old AMD Athlon II Neo (@1.6GHz) Long messages: 1.44 cycles/byte (1 1 GiBp Bps)

Bytes 8 16 32 64 Cycles (per byte) 123 (15.38) 134 (8.38) 158 (4.25) 204 (3.19) MiBps 99 182 359 478

slide-160
SLIDE 160
slide-161
SLIDE 161

Proof of simplicity

June 20: paper published online June 28: 18

18 third-party implementations

C (Floodyberry, Boßlet, Neves); C# C# (Haynes) Cryptol

  • l (Lazar); Erlang

ng, Javascri script, PHP (Denis) Go Go (Chestnykh); Haskel kell (Hanquez) Java, Ruby (Boßlet); Lisp (Brown); Perl6 (Julin)

slide-162
SLIDE 162

Who is using SipHash?

Rust

CRuby Soon: Perl 5 Rubinius

slide-163
SLIDE 163

Take home message

Hash-flooding DoS works by enforcing worst case in data structure operations through large multicollisions in the hash function Java and Rubies found vulnerable, due to their use of MurmurHash v2 or v3 CityHash and Python’s hash are weak too… SipHash offers both security and performance

slide-164
SLIDE 164

SipHash paper, code, etc. available on https://131002.net/siphash

Attacks paper coming soon…