SlideShare una empresa de Scribd logo
1 de 25
Nishant Das Patnaik
@dpnishant
Sarathi Sahoo
@sarathisahoo
Agenda
• Introduction to the problem
- Why is it a problem?
- What is the impact?
- Demo
• What is JSPrime?
- What is it?
- Who is it for?
- How it works?
- What it can do?
- What it can’t do?
- Demo
• Conclusion and questions
Who am I?
• First time BlackHat speaker (at Vegas too)
• Senior Paranoid at Yahoo! Inc.
- Security Engineer at eBay Inc. (Past)
• Bug Bounty Hunter (FB, Mozilla, Nokia, Foursquare etc)
• Speaker at NullCon 2012, Goa, India
• Co-author of Ra.2: – DOM XSS Scanner Firefox add-on
• 5+ years of security self-studying
• Keyboard Player & Sports-bike enthusiast
Who is Sarathi?
• Experienced Application Developer, 7+ years
experience
• 5+ years at Yahoo! Inc.
• Full-time JSPrime Developer
• @sarathisahoo, http://fb.me/sarathi.sahoo
JavaScript: the lingua franca of Web &
Mobile
Introduction: The Problem
JavaScript is a dynamic language
• Object-based, properties created on demand
• Prototype-based inheritance
• First-class functions, closures
• Runtime types, coercions
Introduction: The Problem
• Client Side Script Injection
- DOM XSS
• Server Side Script Injection
- Node.JS Applications
Introduction: Why is it problem?
• Server side filtering fails for DOM XSS
• JavaScript code review is intimidating #iykwim
• Library dependent source-to-sink pairs
• Not Enough Scanners
Introduction: The Impact
• Same as regular XSS: Reflected or Stored
• Script Injection on server side or mobile device can be
really lethal.
• Node.JS, Firefox OS, Windows 8 Apps (WinJS)
Vulnerability Demo
Some sample codes
Introducing JSPrime
• What is it?
• Who is it for?
• What it can do? Avoiding False positives
• What it can’t do? Knowing the False negatives
• Stability & Automation
• Demo
Introducing JSPrime: What is it?
• JSPrime is a light-weight source code scanner
for identifying security issues using static
analysis.
• It is written in JavaScript to analyze
JavaScript.
• Uses the open-source ECMAScript parser:
Esprima.org
Introducing JSPrime: Who is it for?
• JSPrime is mostly a developer centric tool.
• It can aid code reviewers for identifying security
issues in 1st pass.
• Security professionals may find it useful during
penetration testing engagements.
Introducing JSPrime: How it works?
• Feed the code to Esprima, to generate the AST.
• Parse the JSON AST, to locate all sources (including Objects,
Prototype) and keeping track of their scopes
• Parse the AST, to locate all assignment operations related to
the sources, while keeping track of their scopes
• Parse the AST to locate sinks and sink aliases, again keeping
track of their scope.
• Parse AST to locate functions (including closures, anon
functions) which are fed with sources as arguments and
while tracking down their return values.
Introducing JSPrime: How it works?
• Once all the sources, source aliases are collected we check
for any filter function on them, rejected if found.
• Remaining sources, source aliases are tracked for
assignments or pass as argument operations to the collected
sinks or sink aliases.
• We repeat the same process in reverse order to be sure that
we reach the same source when we traverse backwards, just
to be sure.
• Once we confirm that we extract the line numbers and their
statement and put it in the report we generate with
different color coding
Introducing JSPrime: What it can do?
• It can follow code execution order
• Handle First-class functions
• Analyze Prototype-based inheritance
• Understand type-casting
• Understand context-based filter functions (has to
be manually supplied, though)
• Library aware sources and sinks
• Variable, Objects, Functions scope aware analysis
• Control-flow analysis
• Data-flow analysis
Introducing JSPrime: What it can’t do?
• It can’t detect 100% of the issues.
• It can’t learn sources and sinks automatically
• It can’t handle obfuscated JavaScript
• It can’t report issues in minified JavaScript, unless
beautified.
• It can’t analyze dynamically generated JavaScript
using ‘eval’ or similar methods
Introducing JSPrime: Stability & Automation
• Handle up to 1500 LoC in a single scan
• Node.JS port is available for server-side web service
like setup
• Largely dependent on Esprima’s robustness, can be
the 1st point failure
Demo
Have patience! 
Roadmap
Improved performance and stability
Multiple file scanning
Node.JS Project Scanning capability
IDE Plugin (Notepad++, WebStorm, ??)
More Library Support
String manipulation simulation
Your suggestions? 
Summary
Actively work-in-progress
Promising project roadmap
Open-sourced today
www.jsprime.org
Credits
• Aria Hidayat, Esprima.org
• Paul Theriault, Mozilla Security Team
• Bishan Singh - @b1shan
• Rafay Baloch – rafayhackingarticles.com
Questions?
THANK YOU
JavaScript Static Security Analysis made easy with JSPrime

