SlideShare une entreprise Scribd logo
1  sur  29
XXE Injection 
Tấn công & Phòng thủ 
Bootcamp - 10/2014 
Nguyễn Tăng Hưng 
Information Security Analyst 
FPT Telecom
Nội dung trình bày 
 Giới thiệu 
 XML External Entity (XXE) - 101 
 XXE Attack 
 Kỹ thuật phát hiện lỗi 
 Kỹ thuật phòng tránh 
 Tham khảo
Giới thiệu
Lịch sử phát hiện 
 Nguồn: Trên Bugtraq 10/2002: XXE: 
http://www.securityfocus.com/archive/1/297714/2002-10-27/2002-11-02/ Không mới, nhưng......
Đến năm 2014,.....
Đến năm 2014,...
Đến năm 2014,...
Thống kê từ CVE 
 
 Nguồn: PHP Conference Japan 2013 - Speaker: Kousuke Ebihara
Thống kê từ OSVDB 
 Từ khóa XXE
XML External Entity 101
XML External Entity 
 XML (Extensible Markup Language): là một 
tiêu chuẩn để trao đổi dữ liệu có cấu trúc 
theo định dạng text. 
 Ví dụ: 
<?xml version="1.0" encoding="UTF-8"?> 
<user> 
<userid>0</userid> 
<username>Hung</username> 
<lastname>Nguyen</lastname> 
<job>troller</job> 
</user>
XML External Entity 
 Entity: có thể được sử dụng như một kiểu 
tham chiếu đến dữ liệu, cho phép thay thế 
một ký tự đặc biêt, một khối văn bản hay 
thậm chí toàn bộ nội dung một file vào trong 
tài liệu xml. Một số kiểu entity: character, 
named (internal), external, parameter. 
 Ví dụ: 
- &amps; -> & 
- &lt; -> < 
- &gt; -> > 
- &#x41; -> A 
- <!ENTITY n "Hung">
XML External Entity 
 External entity: entity tham chiếu đến nội 
dung một file bên ngoài tài liệu xml 
 Ví dụ: 
<!DOCTYPE order SYSTEM "order.dtd"> 
<!DOCTYPE ran SYSTEM "/dev/random"> 
<!DOCTYPE request [ 
<!ENTITY include SYSTEM "c:boot.ini"> 
]>
XXE Attack
Các bước trong quá trình xác định 
External Entity 
 Phân giải 
- XML 
- DOCTYPE 
- Các khai báo Entities 
 Resolve các external entities 
- Thư viện xml 
- Entity loader từ framework
XXE Attack 
 Khi DTD (Document Type Definition) được 
xử lý, ứng dụng có thể đọc hoặc nhúng file 
vào trong tài liệu XML. Nếu có khả năng điều 
khiển được nội dung của DTD, khi đó 
attacker có thể chỉ định truy xuất các tài 
nguyên nhạy cảm hoặc thực hiện các kiểu 
khai thác khác. 
 Ví dụ: 
<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE request [ 
<!ENTITY here SYSTEM "file:///etc/passwd"> 
]>
Nguy cơ của XXE Attack 
 Information Exposed 
 Port scanning 
 DOS 
 SSRF 
 ...
Demo 1 - Một số nguy cơ XXE
Kỹ thuật phát hiện lỗi
Error based XXE Injection 
 Ý tưởng: ' ; " ; < ; <!-- 
 Từ khóa: 
- "parser error" 
- "failed to load external entity" 
- "XMLParserError" 
- "Unknown language DATA" 
- "Login DATA are not valid" 
- "Password for user DATA does not match"
Demo 2 - Error based XXE Injection
ini_set('display_errors', 'Off'); 
error_reporting(0);
Kết thúc ????
Blind XXE Injection 
 Kỹ thuật 1: 
 Ý tưởng: 
- Sử dụng cơ chế thẩm tra DTD & XSD 
- Thu thập trạng thái của kết quả thẩm tra (dựa 
vào kết quả hay lỗi) 
 Hạn chế: 
- Không phải ứng dụng nào cũng hiện thực việc 
thẩm tra trước khi xử lý 
- Không áp dụng được trên PHP trong một số 
trường hợp 
- ...
Blind XXE Injection (tt) 
 Kỹ thuật 2: Timed - based 
 Ý tưởng: 
