<s>
American	B-Application
fuzzy	I-Application
lop	I-Application
(	O
AFL	O
)	O
,	O
stylized	O
in	O
lowercase	O
as	O
american	B-Application
fuzzy	I-Application
lop	I-Application
,	O
is	O
a	O
free	B-Application
software	I-Application
fuzzer	O
that	O
employs	O
genetic	B-Algorithm
algorithms	I-Algorithm
in	O
order	O
to	O
efficiently	O
increase	O
code	B-Application
coverage	I-Application
of	O
the	O
test	O
cases	O
.	O
</s>
<s>
So	O
far	O
it	O
has	O
detected	O
dozens	O
of	O
significant	O
software	B-Error_Name
bugs	I-Error_Name
in	O
major	O
free	B-Application
software	I-Application
projects	O
,	O
including	O
X.Org	B-Operating_System
Server	I-Operating_System
,	O
PHP	B-Application
,	O
OpenSSL	B-Language
,	O
pngcrush	B-Language
,	O
bash	B-Operating_System
,	O
Firefox	B-Application
,	O
BIND	B-Protocol
,	O
Qt	B-Language
,	O
and	O
SQLite	B-Language
.	O
</s>
<s>
AFL	O
is	O
widely	O
used	O
in	O
academia	O
;	O
academic	O
fuzzers	O
are	O
often	O
forks	B-Application
of	O
AFL	O
,	O
and	O
AFL	O
is	O
commonly	O
used	O
as	O
a	O
baseline	O
to	O
evaluate	O
new	O
techniques	O
.	O
</s>
<s>
The	O
source	O
code	O
of	O
American	B-Application
fuzzy	I-Application
lop	I-Application
is	O
published	O
on	O
GitHub	B-Application
.	O
</s>
<s>
Its	O
name	O
is	O
a	O
reference	O
to	O
a	O
breed	O
of	O
rabbit	O
,	O
the	O
American	B-Application
Fuzzy	I-Application
Lop	I-Application
.	O
</s>
<s>
The	O
input	O
can	O
be	O
fed	O
to	O
the	O
tested	O
program	O
either	O
via	O
standard	O
input	O
or	O
as	O
an	O
input	O
file	O
specified	O
in	O
the	O
process	O
command	B-Application
line	I-Application
.	O
</s>
<s>
For	O
example	O
,	O
in	O
case	O
of	O
an	O
audio	O
player	O
,	O
American	B-Application
fuzzy	I-Application
lop	I-Application
can	O
be	O
instructed	O
to	O
open	O
a	O
short	O
sound	O
file	O
with	O
it	O
.	O
</s>
<s>
When	O
the	O
tested	O
program	B-General_Concept
crashes	I-General_Concept
or	O
hangs	B-General_Concept
,	O
this	O
usually	O
implies	O
the	O
discovery	O
of	O
a	O
new	O
bug	B-Error_Name
,	O
possibly	O
a	O
security	O
vulnerability	O
.	O
</s>
<s>
In	O
order	O
to	O
maximize	O
the	O
fuzzing	O
performance	O
,	O
American	B-Application
fuzzy	I-Application
lop	I-Application
expects	O
the	O
tested	O
program	O
to	O
be	O
compiled	B-Language
with	O
the	O
aid	O
of	O
a	O
utility	B-Application
program	I-Application
that	O
instruments	B-Application
the	O
code	O
with	O
helper	O
functions	O
which	O
track	O
control	O
flow	O
.	O
</s>
<s>
Fuzzers	O
attempt	O
to	O
find	O
unexpected	O
behaviors	O
(	O
i.e.	O
,	O
bugs	B-Error_Name
)	O
in	O
a	O
target	O
program	O
by	O
repeatedly	O
executing	O
the	O
program	O
on	O
various	O
inputs	O
.	O
</s>
<s>
As	O
described	O
above	O
,	O
AFL	O
is	O
a	O
gray-box	O
fuzzer	O
,	O
meaning	O
it	O
injects	O
instrumentation	B-Application
to	O
measure	O
code	B-Application
coverage	I-Application
into	O
the	O
target	O
program	O
at	O
compile	B-Language
time	O
and	O
uses	O
the	O
coverage	O
metric	O
to	O
direct	O
the	O
generation	O
of	O
new	O
inputs	O
.	O
</s>
<s>
The	O
algorithm	O
maintains	O
a	O
queue	B-Application
of	O
inputs	O
,	O
which	O
is	O
initialized	O
to	O
the	O
input	O
corpus	O
.	O
</s>
<s>
If	O
any	O
mutant	O
results	O
in	O
additional	O
code	B-Application
coverage	I-Application
,	O
add	O
it	O
to	O
the	O
queue	B-Application
.	O
</s>
<s>
If	O
the	O
mutant	O
results	O
in	O
a	O
crash	B-General_Concept
or	O
hang	O
,	O
save	O
it	O
to	O
disk	O
for	O
later	O
inspection	O
.	O
</s>
<s>
If	O
AFL	O
cycles	O
through	O
the	O
entire	O
queue	B-Application
without	O
generating	O
any	O
input	O
that	O
achieves	O
new	O
code	B-Application
coverage	I-Application
,	O
it	O
begins	O
splicing	O
.	O
</s>
<s>
Splicing	O
takes	O
two	O
inputs	O
from	O
the	O
queue	B-Application
,	O
truncates	B-Algorithm
them	O
at	O
arbitrary	O
positions	O
,	O
concatenates	O
them	O
together	O
,	O
and	O
applies	O
the	O
havoc	O
stage	O
to	O
the	O
result	O
.	O
</s>
<s>
AFL	O
pioneered	O
the	O
use	O
of	O
binned	O
hitcounts	O
for	O
measuring	O
code	B-Application
coverage	I-Application
.	O
</s>
<s>
An	O
input	O
is	O
considered	O
"	O
interesting	O
"	O
and	O
is	O
added	O
to	O
the	O
queue	B-Application
if	O
it	O
produces	O
a	O
(	O
tuple	O
,	O
binned	O
count	O
)	O
pair	O
that	O
is	O
not	O
yet	O
in	O
the	O
global	O
set	O
.	O
</s>
<s>
In	O
practice	O
,	O
the	O
hitcounts	O
are	O
collected	O
and	O
processed	O
using	O
an	O
efficient	O
but	O
lossy	B-Algorithm
scheme	O
.	O
</s>
<s>
The	O
compile-time	O
instrumentation	B-Application
injects	O
code	O
that	O
is	O
conceptually	O
similar	O
to	O
the	O
following	O
at	O
each	O
branch	O
in	O
the	O
control-flow	O
graph	O
of	O
the	O
target	O
program	O
:	O
</s>
<s>
where	O
<COMPILE_TIME_RANDOM>	O
is	O
a	O
random	O
integer	O
and	O
shared_mem	O
is	O
a	O
64	O
kilobyte	O
region	O
of	O
memory	O
shared	B-Operating_System
between	O
the	O
fuzzer	O
and	O
the	O
target	O
.	O
</s>
<s>
This	O
representation	O
is	O
more	O
fine-grained	O
(	O
distinguishes	O
between	O
more	O
executions	O
)	O
than	O
simple	O
block	O
or	O
statement	B-Application
coverage	I-Application
,	O
but	O
still	O
allows	O
for	O
a	O
linear-time	O
"	O
interestingness	O
"	O
test	O
.	O
</s>
<s>
On	O
the	O
assumption	O
that	O
smaller	O
inputs	O
take	O
less	O
time	O
to	O
execute	O
,	O
AFL	O
attempts	O
to	O
minimize	O
or	O
trim	O
the	O
test	O
cases	O
in	O
the	O
queue	B-Application
.	O
</s>
<s>
Trimming	O
works	O
by	O
removing	O
blocks	O
from	O
the	O
input	O
;	O
if	O
the	O
trimmed	O
input	O
still	O
results	O
in	O
the	O
same	O
coverage	O
(	O
see	O
#Measuring	O
coverage	O
)	O
,	O
then	O
the	O
original	O
input	O
is	O
discarded	O
and	O
the	O
trimmed	O
input	O
is	O
saved	O
in	O
the	O
queue	B-Application
.	O
</s>
<s>
AFL	O
selects	O
a	O
subset	O
of	O
favored	O
inputs	O
from	O
the	O
queue	B-Application
,	O
non-favored	O
inputs	O
are	O
skipped	O
with	O
some	O
probability	O
.	O
</s>
<s>
One	O
of	O
the	O
challenges	O
American	B-Application
fuzzy	I-Application
lop	I-Application
had	O
to	O
solve	O
involved	O
an	O
efficient	O
spawning	B-Language
of	O
hundreds	O
of	O
processes	O
per	O
second	O
.	O
</s>
<s>
Apart	O
from	O
the	O
original	O
engine	O
that	O
spawned	O
every	O
process	O
from	O
scratch	O
,	O
American	B-Application
fuzzy	I-Application
lop	I-Application
offers	O
the	O
default	O
engine	O
that	O
relies	O
heavily	O
on	O
the	O
fork	B-Application
system	O
call	O
.	O
</s>
<s>
This	O
can	O
further	O
be	O
sped	O
up	O
by	O
leveraging	O
LLVM	B-Application
deferred	O
fork	B-Application
server	O
mode	O
or	O
the	O
similar	O
persistent	O
mode	O
,	O
but	O
this	O
comes	O
at	O
the	O
cost	O
of	O
having	O
to	O
modify	O
the	O
tested	O
program	O
.	O
</s>
<s>
Also	O
,	O
American	B-Application
fuzzy	I-Application
lop	I-Application
supports	O
fuzzing	O
the	O
same	O
program	O
over	O
the	O
network	O
.	O
</s>
<s>
American	B-Application
fuzzy	I-Application
lop	I-Application
features	O
a	O
colorful	O
command	B-Application
line	I-Application
interface	I-Application
that	O
displays	O
real-time	O
statistics	O
about	O
the	O
fuzzing	O
process	O
.	O
</s>
<s>
Various	O
settings	O
may	O
be	O
triggered	O
by	O
either	O
command	B-Application
line	I-Application
options	I-Application
or	O
environment	O
variables	O
.	O
</s>
<s>
In	O
addition	O
to	O
afl-fuzz	B-Application
and	O
tools	O
that	O
can	O
be	O
used	O
for	O
binary	O
instrumentation	B-Application
,	O
American	B-Application
fuzzy	I-Application
lop	I-Application
features	O
utility	B-Application
programs	I-Application
meant	O
for	O
monitoring	O
of	O
the	O
fuzzing	O
process	O
.	O
</s>
<s>
This	O
can	O
be	O
useful	O
when	O
the	O
test	O
cases	O
generated	O
by	O
afl-fuzz	B-Application
would	O
be	O
used	O
by	O
other	O
fuzzers	O
.	O
</s>
<s>
AFL	O
has	O
been	O
forked	B-Application
many	O
times	O
in	O
order	O
to	O
examine	O
new	O
fuzzing	O
techniques	O
,	O
or	O
to	O
apply	O
fuzzing	O
to	O
different	O
kinds	O
of	O
programs	O
.	O
</s>
<s>
A	O
few	O
notable	O
forks	B-Application
include	O
:	O
</s>
<s>
AFL++	O
(	O
AFLplusplus	O
)	O
is	O
a	O
community-maintained	O
fork	B-Application
of	O
AFL	O
created	O
due	O
to	O
the	O
relative	O
inactivity	O
of	O
Google	B-Application
's	I-Application
upstream	O
AFL	O
development	O
since	O
September	O
2017	O
.	O
</s>
<s>
Google	B-Application
's	I-Application
OSS-Fuzz	O
initiative	O
,	O
which	O
provides	O
free	O
fuzzing	O
services	O
to	O
open	O
source	O
software	O
,	O
replaced	O
its	O
AFL	O
option	O
with	O
AFL++	O
in	O
January	O
2021	O
.	O
</s>