Más contenido relacionado

La actualidad más candente

Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonIgor Anishchenko
 
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)Yongha Yoo
 
Postgres can do THAT?
Postgres can do THAT?Postgres can do THAT?
Postgres can do THAT?alexbrasetvik
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.boyney123
 
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥Seomgi Han
 
Iocp 기본 구조 이해
Iocp 기본 구조 이해Iocp 기본 구조 이해
Iocp 기본 구조 이해Nam Hyeonuk
 
Capacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB ClusterCapacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB ClusterMongoDB
 
Yii Framework Security
Yii Framework SecurityYii Framework Security
Yii Framework SecurityIlko Kacharov
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsLilia Sfaxi
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPTQUONTRASOLUTIONS
 
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 SeoulElastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 SeoulSeungYong Oh
 
KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈
KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈
KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈Minwoo Kim
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJWORKS powered by Ordina
 

La actualidad más candente (20)

Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased Comparison
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Hadoop Oozie
Hadoop OozieHadoop Oozie
Hadoop Oozie
 
Android : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using AndroidAndroid : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using Android
 
Object Oriented Javascript
Object Oriented JavascriptObject Oriented Javascript
Object Oriented Javascript
 
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to Cassandra
 
Postgres can do THAT?
Postgres can do THAT?Postgres can do THAT?
Postgres can do THAT?
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.
 
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
 
Iocp 기본 구조 이해
Iocp 기본 구조 이해Iocp 기본 구조 이해
Iocp 기본 구조 이해
 
Controls
ControlsControls
Controls
 
Capacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB ClusterCapacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB Cluster
 
Yii Framework Security
Yii Framework SecurityYii Framework Security
Yii Framework Security
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPT
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 SeoulElastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
 
KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈
KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈
KGC 2014 가볍고 유연하게 데이터 분석하기 : 쿠키런 사례 중심 , 데브시스터즈
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
 

Destacado

Efficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template EnginesEfficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template Enginesadonatwork
 
Pentesting Your Own Wireless Networks, June 2011 Issue
Pentesting Your Own Wireless Networks, June 2011 IssuePentesting Your Own Wireless Networks, June 2011 Issue
Pentesting Your Own Wireless Networks, June 2011 IssueIshan Girdhar
 
Armitage – The Ultimate Attack Platform for Metasploit
Armitage – The  Ultimate Attack  Platform for Metasploit Armitage – The  Ultimate Attack  Platform for Metasploit
Armitage – The Ultimate Attack Platform for Metasploit Ishan Girdhar
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesOry Segal
 
Pyscho-Strategies for Social Engineering
Pyscho-Strategies for Social EngineeringPyscho-Strategies for Social Engineering
Pyscho-Strategies for Social EngineeringIshan Girdhar
 
