<s>
XML	B-Protocol
External	I-Protocol
Entity	I-Protocol
attack	I-Protocol
,	O
or	O
simply	O
XXE	B-Protocol
attack	I-Protocol
,	O
is	O
a	O
type	O
of	O
attack	O
against	O
an	O
application	O
that	O
parses	O
XML	B-Protocol
input	O
.	O
</s>
<s>
This	O
attack	O
occurs	O
when	O
XML	B-Protocol
input	O
containing	O
a	O
reference	O
to	O
an	O
external	O
entity	O
is	O
processed	O
by	O
a	O
weakly	O
configured	O
XML	B-Protocol
parser	I-Protocol
.	O
</s>
<s>
The	O
XML	B-Protocol
1.0	O
standard	O
defines	O
the	O
structure	O
of	O
an	O
XML	B-Protocol
document	I-Protocol
.	O
</s>
<s>
One	O
of	O
those	O
types	O
of	O
entities	O
is	O
an	O
external	O
general/parameter	O
parsed	O
entity	O
,	O
often	O
shortened	O
to	O
external	O
entity	O
,	O
that	O
can	O
access	O
local	O
or	O
remote	O
content	O
via	O
a	O
declared	O
system	B-Language
identifier	I-Language
.	O
</s>
<s>
The	O
system	B-Language
identifier	I-Language
is	O
assumed	O
to	O
be	O
a	O
URI	B-Protocol
that	O
can	O
be	O
dereferenced	O
(	O
accessed	O
)	O
by	O
the	O
XML	B-Protocol
processor	O
when	O
processing	O
the	O
entity	O
.	O
</s>
<s>
The	O
XML	B-Protocol
processor	O
then	O
replaces	O
occurrences	O
of	O
the	O
named	O
external	O
entity	O
with	O
the	O
contents	O
dereferenced	O
by	O
the	O
system	B-Language
identifier	I-Language
.	O
</s>
<s>
If	O
the	O
system	B-Language
identifier	I-Language
contains	O
tainted	O
data	O
and	O
the	O
XML	B-Protocol
processor	O
dereferences	O
this	O
tainted	O
data	O
,	O
the	O
XML	B-Protocol
processor	O
may	O
disclose	O
confidential	O
information	O
normally	O
not	O
accessible	O
by	O
the	O
application	O
.	O
</s>
<s>
Similar	O
attack	O
vectors	O
apply	O
the	O
usage	O
of	O
external	O
DTDs	B-Language
,	O
external	O
style	O
sheets	O
,	O
external	O
schemas	B-Language
,	O
etc	O
.	O
</s>
<s>
Attacks	O
can	O
include	O
disclosing	O
local	O
files	O
,	O
which	O
may	O
contain	O
sensitive	O
data	O
such	O
as	O
passwords	O
or	O
private	O
user	O
data	O
,	O
using	O
file	O
:	O
schemes	O
or	O
relative	O
paths	O
in	O
the	O
system	B-Language
identifier	I-Language
.	O
</s>
<s>
Since	O
the	O
attack	O
occurs	O
relative	O
to	O
the	O
application	O
processing	O
the	O
XML	B-Protocol
document	I-Protocol
,	O
an	O
attacker	O
may	O
use	O
this	O
trusted	O
application	O
to	O
pivot	O
to	O
other	O
internal	O
systems	O
,	O
possibly	O
disclosing	O
other	O
internal	O
content	O
via	O
http(s )	O
requests	O
or	O
launching	O
a	O
CSRF	B-Protocol
attack	I-Protocol
to	O
any	O
unprotected	O
internal	O
services	O
.	O
</s>
<s>
In	O
some	O
situations	O
,	O
an	O
XML	B-Protocol
processor	O
library	O
that	O
is	O
vulnerable	O
to	O
client-side	O
memory	O
corruption	O
issues	O
may	O
be	O
exploited	O
by	O
dereferencing	O
a	O
malicious	O
URI	B-Protocol
,	O
possibly	O
allowing	O
arbitrary	O
code	O
execution	O
under	O
the	O
application	O
account	O
.	O
</s>
<s>
The	O
application	O
parses	O
XML	B-Protocol
documents	I-Protocol
.	O
</s>
<s>
Tainted	O
data	O
is	O
allowed	O
within	O
the	O
system	B-Language
identifier	I-Language
portion	O
of	O
the	O
entity	O
,	O
within	O
the	O
document	B-Language
type	I-Language
definition	I-Language
(	O
DTD	O
)	O
.	O
</s>
<s>
The	O
XML	B-Protocol
processor	O
is	O
configured	O
to	O
validate	O
and	O
process	O
the	O
DTD	O
.	O
</s>
<s>
The	O
XML	B-Protocol
processor	O
is	O
configured	O
to	O
resolve	O
external	O
entities	O
within	O
the	O
DTD	O
.	O
</s>
<s>
The	O
examples	O
below	O
are	O
from	O
OWASP	O
's	O
Testing	O
for	O
XML	B-Protocol
Injection	O
(	O
WSTG-INPV-07	O
)	O
.	O
</s>
<s>
When	O
the	O
PHP	B-Application
"	O
expect	O
"	O
module	O
is	O
loaded	O
,	O
remote	O
code	O
execution	O
may	O
be	O
possible	O
with	O
a	O
modified	O
payload	O
.	O
</s>
<s>
Since	O
the	O
entire	O
XML	B-Protocol
document	I-Protocol
is	O
communicated	O
from	O
an	O
untrusted	O
client	O
,	O
it	O
is	O
not	O
usually	O
possible	O
to	O
selectively	O
validate	O
or	O
escape	O
tainted	O
data	O
within	O
the	O
system	B-Language
identifier	I-Language
in	O
the	O
DTD	O
.	O
</s>
<s>
The	O
XML	B-Protocol
processor	O
could	O
be	O
configured	O
to	O
use	O
a	O
local	O
static	O
DTD	O
and	O
disallow	O
any	O
declared	O
DTD	O
included	O
in	O
the	O
XML	B-Protocol
document	I-Protocol
.	O
</s>
