OWASP Taiwan Day 2017
Client Side Security And Testing Tools
(Evolution of)
david.cervigni@mindedsecurity.com
About me
 10+ yeas of development
 Software Security Enthusiast
 Securing SDLC
 Secure coding trainer/reviewer
david.cervigni@mindedsecurity.com
JS Security, topics:
• Evolution of client technologies (security)
• Why is always important
• Why is always difficult
• Techniques and tools to avoid vulnerabilities
Client security is vast
XSS is always dangerous!
• XSRF protection bypass
• Cookies/session stealing
• Defacement
• Password/credential stealing
• Enumeration
…
Attacker OWNS our website,
and still:
Consequences:
Anti XSS approaches:
Classic:
• Validation
• Filtering
• HTML Encoding
• Encoding lib + Contextual Encoding
• ?
<div onclick="showError ('<%=
Encoder.encodeForHtml(Encoder.encodeForJavaScript(
request.getParameter("error")%>')))" >
An error occurred ....</div>
Requires:
• Secure coding standards (enforced!)
• Knowledge
• Design (use the right libs)
…still error prone!
Anti XSS evolution:
Contextual encoding templates:
• Very strict
• Hard to encode in nested contexts / double encoding
Anti XSS evolution/2:
Mitigations:
• CPC: Content Security Policy
• ECMAScript security features (e.g. strict mode)
• Sandboxing JS (Google CAJA, sanitizer libraries)
• Anti XSS browser features WAF
Requires:
• Secure Application Design
• Third parties JS libraries compatibility?
• Legacy systems?
…still not fully secure (evasion)
So…Problem Solved?
Sources:
https://snyk.io/blog/xss-attacks-the-next-wave/
https://nvd.nist.gov/vuln/detail/CVE-2017-1160
“DOM-Based XSS is notoriously hard to
detect, as the server never gets a chance
to see the attack taking place.[…]”
New challenges:
Modern JS frameworks:
*Source: https://2017.appsec.eu/slides-and-videos
"Don’t trust the DOM: Bypassing XSS mitigations via Script
gadgets "
XSS Mitigation bypass
On:
Angular (1.x), Polymer (1.x), React, jQuery, jQuery UI, jQuery Mobile, Vue, Aurelia,
Underscore / Backbone, Knockout, Ember, Closure Library, Ractive.js, Dojo Toolkit,
RequireJS, Bootstrap…
• SPA: Single Page Applications
• Mainly HTML & JavaScript (not anymore flash)
• Frameworks: Angular, React…
• Third party libraries (JQuery and others)
• High degree of integration: portals/services
Why is always more important?
• Big codebases
• JavaScript is not easy to read: manual review
• Developing and Quality Assure for JavaScript and client components is
DIFFICULT, time consuming and error prone.
• Classic security tools use SCA (Static Code Analysis) that leads to :
1. Too many false positives
2. Too many false negatives
Why is always more difficult?
❑ Sources: the input data that
can be directly or indirectly
controlled by an attacker.
❑ Filters: operations on Sources
which change the content or check
for specific structures/values.
❑ Sinks: potentially dangerous
functions the can be abused to take
advantage of some kind of
exploitation.
Code Flow and Taint analysis
<script>
var l = location.href;
var user = l.substring(l.indexOf(“user”));
document.write(“Hello, ” + user);
</script>
Tainted Source
Sink
The process of following the
tainted value from source to
sink is known as Taint
Propagation.
Tools for JS Code analysis
SCA, static code analysis:
• Heavy
• Difficult
• Lower accuracy (false positives)
• Adaptability (false negatives…needs custom rules)
• Broad language support
Dynamic code analysis/IAST:
• Requires instrumentation
• More accurate
• Fuzzing capabilities!
SDLC
and
Automation (CI)
DOM XSS Wiki:
http://code.google.com/p/domxsswiki/wiki/LocationSources
Attacker controls all parts of a location except the victim hostname.
path/to/page.ext/ PathInfo ?Query=String #Hash=valuehttp://hostname/
He can force a user to visit a forged url address.!
Direct Input Sources: Location
Cookie value could have been instantiated somewhere else and retrieved
on another page. Its value can be accessed/modified with:
❑ document.cookie:
<script>
var cvalue = document.cookie;
var cstart = cvalue.indexOf(“username=");
cvalue = unescape(cvalue.substring(cstart+9, cstart+9+length));
alert(“Welcome ” + cvalue);
</script>
The attacker could force a malicious cookie value!
Indirect Input Sources: Cookies
DEMO,
Q/A,
THANKS!
AND NOW…
Tools for JS Code analysis

More Related Content

PPTX
Cloud Security vs Security in the Cloud
PDF
Devbeat Conference - Developer First Security
PPTX
Secure Coding 101 - OWASP University of Ottawa Workshop
PDF
Real World Application Threat Modelling By Example
PDF
Finacle - Secure Coding Practices
PDF
Scalable threat modelling with risk patterns
PPTX
DevSecCon Talk: An experiment in agile Threat Modelling
PPTX
Web Application Security 101
Cloud Security vs Security in the Cloud
Devbeat Conference - Developer First Security
Secure Coding 101 - OWASP University of Ottawa Workshop
Real World Application Threat Modelling By Example
Finacle - Secure Coding Practices
Scalable threat modelling with risk patterns
DevSecCon Talk: An experiment in agile Threat Modelling
Web Application Security 101

What's hot (19)

PPTX
Application Security-Understanding The Horizon
PPTX
2013 michael coates-javaone
PPTX
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
PDF
Web Application Security 101 - 04 Testing Methodology
PPTX
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
PPTX
Secure programming language basis
PDF
[OPD 2019] Life after pentest
PDF
Domain Driven Security at Internetdagarna-2014
PPTX
ASP.NET security vulnerabilities
PDF
[OWASP Poland Day] Security knowledge framework
PPTX
Cyber ppt
PPTX
Self Defending Applications
ODP
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
PDF
we45 - Web Application Security Testing Case Study
PPTX
Security in an Interconnected and Complex World of Software
PDF
Stories from the Security Operations Center
PDF
Testing Web Application Security
PDF
AJAX Security - LAC2016
PDF
Application Security Workshop
Application Security-Understanding The Horizon
2013 michael coates-javaone
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
Web Application Security 101 - 04 Testing Methodology
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Secure programming language basis
[OPD 2019] Life after pentest
Domain Driven Security at Internetdagarna-2014
ASP.NET security vulnerabilities
[OWASP Poland Day] Security knowledge framework
Cyber ppt
Self Defending Applications
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
we45 - Web Application Security Testing Case Study
Security in an Interconnected and Complex World of Software
Stories from the Security Operations Center
Testing Web Application Security
AJAX Security - LAC2016
Application Security Workshop
Ad

Similar to JavaScript security and tools evolution at 2017 OWASP Taiwan Week (20)

PPTX
Code Review Cybersecurity: Comprehensive Guide to Secure Code Evaluation & B...
PPT
Code Quality - Security
PDF
The Principles of Secure Development - BSides Las Vegas 2009
PPTX
Agile and Secure SDLC
PDF
AppSec in an Agile World
PPTX
For Business's Sake, Let's focus on AppSec
PPTX
Vulnerabilities in modern web applications
PPTX
Java application security the hard way - a workshop for the serious developer
PDF
Making DevSecOps a Reality in your Spring Applications
PPTX
DevBeat 2013 - Developer-first Security
PPTX
Static Code Analysis
PPS
Security testing
PDF
Web hackingtools 2015
PDF
Web hackingtools 2015
PPTX
Secure App Aspirations: Why it is very difficult in the real world
PPTX
Security for developers
PPTX
00. introduction to app sec v3
PPTX
Spa Secure Coding Guide
PPTX
Altitude SF 2017: Security at the edge
PDF
Web hackingtools cf-summit2014
Code Review Cybersecurity: Comprehensive Guide to Secure Code Evaluation & B...
Code Quality - Security
The Principles of Secure Development - BSides Las Vegas 2009
Agile and Secure SDLC
AppSec in an Agile World
For Business's Sake, Let's focus on AppSec
Vulnerabilities in modern web applications
Java application security the hard way - a workshop for the serious developer
Making DevSecOps a Reality in your Spring Applications
DevBeat 2013 - Developer-first Security
Static Code Analysis
Security testing
Web hackingtools 2015
Web hackingtools 2015
Secure App Aspirations: Why it is very difficult in the real world
Security for developers
00. introduction to app sec v3
Spa Secure Coding Guide
Altitude SF 2017: Security at the edge
Web hackingtools cf-summit2014
Ad

More from dcervigni (9)

PPTX
Cm9 secure code_training_1day_input sanitization
PPTX
Cm2 secure code_training_1day_data_protection
PPTX
Cm1 secure code_training_1day_intro
PPTX
Cm8 secure code_training_1day_security libraries
PPTX
Cm3 secure code_training_1day_access_control
PPTX
Cm4 secure code_training_1day_error handling and logging
PPTX
Cm5 secure code_training_1day_system configuration
PPTX
Cm6 secure code_training_1day_file management
PPTX
Cm7 secure code_training_1day_xss
Cm9 secure code_training_1day_input sanitization
Cm2 secure code_training_1day_data_protection
Cm1 secure code_training_1day_intro
Cm8 secure code_training_1day_security libraries
Cm3 secure code_training_1day_access_control
Cm4 secure code_training_1day_error handling and logging
Cm5 secure code_training_1day_system configuration
Cm6 secure code_training_1day_file management
Cm7 secure code_training_1day_xss

Recently uploaded (20)

PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Website Design Services for Small Businesses.pdf
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
assetexplorer- product-overview - presentation
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Types of Token_ From Utility to Security.pdf
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Designing Intelligence for the Shop Floor.pdf
Computer Software and OS of computer science of grade 11.pptx
Patient Appointment Booking in Odoo with online payment
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Website Design Services for Small Businesses.pdf
CNN LeNet5 Architecture: Neural Networks
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
assetexplorer- product-overview - presentation
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Computer Software - Technology and Livelihood Education
Why Generative AI is the Future of Content, Code & Creativity?
iTop VPN Crack Latest Version Full Key 2025
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
GSA Content Generator Crack (2025 Latest)
Advanced SystemCare Ultimate Crack + Portable (2025)
Types of Token_ From Utility to Security.pdf
How Tridens DevSecOps Ensures Compliance, Security, and Agility

JavaScript security and tools evolution at 2017 OWASP Taiwan Week

  • 1. OWASP Taiwan Day 2017 Client Side Security And Testing Tools (Evolution of) david.cervigni@mindedsecurity.com
  • 2. About me  10+ yeas of development  Software Security Enthusiast  Securing SDLC  Secure coding trainer/reviewer david.cervigni@mindedsecurity.com
  • 3. JS Security, topics: • Evolution of client technologies (security) • Why is always important • Why is always difficult • Techniques and tools to avoid vulnerabilities
  • 5. XSS is always dangerous! • XSRF protection bypass • Cookies/session stealing • Defacement • Password/credential stealing • Enumeration … Attacker OWNS our website, and still: Consequences:
  • 6. Anti XSS approaches: Classic: • Validation • Filtering • HTML Encoding • Encoding lib + Contextual Encoding • ? <div onclick="showError ('<%= Encoder.encodeForHtml(Encoder.encodeForJavaScript( request.getParameter("error")%>')))" > An error occurred ....</div> Requires: • Secure coding standards (enforced!) • Knowledge • Design (use the right libs) …still error prone!
  • 7. Anti XSS evolution: Contextual encoding templates: • Very strict • Hard to encode in nested contexts / double encoding
  • 8. Anti XSS evolution/2: Mitigations: • CPC: Content Security Policy • ECMAScript security features (e.g. strict mode) • Sandboxing JS (Google CAJA, sanitizer libraries) • Anti XSS browser features WAF Requires: • Secure Application Design • Third parties JS libraries compatibility? • Legacy systems? …still not fully secure (evasion)
  • 11. *Source: https://2017.appsec.eu/slides-and-videos "Don’t trust the DOM: Bypassing XSS mitigations via Script gadgets " XSS Mitigation bypass On: Angular (1.x), Polymer (1.x), React, jQuery, jQuery UI, jQuery Mobile, Vue, Aurelia, Underscore / Backbone, Knockout, Ember, Closure Library, Ractive.js, Dojo Toolkit, RequireJS, Bootstrap…
  • 12. • SPA: Single Page Applications • Mainly HTML & JavaScript (not anymore flash) • Frameworks: Angular, React… • Third party libraries (JQuery and others) • High degree of integration: portals/services Why is always more important?
  • 13. • Big codebases • JavaScript is not easy to read: manual review • Developing and Quality Assure for JavaScript and client components is DIFFICULT, time consuming and error prone. • Classic security tools use SCA (Static Code Analysis) that leads to : 1. Too many false positives 2. Too many false negatives Why is always more difficult?
  • 14. ❑ Sources: the input data that can be directly or indirectly controlled by an attacker. ❑ Filters: operations on Sources which change the content or check for specific structures/values. ❑ Sinks: potentially dangerous functions the can be abused to take advantage of some kind of exploitation. Code Flow and Taint analysis <script> var l = location.href; var user = l.substring(l.indexOf(“user”)); document.write(“Hello, ” + user); </script> Tainted Source Sink The process of following the tainted value from source to sink is known as Taint Propagation.
  • 15. Tools for JS Code analysis SCA, static code analysis: • Heavy • Difficult • Lower accuracy (false positives) • Adaptability (false negatives…needs custom rules) • Broad language support Dynamic code analysis/IAST: • Requires instrumentation • More accurate • Fuzzing capabilities! SDLC and Automation (CI)
  • 16. DOM XSS Wiki: http://code.google.com/p/domxsswiki/wiki/LocationSources Attacker controls all parts of a location except the victim hostname. path/to/page.ext/ PathInfo ?Query=String #Hash=valuehttp://hostname/ He can force a user to visit a forged url address.! Direct Input Sources: Location
  • 17. Cookie value could have been instantiated somewhere else and retrieved on another page. Its value can be accessed/modified with: ❑ document.cookie: <script> var cvalue = document.cookie; var cstart = cvalue.indexOf(“username="); cvalue = unescape(cvalue.substring(cstart+9, cstart+9+length)); alert(“Welcome ” + cvalue); </script> The attacker could force a malicious cookie value! Indirect Input Sources: Cookies
  • 19. Tools for JS Code analysis

Editor's Notes

  • #5: From OWASP WEBSITE: IT shows howm many test we need to do on the client side, almost all of them are causes and consequences of Javascript Execution