Top Banner
XML External Entities [XXE] Slipping in through the XML backdoor
13
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Xml external entities [xxe]

XML External Entities [XXE]Slipping in through the XML backdoor

Page 2: Xml external entities [xxe]

XML is boring, but

Page 3: Xml external entities [xxe]

What is it?• XML 1.0 specification allows for “Entity Declaration”

• This allows XML documents to be more dynamic

• Here are a couple examples

Page 4: Xml external entities [xxe]

Who is affected?• Lots of apps use XML

• Lots of formats rely on XML

• Lots of configuration files for apps use XML

• Lots of protocols rely on XML

• Some use it without even knowing it

Page 5: Xml external entities [xxe]

Who cares?• Attacker and defenders should care because…

this is also a valid XXE Declaration:

Page 6: Xml external entities [xxe]

Who cares?• Attacker and defenders should care because…

this is also a valid XXE Declaration:

• …aaaaaand so is this!

Page 7: Xml external entities [xxe]

What can you exploit? • Denial of service

• File enumeration

• Network enumeration

• Port scanning

• Directory listing

• File exfiltration

…sometimes WITHOUT AUTH

Page 8: Xml external entities [xxe]

Lets see it…

Page 9: Xml external entities [xxe]

How do you stop it?• Coders that know about XXE don’t reflect XML back

• But that didn’t work well • Because error messages

• Because response timing differences

• Because Timur Yunusov & Alexey Osipov Out-of-Band XXE attack

Page 10: Xml external entities [xxe]

How do you stop it? Take two• A lot of parser libraries added the option to disable XXE

• But that didn’t work well • Because many coders don’t realize this is an attack vector

Page 11: Xml external entities [xxe]

How do you stop it? Take three• A lot of parser libraries disable XXE by default

• Actually works pretty well• …provided your libraries are up to date.

• …no dumb ass developers enabled ittt

Page 12: Xml external entities [xxe]

Summary• XML is all over the place

• XXE is really bad

• If defending, make sure you are not vulnerable

• If attacking, make sure you test for XXE, cause it’s really SWEET if you find it

Page 13: Xml external entities [xxe]

Shout-outs• Lots of smart people have researched and talked about this

• Timur Yunusov & Alexey Osipov OOB XXE talk at Blackhat 2013

• Timothy D. Morgan - What You Didn't Know About XML External Entities Attacks

• Alex Lauerman @ TrustFoundry