<s>
,	O
HTTP	B-Protocol
request	I-Protocol
smuggling	I-Protocol
is	O
a	O
security	O
exploit	O
on	O
the	O
HTTP	B-Protocol
protocol	I-Protocol
that	O
takes	O
advantage	O
of	O
an	O
inconsistency	O
between	O
the	O
interpretation	O
of	O
Content-Length	O
and/or	O
Transfer-Encoding	O
headers	O
between	O
HTTP	B-Protocol
server	O
implementations	O
in	O
an	O
HTTP	B-Protocol
proxy	O
server	O
chain	O
.	O
</s>
<s>
The	O
Transfer-Encoding	O
header	O
works	O
by	O
defining	O
a	O
directive	O
on	O
how	O
to	O
interpret	O
the	O
body	O
of	O
the	O
HTTP	B-Protocol
request	O
,	O
with	O
the	O
common	O
and	O
necessary	O
directive	O
for	O
this	O
attack	O
being	O
the	O
Chunked	B-Protocol
transfer	I-Protocol
encoding	I-Protocol
.	O
</s>
<s>
Vulnerabilities	O
arise	O
when	O
both	O
of	O
these	O
headers	O
are	O
included	O
in	O
a	O
malicious	O
HTTP	B-Protocol
request	O
,	O
bypassing	O
security	O
functions	O
meant	O
to	O
prevent	O
malicious	O
HTTP	B-Protocol
queries	O
to	O
the	O
server	O
by	O
causing	O
either	O
the	O
front-end	B-Architecture
or	I-Architecture
back-end	I-Architecture
server	O
to	O
incorrectly	O
interpret	O
the	O
request	O
.	O
</s>
<s>
HTTP	B-Protocol
request	I-Protocol
smuggling	I-Protocol
commonly	O
takes	O
the	O
form	O
of	O
CL.TE	O
,	O
TE.CL	O
,	O
or	O
TE.TE	O
,	O
although	O
more	O
complex	O
attacks	O
using	O
HRS	O
do	O
exist	O
.	O
</s>
<s>
In	O
this	O
type	O
of	O
HTTP	B-Protocol
request	I-Protocol
smuggling	I-Protocol
,	O
the	O
front	B-Architecture
end	I-Architecture
processes	O
the	O
request	O
using	O
Content-Length	O
header	O
while	O
backend	B-Architecture
processes	O
the	O
request	O
using	O
Transfer-Encoding	O
header	O
.	O
</s>
<s>
The	O
front	B-Architecture
end	I-Architecture
server	O
seeing	O
this	O
would	O
only	O
read	O
the	O
first	O
part	O
of	O
the	O
request	O
and	O
unintentionally	O
pass	O
the	O
second	O
part	O
to	O
the	O
back	B-Architecture
end	I-Architecture
server	O
.	O
</s>
<s>
Once	O
passed	O
through	O
to	O
the	O
back	B-Architecture
end	I-Architecture
server	O
,	O
it	O
would	O
be	O
treated	O
as	O
the	O
next	O
request	O
and	O
processed	O
,	O
carrying	O
out	O
the	O
attackers	O
hidden	O
request	O
.	O
</s>
<s>
In	O
this	O
type	O
of	O
HTTP	B-Protocol
request	I-Protocol
smuggling	I-Protocol
,	O
the	O
front	B-Architecture
end	I-Architecture
processes	O
request	O
using	O
Transfer-Encoding	O
header	O
while	O
backend	B-Architecture
processes	O
the	O
request	O
using	O
Content-Length	O
header	O
.	O
</s>
<s>
When	O
the	O
front	B-Architecture
end	I-Architecture
server	O
sees	O
the	O
second	O
chunk	O
with	O
a	O
length	O
of	O
0	O
it	O
believes	O
the	O
request	O
to	O
be	O
complete	O
and	O
passes	O
it	O
along	O
to	O
the	O
back	B-Architecture
end	I-Architecture
server	O
.	O
</s>
<s>
The	O
back	B-Architecture
end	I-Architecture
server	O
processes	O
the	O
request	O
using	O
the	O
Content-Length	O
header	O
,	O
however	O
,	O
and	O
as	O
a	O
result	O
the	O
malicious	O
request	O
left	O
in	O
the	O
first	O
chunk	O
go	O
unprocessed	O
until	O
they	O
are	O
treating	O
as	O
being	O
at	O
the	O
start	O
of	O
next	O
request	O
in	O
the	O
sequence	O
and	O
are	O
carried	O
out	O
.	O
</s>
<s>
In	O
this	O
type	O
of	O
HTTP	B-Protocol
request	I-Protocol
smuggling	I-Protocol
,	O
the	O
front	B-Architecture
end	I-Architecture
and	O
backend	B-Architecture
both	O
process	O
the	O
request	O
using	O
Transfer-Encoding	O
header	O
,	O
but	O
the	O
header	O
can	O
be	O
obfuscated	O
in	O
a	O
way	O
(	O
for	O
example	O
by	O
nonstandard	O
whitespace	O
formatting	O
or	O
duplicate	O
headers	O
)	O
that	O
makes	O
one	O
of	O
the	O
servers	O
but	O
not	O
the	O
other	O
one	O
ignore	O
it	O
.	O
</s>
<s>
If	O
one	O
of	O
the	O
front	O
of	O
back	B-Architecture
end	I-Architecture
servers	O
still	O
processes	O
these	O
obfuscated	O
HTTP	B-Protocol
requests	I-Protocol
,	O
then	O
the	O
rest	O
of	O
the	O
attack	O
will	O
be	O
similar	O
to	O
how	O
CL.TE	O
or	O
TE.CL	O
attacks	O
work	O
.	O
</s>
<s>
The	O
best	O
prevention	O
to	O
these	O
attacks	O
would	O
clearly	O
be	O
if	O
front	B-Architecture
end	I-Architecture
and	I-Architecture
back	I-Architecture
end	I-Architecture
servers	O
interpreted	O
HTTP	B-Protocol
requests	I-Protocol
the	O
same	O
way	O
.	O
</s>
<s>
However	O
,	O
this	O
is	O
usually	O
not	O
an	O
option	O
as	O
load	O
balancers	O
that	O
support	O
backed	O
servers	O
run	O
on	O
distinct	O
platforms	O
,	O
meaning	O
you	O
cannot	O
run	O
the	O
same	O
software	O
on	O
both	O
the	O
front	B-Architecture
end	I-Architecture
and	O
the	O
back	B-Architecture
end	I-Architecture
.	O
</s>
<s>
A	O
way	O
to	O
prevent	O
against	O
most	O
variants	O
of	O
this	O
attack	O
is	O
by	O
using	O
HTTP/2	B-Protocol
as	O
it	O
is	O
not	O
vulnerable	O
to	O
most	O
request	O
smuggling	O
attacks	O
,	O
using	O
a	O
different	O
method	O
for	O
determining	O
the	O
length	O
of	O
a	O
request	O
.	O
</s>
<s>
Another	O
method	O
of	O
avoiding	O
the	O
attack	O
is	O
for	O
the	O
frontend	B-Architecture
server	O
to	O
normalize	O
HTTP	B-Protocol
requests	I-Protocol
before	O
passing	O
them	O
to	O
the	O
backend	B-Architecture
,	O
ensuring	O
that	O
they	O
get	O
interpreted	O
in	O
the	O
same	O
way	O
.	O
</s>
<s>
Configuring	O
a	O
web	B-Protocol
application	I-Protocol
firewall	I-Protocol
is	O
another	O
good	O
way	O
to	O
prevent	O
HRS	O
attacks	O
as	O
many	O
feature	O
technology	O
that	O
identify	O
attack	O
attempts	O
and	O
either	O
blocks	O
or	O
sanitize	O
the	O
suspicious	O
incoming	O
requests	O
.	O
</s>
