SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraLambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraJaliya Udagedara
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_androidPRITI TELMORE
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
Examples from Pune meetup
Examples from Pune meetupExamples from Pune meetup
Examples from Pune meetupSantosh Ojha
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in javaHitesh Kumar
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asppriya Nithya
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread SynchronizationBenj Del Mundo
 
Asp.NET Validation controls
Asp.NET Validation controlsAsp.NET Validation controls
Asp.NET Validation controlsGuddu gupta
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...Lenur Dzhemiliev
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmapHerman Duarte
 
A Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityA Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityMikhail Egorov
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Svetlin Nakov
 

Tendances (20)

Owasp Top 10 A1: Injection
Owasp Top 10 A1: InjectionOwasp Top 10 A1: Injection
Owasp Top 10 A1: Injection
 
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraLambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
 
Java method
Java methodJava method
Java method
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_android
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Examples from Pune meetup
Examples from Pune meetupExamples from Pune meetup
Examples from Pune meetup
 
Broken access controls
Broken access controlsBroken access controls
Broken access controls
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread Synchronization
 
Asp.NET Validation controls
Asp.NET Validation controlsAsp.NET Validation controls
Asp.NET Validation controls
 
Belajar Postman test runner
Belajar Postman test runnerBelajar Postman test runner
Belajar Postman test runner
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
 
HTTP Security Headers
HTTP Security HeadersHTTP Security Headers
HTTP Security Headers
 
Sqlmap
SqlmapSqlmap
Sqlmap
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmap
 
A Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityA Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications security
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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...
 

Dernier

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Dernier (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

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

Notes de l'éditeur

  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.