Pentesting With Web Services in 2012
Pentesting With Web Services in 2012Pentesting With Web Services in 2012
Pentesting With Web Services in 2012Ishan Girdhar
 
Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application SecurityIshan Girdhar
 
Waf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScriptWaf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScriptDenis Kolegov
 
AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application Carlo Bonamico
 

Destacado (12)

JavaScript Security
JavaScript SecurityJavaScript Security
JavaScript Security
 
Efficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template EnginesEfficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template Engines
 
Pentesting Your Own Wireless Networks, June 2011 Issue
Pentesting Your Own Wireless Networks, June 2011 IssuePentesting Your Own Wireless Networks, June 2011 Issue
Pentesting Your Own Wireless Networks, June 2011 Issue
 
Armitage – The Ultimate Attack Platform for Metasploit
Armitage – The  Ultimate Attack  Platform for Metasploit Armitage – The  Ultimate Attack  Platform for Metasploit
Armitage – The Ultimate Attack Platform for Metasploit
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 
Pyscho-Strategies for Social Engineering
Pyscho-Strategies for Social EngineeringPyscho-Strategies for Social Engineering
Pyscho-Strategies for Social Engineering
 
Pentesting With Web Services in 2012
Pentesting With Web Services in 2012Pentesting With Web Services in 2012
Pentesting With Web Services in 2012
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application Security
 
Waf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScriptWaf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScript
 
AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application
 
Secure java script-for-developers
Secure java script-for-developersSecure java script-for-developers
Secure java script-for-developers
 

Similar a JavaScript Static Security Analysis made easy with JSPrime

Bsides Knoxville - APT2
Bsides Knoxville - APT2Bsides Knoxville - APT2
Bsides Knoxville - APT2Adam Compton
 
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jRobotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jKevin Watters
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...Lucidworks
 
Recon-Fu @BsidesKyiv 2016
Recon-Fu @BsidesKyiv 2016Recon-Fu @BsidesKyiv 2016
Recon-Fu @BsidesKyiv 2016Vlad Styran
 
JavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAPJavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAPSimon Bennetts
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxShivashankarHR1
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with PythonAbhay Bhargav
 
Threat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 Presentation
Threat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 PresentationThreat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 Presentation
Threat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 PresentationAbhay Bhargav
 
My tryst with sourcecode review
My tryst with sourcecode reviewMy tryst with sourcecode review
My tryst with sourcecode reviewAnant Shrivastava
 
Manual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A BugManual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A BugLewis Ardern
 
DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...
DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...
DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...DevSecCon
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final FrontierjClarity
 
The Cowardly Test-o-Phobe's Guide To Testing
The Cowardly Test-o-Phobe's Guide To TestingThe Cowardly Test-o-Phobe's Guide To Testing
The Cowardly Test-o-Phobe's Guide To TestingTim Duckett
 
Testing sync engine
Testing sync engineTesting sync engine
Testing sync engineIlya Puchka
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmersAspect j introduction for non-programmers
Aspect j introduction for non-programmersTamas Rev
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itlokeshpappaka10
 
Jason Kent - AppSec Without Additional Tools
Jason Kent - AppSec Without Additional ToolsJason Kent - AppSec Without Additional Tools
Jason Kent - AppSec Without Additional Toolscentralohioissa
 
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...FINOS
 

Similar a JavaScript Static Security Analysis made easy with JSPrime (20)

Bsides Knoxville - APT2
Bsides Knoxville - APT2Bsides Knoxville - APT2
Bsides Knoxville - APT2
 
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jRobotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
 
DerbyCon - APT2
DerbyCon - APT2DerbyCon - APT2
DerbyCon - APT2
 
Recon-Fu @BsidesKyiv 2016
Recon-Fu @BsidesKyiv 2016Recon-Fu @BsidesKyiv 2016
Recon-Fu @BsidesKyiv 2016
 
JavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAPJavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAP
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptx
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
Threat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 Presentation
Threat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 PresentationThreat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 Presentation
Threat-Modeling-as-Code: ThreatPlaybook AppSecUSA 2018 Presentation
 
SecureWV - APT2
SecureWV - APT2SecureWV - APT2
SecureWV - APT2
 
My tryst with sourcecode review
My tryst with sourcecode reviewMy tryst with sourcecode review
My tryst with sourcecode review
 
Manual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A BugManual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A Bug
 
DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...
DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...
DevSecCon Asia 2017 - Abhay Bhargav: Building an Application Vulnerability To...
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
 
The Cowardly Test-o-Phobe's Guide To Testing
The Cowardly Test-o-Phobe's Guide To TestingThe Cowardly Test-o-Phobe's Guide To Testing
The Cowardly Test-o-Phobe's Guide To Testing
 
Testing sync engine
Testing sync engineTesting sync engine
Testing sync engine
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmersAspect j introduction for non-programmers
Aspect j introduction for non-programmers
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 
Jason Kent - AppSec Without Additional Tools
Jason Kent - AppSec Without Additional ToolsJason Kent - AppSec Without Additional Tools
Jason Kent - AppSec Without Additional Tools
 
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
 

Último

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

JavaScript Static Security Analysis made easy with JSPrime

  • 2. Agenda • Introduction to the problem - Why is it a problem? - What is the impact? - Demo • What is JSPrime? - What is it? - Who is it for? - How it works? - What it can do? - What it can’t do? - Demo • Conclusion and questions
  • 3. Who am I? • First time BlackHat speaker (at Vegas too) • Senior Paranoid at Yahoo! Inc. - Security Engineer at eBay Inc. (Past) • Bug Bounty Hunter (FB, Mozilla, Nokia, Foursquare etc) • Speaker at NullCon 2012, Goa, India • Co-author of Ra.2: – DOM XSS Scanner Firefox add-on • 5+ years of security self-studying • Keyboard Player & Sports-bike enthusiast
  • 4. Who is Sarathi? • Experienced Application Developer, 7+ years experience • 5+ years at Yahoo! Inc. • Full-time JSPrime Developer • @sarathisahoo, http://fb.me/sarathi.sahoo
  • 5. JavaScript: the lingua franca of Web & Mobile
  • 6. Introduction: The Problem JavaScript is a dynamic language • Object-based, properties created on demand • Prototype-based inheritance • First-class functions, closures • Runtime types, coercions
  • 7. Introduction: The Problem • Client Side Script Injection - DOM XSS • Server Side Script Injection - Node.JS Applications
  • 8. Introduction: Why is it problem? • Server side filtering fails for DOM XSS • JavaScript code review is intimidating #iykwim • Library dependent source-to-sink pairs • Not Enough Scanners
  • 9. Introduction: The Impact • Same as regular XSS: Reflected or Stored • Script Injection on server side or mobile device can be really lethal. • Node.JS, Firefox OS, Windows 8 Apps (WinJS)
  • 11. Introducing JSPrime • What is it? • Who is it for? • What it can do? Avoiding False positives • What it can’t do? Knowing the False negatives • Stability & Automation • Demo
  • 12. Introducing JSPrime: What is it? • JSPrime is a light-weight source code scanner for identifying security issues using static analysis. • It is written in JavaScript to analyze JavaScript. • Uses the open-source ECMAScript parser: Esprima.org
  • 13. Introducing JSPrime: Who is it for? • JSPrime is mostly a developer centric tool. • It can aid code reviewers for identifying security issues in 1st pass. • Security professionals may find it useful during penetration testing engagements.
  • 14. Introducing JSPrime: How it works? • Feed the code to Esprima, to generate the AST. • Parse the JSON AST, to locate all sources (including Objects, Prototype) and keeping track of their scopes • Parse the AST, to locate all assignment operations related to the sources, while keeping track of their scopes • Parse the AST to locate sinks and sink aliases, again keeping track of their scope. • Parse AST to locate functions (including closures, anon functions) which are fed with sources as arguments and while tracking down their return values.
  • 15. Introducing JSPrime: How it works? • Once all the sources, source aliases are collected we check for any filter function on them, rejected if found. • Remaining sources, source aliases are tracked for assignments or pass as argument operations to the collected sinks or sink aliases. • We repeat the same process in reverse order to be sure that we reach the same source when we traverse backwards, just to be sure. • Once we confirm that we extract the line numbers and their statement and put it in the report we generate with different color coding
  • 16. Introducing JSPrime: What it can do? • It can follow code execution order • Handle First-class functions • Analyze Prototype-based inheritance • Understand type-casting • Understand context-based filter functions (has to be manually supplied, though) • Library aware sources and sinks • Variable, Objects, Functions scope aware analysis • Control-flow analysis • Data-flow analysis
  • 17. Introducing JSPrime: What it can’t do? • It can’t detect 100% of the issues. • It can’t learn sources and sinks automatically • It can’t handle obfuscated JavaScript • It can’t report issues in minified JavaScript, unless beautified. • It can’t analyze dynamically generated JavaScript using ‘eval’ or similar methods
  • 18. Introducing JSPrime: Stability & Automation • Handle up to 1500 LoC in a single scan • Node.JS port is available for server-side web service like setup • Largely dependent on Esprima’s robustness, can be the 1st point failure
  • 20. Roadmap Improved performance and stability Multiple file scanning Node.JS Project Scanning capability IDE Plugin (Notepad++, WebStorm, ??) More Library Support String manipulation simulation Your suggestions? 
  • 21. Summary Actively work-in-progress Promising project roadmap Open-sourced today www.jsprime.org
  • 22. Credits • Aria Hidayat, Esprima.org • Paul Theriault, Mozilla Security Team • Bishan Singh - @b1shan • Rafay Baloch – rafayhackingarticles.com

