exploiting xxe in file parsing functionality demo xxe in docx pdf xxe javascript that included xml...

21
EXPLOITING XXE IN FILE UPLOAD FUNCTIONALITY BLACKHAT WEBCAST - 11/19/15 Will Vandevanter - @_will_is_

Upload: vutu

Post on 19-Mar-2018

385 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

EXPLOITING XXE IN FILEUPLOAD FUNCTIONALITY

BLACKHAT WEBCAST - 11/19/15Will Vandevanter - @_will_is_

Page 2: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

Agenda (30 minutes):

OOXML Format, Demo

Other File Formats, Demo

Further Exploitation

Slides, References, and Code:

oxmlxxe.github.io

Page 3: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

OFFICE OPEN XML (OPENXML; OOXML; OXML)

*.docx, *.pptx, *.xlsx

"Open" File Format developed by

Microsoft

Available for Office 2003, Default in

Office 2007

ZIP archive containing XML and media

files

Page 4: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform
Page 5: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

GENERAL PARSING OOXML

1. /_rels/.rels2. [Content_Types].xml3. Default Main Document Part

/word/document.xml/ppt/presentation.xml/xl/workbook.xml

Page 6: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform
Page 7: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

BUG BOUNTY: SLACK.COM

File Sharing Functionality

Page 8: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

BUG BOUNTY: FACEBOOK CAREERS

Q4 2014 - Mohamed RamadanResume Upload Functionality

Page 9: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

OXML_XXE DEMO

XXE in docx

Page 10: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

PDF XXEJavascript that included XML with an XXE

Exploited in Adobe Reader 7; 2005-06-15

Extensible Metadata Platform (XMP)

ISO Standard, Created by Adobe

Provides support for metadata without

breaking readability

Page 11: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

OXML_XXE DEMO

XXE in PDF

Page 12: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

XMP IN IMAGE FORMATS

GIF, PNGJPG

Lens Blur Camera Photo Feature

Page 13: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

Google Research - "Lens Blur in the new Google Camera App"(04/16/14)

Page 14: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform
Page 15: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform
Page 16: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

OXML_XXE DEMO

XXE in JPG

Page 17: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

XML

ENTITY

 

 

 

 

 

 

< !DOCTYPE root [

     < !ENTITY post "MYSTRING">

]>

DOCX

/word/document.xml

PPTX

/ppt/presentation.xml

XLSX

/xl/workbook.xml

Page 18: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

+OXML_XXE

XSS Testing< !ENTITY post "<script>alert(1)...

< !ENTITY post "< ![CDATA[<script>alert(1)...

LFI

Relationship Id="rId1"Type="...relationships/officeDocument"Target="/word/document.xml"

Page 19: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

+OXML FEATURES

hlinkHover

XSLTransform

Embedded "Documents"

SSRF

Page 20: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

+TESTING CHEATSHEET

Classic (X)XE

Canary Testing DTD and XE

XSS XE testing (CDATA/plain/attr)

XE LFI

Embedded (X)XE attacks

SSRF (X)XE

Page 21: Exploiting XXE in File Parsing Functionality DEMO XXE in docx PDF XXE Javascript that included XML with an XXE Exploited in Adobe Reader 7; 2005-06-15 Extensible Metadata Platform

SUMMARY POINTS

(DEFENSE) The libraries that parse XML on one part of the

site (e.g. API) may not be the same ones that parse uploaded

files; verify! Check configurations.

(DEFENSE) Patches exist, many are recent

(OFFENSE) Lots of surface area for exploitation

(OFFENSE) Untouched research targets

Thanks!

http://oxmlxxe.github.io