<s>
In	O
cryptography	O
,	O
a	O
collision	B-Algorithm
attack	I-Algorithm
on	O
a	O
cryptographic	B-Algorithm
hash	I-Algorithm
tries	O
to	O
find	O
two	O
inputs	O
producing	O
the	O
same	O
hash	B-Algorithm
value	O
,	O
i.e.	O
</s>
<s>
a	O
hash	B-Algorithm
collision	I-Algorithm
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
to	O
a	O
preimage	O
attack	O
where	O
a	O
specific	O
target	O
hash	B-Algorithm
value	O
is	O
specified	O
.	O
</s>
<s>
There	O
are	O
roughly	O
two	O
types	O
of	O
collision	B-Algorithm
attacks	I-Algorithm
:	O
</s>
<s>
Classical	O
collision	B-Algorithm
attack	I-Algorithm
Find	O
two	O
different	O
messages	O
m1	O
and	O
m2	O
such	O
that	O
hash(m1 )	O
=	O
hash(m2 )	O
.	O
</s>
<s>
Chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
Given	O
two	O
different	O
prefixes	O
p1	O
and	O
p2	O
,	O
find	O
two	O
appendages	O
m1	O
and	O
m2	O
such	O
that	O
hash( p1	O
∥	O
m1	O
)	O
=	O
hash( p2	O
∥	O
m2	O
)	O
,	O
where	O
∥	O
denotes	O
the	O
concatenation	O
operation	O
.	O
</s>
<s>
Mathematically	O
stated	O
,	O
a	O
collision	B-Algorithm
attack	I-Algorithm
finds	O
two	O
different	O
messages	O
m1	O
and	O
m2	O
,	O
such	O
that	O
hash(m1 )	O
=	O
hash(m2 )	O
.	O
</s>
<s>
In	O
a	O
classical	O
collision	B-Algorithm
attack	I-Algorithm
,	O
the	O
attacker	O
has	O
no	O
control	O
over	O
the	O
content	O
of	O
either	O
message	O
,	O
but	O
they	O
are	O
arbitrarily	O
chosen	O
by	O
the	O
algorithm	O
.	O
</s>
<s>
Much	O
like	O
symmetric-key	B-Algorithm
ciphers	I-Algorithm
are	O
vulnerable	O
to	O
brute	O
force	O
attacks	O
,	O
every	O
cryptographic	B-Algorithm
hash	I-Algorithm
function	I-Algorithm
is	O
inherently	O
vulnerable	O
to	O
collisions	O
using	O
a	O
birthday	O
attack	O
.	O
</s>
<s>
A	O
hash	B-Algorithm
of	O
n	O
bits	O
can	O
be	O
broken	O
in	O
2n/2	O
time	O
steps	O
(	O
evaluations	O
of	O
the	O
hash	B-Algorithm
function	I-Algorithm
)	O
.	O
</s>
<s>
More	O
efficient	O
attacks	O
are	O
possible	O
by	O
employing	O
cryptanalysis	O
to	O
specific	O
hash	B-Algorithm
functions	I-Algorithm
.	O
</s>
<s>
When	O
a	O
collision	B-Algorithm
attack	I-Algorithm
is	O
discovered	O
and	O
is	O
found	O
to	O
be	O
faster	O
than	O
a	O
birthday	O
attack	O
,	O
a	O
hash	B-Algorithm
function	I-Algorithm
is	O
often	O
denounced	O
as	O
"	O
broken	O
"	O
.	O
</s>
<s>
The	O
NIST	B-Algorithm
hash	I-Algorithm
function	I-Algorithm
competition	I-Algorithm
was	O
largely	O
induced	O
by	O
published	O
collision	B-Algorithm
attacks	I-Algorithm
against	O
two	O
very	O
commonly	O
used	O
hash	B-Algorithm
functions	I-Algorithm
,	O
MD5	B-Algorithm
and	O
SHA-1	B-Algorithm
.	O
</s>
<s>
The	O
collision	B-Algorithm
attacks	I-Algorithm
against	O
MD5	B-Algorithm
have	O
improved	O
so	O
much	O
that	O
,	O
as	O
of	O
2007	O
,	O
it	O
takes	O
just	O
a	O
few	O
seconds	O
on	O
a	O
regular	O
computer	O
.	O
</s>
<s>
Hash	B-Algorithm
collisions	I-Algorithm
created	O
this	O
way	O
are	O
usually	O
constant	O
length	O
and	O
largely	O
unstructured	O
,	O
so	O
cannot	O
directly	O
be	O
applied	O
to	O
attack	O
widespread	O
document	O
formats	O
or	O
protocols	O
.	O
</s>
<s>
In	O
this	O
way	O
,	O
two	O
documents	O
would	O
be	O
created	O
which	O
are	O
as	O
similar	O
as	O
possible	O
in	O
order	O
to	O
have	O
the	O
same	O
hash	B-Algorithm
value	O
.	O
</s>
<s>
Some	O
document	O
formats	O
like	O
PostScript	B-Language
,	O
or	O
macros	O
in	O
Microsoft	B-Application
Word	I-Application
,	O
have	O
conditional	O
constructs	O
.	O
</s>
<s>
TIFF	O
files	O
can	O
contain	O
cropped	O
images	O
,	O
with	O
a	O
different	O
part	O
of	O
an	O
image	O
being	O
displayed	O
without	O
affecting	O
the	O
hash	B-Algorithm
value	O
.	O
</s>
<s>
PDF	B-Application
files	I-Application
are	O
vulnerable	O
to	O
collision	B-Algorithm
attacks	I-Algorithm
by	O
using	O
color	O
value	O
(	O
such	O
that	O
text	O
of	O
one	O
message	O
is	O
displayed	O
with	O
a	O
white	O
color	O
that	O
blends	O
into	O
the	O
background	O
,	O
and	O
text	O
of	O
the	O
other	O
message	O
is	O
displayed	O
with	O
a	O
dark	O
color	O
)	O
which	O
can	O
then	O
be	O
altered	O
to	O
change	O
the	O
signed	O
document	O
's	O
content	O
.	O
</s>
<s>
An	O
extension	O
of	O
the	O
collision	B-Algorithm
attack	I-Algorithm
is	O
the	O
chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
,	O
which	O
is	O
specific	O
to	O
Merkle	B-Algorithm
–	I-Algorithm
Damgård	I-Algorithm
hash	I-Algorithm
functions	I-Algorithm
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
attacker	O
can	O
choose	O
two	O
arbitrarily	O
different	O
documents	O
,	O
and	O
then	O
append	O
different	O
calculated	O
values	O
that	O
result	O
in	O
the	O
whole	O
documents	O
having	O
an	O
equal	O
hash	B-Algorithm
value	O
.	O
</s>
<s>
This	O
attack	O
is	O
much	O
more	O
powerful	O
than	O
a	O
classical	O
collision	B-Algorithm
attack	I-Algorithm
.	O
</s>
<s>
Mathematically	O
stated	O
,	O
given	O
two	O
different	O
prefixes	O
p1	O
,	O
p2	O
,	O
the	O
attack	O
finds	O
two	O
appendages	O
m1	O
and	O
m2	O
such	O
that	O
hash( p1	O
∥	O
m1	O
)	O
=	O
hash( p2	O
∥	O
m2	O
)	O
(	O
where	O
∥	O
is	O
the	O
concatenation	O
operation	O
)	O
.	O
</s>
<s>
In	O
2007	O
,	O
a	O
chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
was	O
found	O
against	O
MD5	B-Algorithm
,	O
requiring	O
roughly	O
250	O
evaluations	O
of	O
the	O
MD5	B-Algorithm
function	O
.	O
</s>
<s>
The	O
paper	O
also	O
demonstrates	O
two	O
X.509	O
certificates	O
for	O
different	O
domain	O
names	O
,	O
with	O
colliding	O
hash	B-Algorithm
values	O
.	O
</s>
<s>
This	O
means	O
that	O
a	O
certificate	B-Architecture
authority	I-Architecture
could	O
be	O
asked	O
to	O
sign	O
a	O
certificate	O
for	O
one	O
domain	O
,	O
and	O
then	O
that	O
certificate	O
(	O
specially	O
its	O
signature	O
)	O
could	O
be	O
used	O
to	O
create	O
a	O
new	O
rogue	O
certificate	O
to	O
impersonate	O
another	O
domain	O
.	O
</s>
<s>
A	O
real-world	O
collision	B-Algorithm
attack	I-Algorithm
was	O
published	O
in	O
December	O
2008	O
when	O
a	O
group	O
of	O
security	O
researchers	O
published	O
a	O
forged	O
X.509	O
signing	O
certificate	O
that	O
could	O
be	O
used	O
to	O
impersonate	O
a	O
certificate	B-Architecture
authority	I-Architecture
,	O
taking	O
advantage	O
of	O
a	O
prefix	O
collision	B-Algorithm
attack	I-Algorithm
against	O
the	O
MD5	B-Algorithm
hash	I-Algorithm
function	O
.	O
</s>
<s>
This	O
meant	O
that	O
an	O
attacker	O
could	O
impersonate	O
any	O
SSL-secured	O
website	O
as	O
a	O
man-in-the-middle	O
,	O
thereby	O
subverting	O
the	O
certificate	O
validation	O
built	O
in	O
every	O
web	B-Application
browser	I-Application
to	O
protect	O
electronic	O
commerce	O
.	O
</s>
<s>
Even	O
though	O
MD5	B-Algorithm
was	O
known	O
to	O
be	O
very	O
weak	O
in	O
2004	O
,	O
certificate	B-Architecture
authorities	I-Architecture
were	O
still	O
willing	O
to	O
sign	O
MD5-verified	O
certificates	O
in	O
December	O
2008	O
,	O
and	O
at	O
least	O
one	O
Microsoft	O
code-signing	O
certificate	O
was	O
still	O
using	O
MD5	B-Algorithm
in	O
May	O
2012	O
.	O
</s>
<s>
The	O
Flame	O
malware	O
successfully	O
used	O
a	O
new	O
variation	O
of	O
a	O
chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
to	O
spoof	O
code	O
signing	O
of	O
its	O
components	O
by	O
a	O
Microsoft	O
root	O
certificate	O
that	O
still	O
used	O
the	O
compromised	O
MD5	B-Algorithm
algorithm	O
.	O
</s>
<s>
In	O
2019	O
,	O
researchers	O
found	O
a	O
chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
against	O
SHA-1	B-Algorithm
with	O
computing	O
complexity	O
between	O
266.9	O
and	O
269.4	O
and	O
cost	O
less	O
than	O
100,000	O
US	O
dollars	O
.	O
</s>
<s>
In	O
2020	O
,	O
researchers	O
reduced	O
the	O
complexity	O
of	O
chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
against	O
SHA-1	B-Algorithm
to	O
263.4	O
.	O
</s>
<s>
Many	O
applications	O
of	O
cryptographic	B-Algorithm
hash	I-Algorithm
functions	I-Algorithm
do	O
not	O
rely	O
on	O
collision	O
resistance	O
,	O
thus	O
collision	B-Algorithm
attacks	I-Algorithm
do	O
not	O
affect	O
their	O
security	O
.	O
</s>
<s>
For	O
example	O
,	O
HMACs	B-Algorithm
are	O
not	O
vulnerable	O
.	O
</s>
<s>
For	O
the	O
attack	O
to	O
be	O
useful	O
,	O
the	O
attacker	O
must	O
be	O
in	O
control	O
of	O
the	O
input	O
to	O
the	O
hash	B-Algorithm
function	I-Algorithm
.	O
</s>
<s>
Because	O
digital	O
signature	O
algorithms	O
cannot	O
sign	O
a	O
large	O
amount	O
of	O
data	O
efficiently	O
,	O
most	O
implementations	O
use	O
a	O
hash	B-Algorithm
function	I-Algorithm
to	O
reduce	O
(	O
"	O
compress	O
"	O
)	O
the	O
amount	O
of	O
data	O
that	O
needs	O
to	O
be	O
signed	O
down	O
to	O
a	O
constant	O
size	O
.	O
</s>
<s>
Digital	O
signature	O
schemes	O
often	O
become	O
vulnerable	O
to	O
hash	B-Algorithm
collisions	I-Algorithm
as	O
soon	O
as	O
the	O
underlying	O
hash	B-Algorithm
function	I-Algorithm
is	O
practically	O
broken	O
;	O
techniques	O
like	O
randomized	O
(	O
salted	O
)	O
hashing	O
will	O
buy	O
extra	O
time	O
by	O
requiring	O
the	O
harder	O
preimage	O
attack	O
.	O
</s>
<s>
Mallory	O
creates	O
two	O
different	O
documents	O
A	O
and	O
B	O
that	O
have	O
an	O
identical	O
hash	B-Algorithm
value	O
,	O
i.e.	O
,	O
a	O
collision	O
.	O
</s>
<s>
Mallory	O
sends	O
document	O
A	O
to	O
Alice	O
,	O
who	O
agrees	O
to	O
what	O
the	O
document	O
says	O
,	O
signs	O
its	O
hash	B-Algorithm
,	O
and	O
sends	O
the	O
signature	O
to	O
Mallory	O
.	O
</s>
<s>
Because	O
the	O
digital	O
signature	O
matches	O
document	O
B	O
's	O
hash	B-Algorithm
,	O
Bob	O
's	O
software	O
is	O
unable	O
to	O
detect	O
the	O
substitution	O
.	O
</s>
<s>
In	O
2008	O
,	O
researchers	O
used	O
a	O
chosen-prefix	O
collision	B-Algorithm
attack	I-Algorithm
against	O
MD5	B-Algorithm
using	O
this	O
scenario	O
,	O
to	O
produce	O
a	O
rogue	O
certificate	B-Architecture
authority	I-Architecture
certificate	O
.	O
</s>
<s>
They	O
created	O
two	O
versions	O
of	O
a	O
TLS	B-Protocol
public	O
key	O
certificate	O
,	O
one	O
of	O
which	O
appeared	O
legitimate	O
and	O
was	O
submitted	O
for	O
signing	O
by	O
the	O
RapidSSL	O
certificate	B-Architecture
authority	I-Architecture
.	O
</s>
<s>
The	O
second	O
version	O
,	O
which	O
had	O
the	O
same	O
MD5	B-Algorithm
hash	I-Algorithm
,	O
contained	O
flags	O
which	O
signal	O
web	B-Application
browsers	I-Application
to	O
accept	O
it	O
as	O
a	O
legitimate	O
authority	O
for	O
issuing	O
arbitrary	O
other	O
certificates	O
.	O
</s>
<s>
Hash	B-Algorithm
flooding	O
(	O
also	O
known	O
as	O
HashDoS	O
)	O
is	O
a	O
denial	O
of	O
service	O
attack	O
that	O
uses	O
hash	B-Algorithm
collisions	I-Algorithm
to	O
exploit	O
the	O
worst-case	O
(	O
linear	O
probe	O
)	O
runtime	O
of	O
hash	B-Algorithm
table	I-Algorithm
lookups	O
.	O
</s>
<s>
To	O
execute	O
such	O
an	O
attack	O
,	O
the	O
attacker	O
sends	O
the	O
server	O
multiple	O
pieces	O
of	O
data	O
that	O
hash	B-Algorithm
to	O
the	O
same	O
value	O
and	O
then	O
tries	O
to	O
get	O
the	O
server	O
to	O
perform	O
slow	O
lookups	O
.	O
</s>
<s>
As	O
the	O
main	O
focus	O
of	O
hash	B-Algorithm
functions	I-Algorithm
used	O
in	O
hash	B-Algorithm
tables	I-Algorithm
was	O
speed	O
instead	O
of	O
security	O
,	O
most	O
major	O
programming	O
languages	O
were	O
affected	O
,	O
with	O
new	O
vulnerabilities	O
of	O
this	O
class	O
still	O
showing	O
up	O
a	O
decade	O
after	O
the	O
original	O
presentation	O
.	O
</s>
<s>
To	O
prevent	O
hash	B-Algorithm
flooding	O
without	O
making	O
the	O
hash	B-Algorithm
function	I-Algorithm
overly	O
complex	O
,	O
newer	O
keyed	B-Algorithm
hash	I-Algorithm
functions	I-Algorithm
are	O
introduced	O
,	O
with	O
the	O
security	O
objective	O
that	O
collisions	O
are	O
hard	O
to	O
find	O
as	O
long	O
as	O
the	O
key	O
is	O
unknown	O
.	O
</s>
<s>
They	O
may	O
be	O
slower	O
than	O
previous	O
hashes	B-Algorithm
,	O
but	O
are	O
still	O
much	O
easier	O
to	O
compute	O
than	O
cryptographic	B-Algorithm
hashes	I-Algorithm
.	O
</s>
<s>
As	O
of	O
2021	O
,	O
Daniel	O
J	O
.	O
Bernstein	O
's	O
SipHash	B-Error_Name
(	O
2012	O
)	O
is	O
the	O
most	O
widely-used	O
hash	B-Algorithm
function	I-Algorithm
in	O
this	O
class	O
.	O
</s>
<s>
(	O
Non-keyed	O
"	O
simple	O
"	O
hashes	B-Algorithm
remain	O
safe	O
to	O
use	O
as	O
long	O
as	O
the	O
application	O
's	O
hash	B-Algorithm
table	I-Algorithm
is	O
not	O
controllable	O
from	O
the	O
outside	O
.	O
)	O
</s>
<s>
It	O
is	O
possible	O
to	O
perform	O
an	O
analogous	O
attack	O
to	O
fill	O
up	O
Bloom	B-Algorithm
filters	I-Algorithm
using	O
a	O
(	O
partial	O
)	O
preimage	O
attack	O
.	O
</s>