Notas del editor

  1. Hello everyone! Good afternoon. I know its kind of tough to be in session right after the lunch. I will try to keep most of you remain awake during the talk. My name is Nishant Das Patnaik and for the next 45 or so I’m here to talk about JavaScript Static Security Analysis made easy with JSPrime. This talk is jointly prepared by me and SarathiSahoo. Before we start I would like to know how many of you are developers here? Javascript developers to be specific? Please raise your hands. Okay …great this talk will be more focused towards the work you do. So without any further adieu, lets begin.
  2. We shall discuss about what is the problem? Why is it a problem and some demo of the problem. that we are trying to solve. Then we will discuss about our proof of concept solution that we call: JSPrime. We will try to know what is it? Who is it meant for? How it works? What it can do and what not to expect from it, YET? And finally I will show you some of demos of the tool and then we shall move on to conclusion and questions & answer session. Though I have kept a separate 10 mins slot for Q&A, but please feel free to stop me any moment, should you need any clarification or have any question. Sounds good? Awesome!
  3. Okay before we start let me introduce myself to you guys. This is my first time at BlackHat. So please be kind to me, incase something doesn’t work as expected. Haha. I work as a Senior Paranoid at Yahoo, India. Prior to Yahoo I was at eBay. I enjoy hunting bug bounties and have been successful couple of times. I was a speaker at NullCon 2012, it’s a security conference that takes place in Goa, India. There we released a tool, Firefox addon to be specific, called Ra.2 which is a basic and lightweight DOM based XSS scanner. I have been self studying Security for more than 5 years now and have just managed to clear the noob level. I also enjoy playing bollywood tracks on keyboards and grand piano. Offlate I have turned into an sports bike enthusiast. That’s all and enough about me, let proceed.
  4. Point #2: How many of you are involved the security review of javascript source codes?Point #4: What scanners/tools do you use? Open source / Commercial? Satisfaction level. Automation capability?
  5. Can’t handle compression, obfuscation.