- Còn nhớ ví dụ DOS ở trên ?
Demo 3 - Time based XXE
Demo 4 - Phối hợp với Burp Suite
Kỹ thuật phòng tránh 
 Update, update & update 
- libxml2 -> version 2.9.0 
/* 
https://git.gnome.org/browse/libxml2/commit/?id=8915c 
*/ 
- PHP -> version 5.3.23 
/* https://github.com/php/php-src/ 
commit/8e76d0404b7f664ee6719fd98f0483f0ac46 
69d6*/ 
- Net Framework -> version 4 
- Java 
/* 
https://www.owasp.org/index.php/XML_External_Entit
Tham khảo 
 http://www.securityfocus.com/archive/1/2977 
14 
 https://www.owasp.org/index.php/XML_Exter 
nal_Entity_(XXE)_Processing 
 Introduction of XXE attack and XML Bomb 
with PHP - Kousuke Ebihara - PHPCon 
Japan, 2013 
 Blind XXE injections - HackPra, Germany, 
Bochum, 05/2012 
 Google :-)

Contenu connexe

Tendances

ReCertifying Active Directory
ReCertifying Active DirectoryReCertifying Active Directory
ReCertifying Active DirectoryWill Schroeder
 
Basics of Server Side Template Injection
Basics of Server Side Template InjectionBasics of Server Side Template Injection
Basics of Server Side Template InjectionVandana Verma
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat Security Conference
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)CODE WHITE GmbH
 
Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionMikhail Egorov
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing TechniquesAvinash Thapa
 
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS FilterX-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS FilterMasato Kinugawa
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricksGarethHeyes
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Bernardo Damele A. G.
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?Yurii Bilyk
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourSoroush Dalili
 
Insecure direct object reference (null delhi meet)
Insecure direct object reference (null delhi meet)Insecure direct object reference (null delhi meet)
Insecure direct object reference (null delhi meet)Abhinav Mishra
 
Bypass file upload restrictions
Bypass file upload restrictionsBypass file upload restrictions
Bypass file upload restrictionsMukesh k.r
 

Tendances (20)

ReCertifying Active Directory
ReCertifying Active DirectoryReCertifying Active Directory
ReCertifying Active Directory
 
Basics of Server Side Template Injection
Basics of Server Side Template InjectionBasics of Server Side Template Injection
Basics of Server Side Template Injection
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
 
Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protection
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
XXE - XML External Entity Attack
XXE - XML External Entity Attack	XXE - XML External Entity Attack
XXE - XML External Entity Attack
 
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS FilterX-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
 
XXE
XXEXXE
XXE
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricks
 
A Threat Hunter Himself
A Threat Hunter HimselfA Threat Hunter Himself
A Threat Hunter Himself
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
 
Xss attack
Xss attackXss attack
Xss attack
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
ZeroNights 2018 | I <"3 XSS
ZeroNights 2018 | I <"3 XSSZeroNights 2018 | I <"3 XSS
ZeroNights 2018 | I <"3 XSS
 
Insecure direct object reference (null delhi meet)
Insecure direct object reference (null delhi meet)Insecure direct object reference (null delhi meet)
Insecure direct object reference (null delhi meet)
 
Bypass file upload restrictions
Bypass file upload restrictionsBypass file upload restrictions
Bypass file upload restrictions
 

En vedette

Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
Thu 6   03 bootcamp 2014 - xxe injection - nguyen tang hungThu 6   03 bootcamp 2014 - xxe injection - nguyen tang hung
Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hungSecurity Bootcamp
 
Networking Goal -week 1
Networking Goal -week 1Networking Goal -week 1
Networking Goal -week 1Võ Thái Lâm
 
e-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sen
e-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sene-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sen
e-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa SenVõ Thái Lâm
 
Block out time to network
Block out time to networkBlock out time to network
Block out time to networkVõ Thái Lâm
 
Opportunity management
Opportunity managementOpportunity management
Opportunity managementVõ Thái Lâm
 
Digital Agenda for Europe
Digital Agenda for EuropeDigital Agenda for Europe
Digital Agenda for EuropeVõ Thái Lâm
 
Giới thiệu Cty CP Tin học Lạc Tiên
Giới thiệu Cty CP Tin học Lạc TiênGiới thiệu Cty CP Tin học Lạc Tiên
Giới thiệu Cty CP Tin học Lạc TiênVõ Thái Lâm
 
How to implement a CRM project
How to implement a CRM projectHow to implement a CRM project
How to implement a CRM projectVõ Thái Lâm
 
Giới thiệu các chức năng của Bitrix24 - Bitrix self-hosted
Giới thiệu các chức năng của Bitrix24  - Bitrix self-hostedGiới thiệu các chức năng của Bitrix24  - Bitrix self-hosted
Giới thiệu các chức năng của Bitrix24 - Bitrix self-hostedVõ Thái Lâm
 
Doanh thu tăng từ đòn bẩy công nghệ - focusBASIC
Doanh thu tăng từ đòn bẩy công nghệ - focusBASICDoanh thu tăng từ đòn bẩy công nghệ - focusBASIC
Doanh thu tăng từ đòn bẩy công nghệ - focusBASICVõ Thái Lâm
 
Giới thiệu về ActionCOACH
Giới thiệu về ActionCOACHGiới thiệu về ActionCOACH
Giới thiệu về ActionCOACHVõ Thái Lâm
 
Bí quyết của người trồng ngô (bắp)
Bí quyết của người trồng ngô (bắp)Bí quyết của người trồng ngô (bắp)
Bí quyết của người trồng ngô (bắp)Võ Thái Lâm
 
Top 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lý
Top 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lýTop 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lý
Top 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lýVõ Thái Lâm
 
Top 10 mobile security risks - Khổng Văn Cường
Top 10 mobile security risks - Khổng Văn CườngTop 10 mobile security risks - Khổng Văn Cường
Top 10 mobile security risks - Khổng Văn CườngVõ Thái Lâm
 
Giới thiệu về mình hiệu quả chỉ trong 60s
Giới thiệu về mình hiệu quả chỉ trong 60sGiới thiệu về mình hiệu quả chỉ trong 60s
Giới thiệu về mình hiệu quả chỉ trong 60sVõ Thái Lâm
 
Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...
Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...
Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...Võ Thái Lâm
 
7 Bí mật để trở thành người bán hàng xuất sắc
7 Bí mật để trở thành người bán hàng xuất sắc7 Bí mật để trở thành người bán hàng xuất sắc
7 Bí mật để trở thành người bán hàng xuất sắcVõ Thái Lâm
 

En vedette (20)

Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
Thu 6   03 bootcamp 2014 - xxe injection - nguyen tang hungThu 6   03 bootcamp 2014 - xxe injection - nguyen tang hung
Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
 
Networking Goal -week 1
Networking Goal -week 1Networking Goal -week 1
Networking Goal -week 1
 
e-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sen
e-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sene-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sen
e-Prior e-Trust - Lưu Thanh Trà - ĐH Hoa Sen
 
Block out time to network
Block out time to networkBlock out time to network
Block out time to network
 
20 points of meeting
20 points of meeting20 points of meeting
20 points of meeting
 
Opportunity management
Opportunity managementOpportunity management
Opportunity management
 
Digital Agenda for Europe
Digital Agenda for EuropeDigital Agenda for Europe
Digital Agenda for Europe
 
Giới thiệu Cty CP Tin học Lạc Tiên
Giới thiệu Cty CP Tin học Lạc TiênGiới thiệu Cty CP Tin học Lạc Tiên
Giới thiệu Cty CP Tin học Lạc Tiên
 
How to implement a CRM project
How to implement a CRM projectHow to implement a CRM project
How to implement a CRM project
 
Giới thiệu các chức năng của Bitrix24 - Bitrix self-hosted
Giới thiệu các chức năng của Bitrix24  - Bitrix self-hostedGiới thiệu các chức năng của Bitrix24  - Bitrix self-hosted
Giới thiệu các chức năng của Bitrix24 - Bitrix self-hosted
 
Chức năng SugarCRM
Chức năng SugarCRMChức năng SugarCRM
Chức năng SugarCRM
 
Doanh thu tăng từ đòn bẩy công nghệ - focusBASIC
Doanh thu tăng từ đòn bẩy công nghệ - focusBASICDoanh thu tăng từ đòn bẩy công nghệ - focusBASIC
Doanh thu tăng từ đòn bẩy công nghệ - focusBASIC
 
Giới thiệu về ActionCOACH
Giới thiệu về ActionCOACHGiới thiệu về ActionCOACH
Giới thiệu về ActionCOACH
 
Bí quyết của người trồng ngô (bắp)
Bí quyết của người trồng ngô (bắp)Bí quyết của người trồng ngô (bắp)
Bí quyết của người trồng ngô (bắp)
 
Top 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lý
Top 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lýTop 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lý
Top 10 Kỹ năng lãnh đạo dành cho chủ doanh nghiệp và nhà quản lý
 
Top 10 mobile security risks - Khổng Văn Cường
Top 10 mobile security risks - Khổng Văn CườngTop 10 mobile security risks - Khổng Văn Cường
Top 10 mobile security risks - Khổng Văn Cường
 
Giới thiệu về mình hiệu quả chỉ trong 60s
Giới thiệu về mình hiệu quả chỉ trong 60sGiới thiệu về mình hiệu quả chỉ trong 60s
Giới thiệu về mình hiệu quả chỉ trong 60s
 
B2B Selling skill
B2B Selling skillB2B Selling skill
B2B Selling skill
 
Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...
Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...
Tối ưu hóa hạ tầng và đảm bảo ATTT trong ngành ngân hàng - Võ Nhân Văn - ĐH D...
 
7 Bí mật để trở thành người bán hàng xuất sắc
7 Bí mật để trở thành người bán hàng xuất sắc7 Bí mật để trở thành người bán hàng xuất sắc
7 Bí mật để trở thành người bán hàng xuất sắc
 

Similaire à XXE injection - Nguyễn Tăng Hưng

Slide báo cáo: System Hacking
Slide báo cáo: System HackingSlide báo cáo: System Hacking
Slide báo cáo: System HackingHuynh Khang
 
Báo cáo system hacking
Báo cáo system hackingBáo cáo system hacking
Báo cáo system hackingHuynh Khang
 
Bao cao thuc tap tuan 1 Athena Tran Dang Khoa
Bao cao thuc tap tuan 1 Athena Tran Dang KhoaBao cao thuc tap tuan 1 Athena Tran Dang Khoa
Bao cao thuc tap tuan 1 Athena Tran Dang KhoaÂu Dương Bình
 
Web application-security
Web application-securityWeb application-security
Web application-securityVisla Team
 
Beezo Share - Donetnuke Deserialize
Beezo Share - Donetnuke DeserializeBeezo Share - Donetnuke Deserialize
Beezo Share - Donetnuke DeserializeBeezo
 
File inclusion attack(nop thay)
File inclusion attack(nop thay)File inclusion attack(nop thay)
File inclusion attack(nop thay)phanleson
 
Snort it-slideshares.blogspot.com
Snort it-slideshares.blogspot.comSnort it-slideshares.blogspot.com
Snort it-slideshares.blogspot.comphanleson
 
Security standard-present-th06-2013-shorter
Security standard-present-th06-2013-shorterSecurity standard-present-th06-2013-shorter
Security standard-present-th06-2013-shorternghia le trung
 
Slide metaploit
Slide metaploitSlide metaploit
Slide metaploitchungdv
 
Security standard-present-th07-2013-shorter
Security standard-present-th07-2013-shorterSecurity standard-present-th07-2013-shorter
Security standard-present-th07-2013-shorternghia le trung
 
Vu tuananh
Vu tuananhVu tuananh
Vu tuananhVũ Anh
 
SBC 2012 - Linux Hardening (Mẫn Thắng)
SBC 2012 - Linux Hardening (Mẫn Thắng)SBC 2012 - Linux Hardening (Mẫn Thắng)
SBC 2012 - Linux Hardening (Mẫn Thắng)Security Bootcamp
 
Bao caothuctap
Bao caothuctapBao caothuctap
Bao caothuctapLong Prồ
 
Vu tuananh
Vu tuananhVu tuananh
Vu tuananhVũ Anh
 
Báo cáo lần 1
Báo cáo lần 1Báo cáo lần 1
Báo cáo lần 1Anhh Hữu
 
SYSTEM HACKING - TUẦN 2
SYSTEM HACKING - TUẦN 2SYSTEM HACKING - TUẦN 2
SYSTEM HACKING - TUẦN 2Con Ranh
 
SYSTEM HACKING - TUẦN 1
SYSTEM HACKING - TUẦN 1SYSTEM HACKING - TUẦN 1
SYSTEM HACKING - TUẦN 1Con Ranh
 
Slide py-sys-devops-final-v1
Slide py-sys-devops-final-v1Slide py-sys-devops-final-v1
Slide py-sys-devops-final-v1Công TÔ
 

Similaire à XXE injection - Nguyễn Tăng Hưng (20)

Slide báo cáo: System Hacking
Slide báo cáo: System HackingSlide báo cáo: System Hacking
Slide báo cáo: System Hacking
 
Báo cáo system hacking
Báo cáo system hackingBáo cáo system hacking
Báo cáo system hacking
 
Bao cao thuc tap tuan 1 Athena Tran Dang Khoa
Bao cao thuc tap tuan 1 Athena Tran Dang KhoaBao cao thuc tap tuan 1 Athena Tran Dang Khoa
Bao cao thuc tap tuan 1 Athena Tran Dang Khoa
 
Web application-security
Web application-securityWeb application-security
Web application-security
 
Beezo Share - Donetnuke Deserialize
Beezo Share - Donetnuke DeserializeBeezo Share - Donetnuke Deserialize
Beezo Share - Donetnuke Deserialize
 
File inclusion attack(nop thay)
File inclusion attack(nop thay)File inclusion attack(nop thay)
File inclusion attack(nop thay)
 
Snort it-slideshares.blogspot.com
Snort it-slideshares.blogspot.comSnort it-slideshares.blogspot.com
Snort it-slideshares.blogspot.com
 
Metasploit
MetasploitMetasploit
Metasploit
 
Security standard-present-th06-2013-shorter
Security standard-present-th06-2013-shorterSecurity standard-present-th06-2013-shorter
Security standard-present-th06-2013-shorter
 
Slide metaploit
Slide metaploitSlide metaploit
Slide metaploit
 
Security standard-present-th07-2013-shorter
Security standard-present-th07-2013-shorterSecurity standard-present-th07-2013-shorter
Security standard-present-th07-2013-shorter
 
Vu tuananh
Vu tuananhVu tuananh
Vu tuananh
 
Bao cao
Bao caoBao cao
Bao cao
 
SBC 2012 - Linux Hardening (Mẫn Thắng)
SBC 2012 - Linux Hardening (Mẫn Thắng)SBC 2012 - Linux Hardening (Mẫn Thắng)
SBC 2012 - Linux Hardening (Mẫn Thắng)
 
Bao caothuctap
Bao caothuctapBao caothuctap
Bao caothuctap
 
Vu tuananh
Vu tuananhVu tuananh
Vu tuananh
 
Báo cáo lần 1
Báo cáo lần 1Báo cáo lần 1
Báo cáo lần 1
 
SYSTEM HACKING - TUẦN 2
SYSTEM HACKING - TUẦN 2SYSTEM HACKING - TUẦN 2
SYSTEM HACKING - TUẦN 2
 
SYSTEM HACKING - TUẦN 1
SYSTEM HACKING - TUẦN 1SYSTEM HACKING - TUẦN 1
SYSTEM HACKING - TUẦN 1
 
Slide py-sys-devops-final-v1
Slide py-sys-devops-final-v1Slide py-sys-devops-final-v1
Slide py-sys-devops-final-v1
 

Plus de Võ Thái Lâm

Đi tìm mục đích sống và niềm đam mê
Đi tìm mục đích sống và niềm đam mêĐi tìm mục đích sống và niềm đam mê
Đi tìm mục đích sống và niềm đam mêVõ Thái Lâm
 
Profile của Võ Thái Lâm
Profile của Võ Thái LâmProfile của Võ Thái Lâm
Profile của Võ Thái LâmVõ Thái Lâm
 
Planning bootcamp - Lập kế hoạch hành động cho doanh nghiệp
Planning bootcamp - Lập kế hoạch hành động cho doanh nghiệpPlanning bootcamp - Lập kế hoạch hành động cho doanh nghiệp
Planning bootcamp - Lập kế hoạch hành động cho doanh nghiệpVõ Thái Lâm
 
Điều gì đã tạo ra các thương hiệu nổi tiếng?
Điều gì đã tạo ra các thương hiệu nổi tiếng?Điều gì đã tạo ra các thương hiệu nổi tiếng?
Điều gì đã tạo ra các thương hiệu nổi tiếng?Võ Thái Lâm
 
Thực hành Quản lý thời gian
Thực hành Quản lý thời gian Thực hành Quản lý thời gian
Thực hành Quản lý thời gian Võ Thái Lâm
 
The 3-Week Diet Manual Full by Dr Brian
The 3-Week Diet Manual Full by Dr BrianThe 3-Week Diet Manual Full by Dr Brian
The 3-Week Diet Manual Full by Dr BrianVõ Thái Lâm
 
From Open Source to Open World
From Open Source to Open WorldFrom Open Source to Open World
From Open Source to Open WorldVõ Thái Lâm
 
Hướng dẫn sử dụng Teamlab Office - Quản lý dự án
Hướng dẫn sử dụng Teamlab Office - Quản lý dự ánHướng dẫn sử dụng Teamlab Office - Quản lý dự án
Hướng dẫn sử dụng Teamlab Office - Quản lý dự ánVõ Thái Lâm
 
Hướng dẫn SugarCRM - Leads
Hướng dẫn SugarCRM - LeadsHướng dẫn SugarCRM - Leads
Hướng dẫn SugarCRM - LeadsVõ Thái Lâm
 
Hướng dẫn SugarCRM - Contacts
Hướng dẫn SugarCRM - ContactsHướng dẫn SugarCRM - Contacts
Hướng dẫn SugarCRM - ContactsVõ Thái Lâm
 
Lựa chọn giải pháp CRM đúng
Lựa chọn giải pháp CRM đúngLựa chọn giải pháp CRM đúng
Lựa chọn giải pháp CRM đúngVõ Thái Lâm
 
Khảo sát nhu cầu CRM
Khảo sát nhu cầu CRMKhảo sát nhu cầu CRM
Khảo sát nhu cầu CRMVõ Thái Lâm
 

Plus de Võ Thái Lâm (13)

Đi tìm mục đích sống và niềm đam mê
Đi tìm mục đích sống và niềm đam mêĐi tìm mục đích sống và niềm đam mê
Đi tìm mục đích sống và niềm đam mê
 
Profile của Võ Thái Lâm
Profile của Võ Thái LâmProfile của Võ Thái Lâm
Profile của Võ Thái Lâm
 
Planning bootcamp - Lập kế hoạch hành động cho doanh nghiệp
Planning bootcamp - Lập kế hoạch hành động cho doanh nghiệpPlanning bootcamp - Lập kế hoạch hành động cho doanh nghiệp
Planning bootcamp - Lập kế hoạch hành động cho doanh nghiệp
 
Điều gì đã tạo ra các thương hiệu nổi tiếng?
Điều gì đã tạo ra các thương hiệu nổi tiếng?Điều gì đã tạo ra các thương hiệu nổi tiếng?
Điều gì đã tạo ra các thương hiệu nổi tiếng?
 
Thực hành Quản lý thời gian
Thực hành Quản lý thời gian Thực hành Quản lý thời gian
Thực hành Quản lý thời gian
 
The 3-Week Diet Manual Full by Dr Brian
The 3-Week Diet Manual Full by Dr BrianThe 3-Week Diet Manual Full by Dr Brian
The 3-Week Diet Manual Full by Dr Brian
 
Môpro
MôproMôpro
Môpro
 
From Open Source to Open World
From Open Source to Open WorldFrom Open Source to Open World
From Open Source to Open World
 
Hướng dẫn sử dụng Teamlab Office - Quản lý dự án
Hướng dẫn sử dụng Teamlab Office - Quản lý dự ánHướng dẫn sử dụng Teamlab Office - Quản lý dự án
Hướng dẫn sử dụng Teamlab Office - Quản lý dự án
 
Hướng dẫn SugarCRM - Leads
Hướng dẫn SugarCRM - LeadsHướng dẫn SugarCRM - Leads
Hướng dẫn SugarCRM - Leads
 
Hướng dẫn SugarCRM - Contacts
Hướng dẫn SugarCRM - ContactsHướng dẫn SugarCRM - Contacts
Hướng dẫn SugarCRM - Contacts
 
Lựa chọn giải pháp CRM đúng
Lựa chọn giải pháp CRM đúngLựa chọn giải pháp CRM đúng
Lựa chọn giải pháp CRM đúng
 
Khảo sát nhu cầu CRM
Khảo sát nhu cầu CRMKhảo sát nhu cầu CRM
Khảo sát nhu cầu CRM
 

XXE injection - Nguyễn Tăng Hưng

  • 1. XXE Injection Tấn công & Phòng thủ Bootcamp - 10/2014 Nguyễn Tăng Hưng Information Security Analyst FPT Telecom
  • 2. Nội dung trình bày  Giới thiệu  XML External Entity (XXE) - 101  XXE Attack  Kỹ thuật phát hiện lỗi  Kỹ thuật phòng tránh  Tham khảo
  • 4. Lịch sử phát hiện  Nguồn: Trên Bugtraq 10/2002: XXE: http://www.securityfocus.com/archive/1/297714/2002-10-27/2002-11-02/ Không mới, nhưng......
  • 8. Thống kê từ CVE   Nguồn: PHP Conference Japan 2013 - Speaker: Kousuke Ebihara
  • 9. Thống kê từ OSVDB  Từ khóa XXE
  • 11. XML External Entity  XML (Extensible Markup Language): là một tiêu chuẩn để trao đổi dữ liệu có cấu trúc theo định dạng text.  Ví dụ: <?xml version="1.0" encoding="UTF-8"?> <user> <userid>0</userid> <username>Hung</username> <lastname>Nguyen</lastname> <job>troller</job> </user>
  • 12. XML External Entity  Entity: có thể được sử dụng như một kiểu tham chiếu đến dữ liệu, cho phép thay thế một ký tự đặc biêt, một khối văn bản hay thậm chí toàn bộ nội dung một file vào trong tài liệu xml. Một số kiểu entity: character, named (internal), external, parameter.  Ví dụ: - &amps; -> & - &lt; -> < - &gt; -> > - &#x41; -> A - <!ENTITY n "Hung">
  • 13. XML External Entity  External entity: entity tham chiếu đến nội dung một file bên ngoài tài liệu xml  Ví dụ: <!DOCTYPE order SYSTEM "order.dtd"> <!DOCTYPE ran SYSTEM "/dev/random"> <!DOCTYPE request [ <!ENTITY include SYSTEM "c:boot.ini"> ]>
  • 15. Các bước trong quá trình xác định External Entity  Phân giải - XML - DOCTYPE - Các khai báo Entities  Resolve các external entities - Thư viện xml - Entity loader từ framework
  • 16. XXE Attack  Khi DTD (Document Type Definition) được xử lý, ứng dụng có thể đọc hoặc nhúng file vào trong tài liệu XML. Nếu có khả năng điều khiển được nội dung của DTD, khi đó attacker có thể chỉ định truy xuất các tài nguyên nhạy cảm hoặc thực hiện các kiểu khai thác khác.  Ví dụ: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE request [ <!ENTITY here SYSTEM "file:///etc/passwd"> ]>
  • 17. Nguy cơ của XXE Attack  Information Exposed  Port scanning  DOS  SSRF  ...
  • 18. Demo 1 - Một số nguy cơ XXE
  • 19. Kỹ thuật phát hiện lỗi
  • 20. Error based XXE Injection  Ý tưởng: ' ; " ; < ; <!--  Từ khóa: - "parser error" - "failed to load external entity" - "XMLParserError" - "Unknown language DATA" - "Login DATA are not valid" - "Password for user DATA does not match"
  • 21. Demo 2 - Error based XXE Injection
  • 24. Blind XXE Injection  Kỹ thuật 1:  Ý tưởng: - Sử dụng cơ chế thẩm tra DTD & XSD - Thu thập trạng thái của kết quả thẩm tra (dựa vào kết quả hay lỗi)  Hạn chế: - Không phải ứng dụng nào cũng hiện thực việc thẩm tra trước khi xử lý - Không áp dụng được trên PHP trong một số trường hợp - ...
  • 25. Blind XXE Injection (tt)  Kỹ thuật 2: Timed - based  Ý tưởng: - Còn nhớ ví dụ DOS ở trên ?
  • 26. Demo 3 - Time based XXE
  • 27. Demo 4 - Phối hợp với Burp Suite
  • 28. Kỹ thuật phòng tránh  Update, update & update - libxml2 -> version 2.9.0 /* https://git.gnome.org/browse/libxml2/commit/?id=8915c */ - PHP -> version 5.3.23 /* https://github.com/php/php-src/ commit/8e76d0404b7f664ee6719fd98f0483f0ac46 69d6*/ - Net Framework -> version 4 - Java /* https://www.owasp.org/index.php/XML_External_Entit
  • 29. Tham khảo  http://www.securityfocus.com/archive/1/2977 14  https://www.owasp.org/index.php/XML_Exter nal_Entity_(XXE)_Processing  Introduction of XXE attack and XML Bomb with PHP - Kousuke Ebihara - PHPCon Japan, 2013  Blind XXE injections - HackPra, Germany, Bochum, 05/2012  Google :-)