SlideShare a Scribd company logo
1 of 16
JAVASCRIPT INTRODUCTION
• Cement of the internet (personal thought)
• De-facto language for web
• Birth @ Netscape
• Born as “Mocha”
• Object oriented
http://en.wikipedia.org/wiki/JavaScript
AGENDA
• DOM XSS
• CORS
• JSON Hijacking
• POST Message
• JavaScript Obfuscation
(+[] [+[]]+[])[++[[]][+[]]]+([![]]+[]) [++[++[[]][+[]]][+[]]]+([!![]]+[] )[++[++[++[[]][+[]]][+[]]]
[+[]]]+([!![]]+[])[++[[]][+[]]]+([!![]]+[]) [+[]]  This is not child drawing it is code 
DOM XSS
• Similarity with stored and Reflected XSS is it also results due to DOM
Modification
• The difference is in how it is triggered
• Server might never see the payload
Keywords : Source Filter Sink
Source – Sink  Failure
Source – Filter – Sink  Perfect
https://www.owasp.org/index.php/DOM_Based_XSS
https://www.owasp.org/index.php/DOM_based_XSS_Prevention
_Cheat_Sheet
CORS – CROSS ORIGIN RESOURCE SHARING
As per the HTTP standards one domain cannot communicate with other.
But in some
cases there might be a need for applications to talk to each other which is
were CORS
comes into play. CORS allows domains to speak to each other
For CORS to work browser asks the server for permission by method of
pre-flight, the
server responds with actions it would support, the client then proceeds
with the
request
Request Header: Origin: http://yourapplication.com
Server Response: Access-Control-Allow-Origin: *
JSON HIJACKING (JSONP)
• Cross Domain JSON sniffing.
• Jsonp (JSON Padding) was created to communicate cross domain.
• The JSON response is encapsulated in a function.
• Malicious site could create a similar function call and get the contents
of the JSON
• The contact stealing attack of Jermiah grossman in gmail is a example
of Json
• Hijacking
• Google uses while(1){XXXX} now in JSON which precedes the JSON.
POST MESSAGE
“ inner = document.getElementById("inner").contentWindow;
inner.postMessage(document.getElementById("val").value, "*"); ”
postMessage allows cross domain communication.
One of the major flaw is fact that the receiver needs to verify if
communication was
for him before using it.
PostMessage expects a target to given but supports a wildcard. Which can
be abused
Input validation issues could lead to XSS
https://developer.mozilla.org/en-
US/docs/Web/API/Window.postMessage
http://www.cs.utexas.edu/~shmat/shmat_ndss13postman.pdf
JAVASCRIPT OBFUSCATION
Art of Hiding data in plain text
Why obfuscation
• Bypass WAF’s, filters
• Decrypt Exploit Packs
• Bypass filters (in-house and commercial)
• hide implementation details
• Social engineering payloads
Creatinga JavaScriptSnippetWithoutanyAlphanumericcharacters
(+[][+[]]+[])[++[[]][+[]]] = “a”
Detailedsteps:
1. +[]=0
2. [+[]]=0inside objectaccessor
3. [][+[]]=Createa blankArray withtrying to0whichcreateserror
‘undefined’
ALPHA NUMERICJS
4. +[][+[]] =We useinfixoperator+ toperform a mathematical
operationonresultofpreviousoperationwhichresultsa error NaN
(Not a Number)
We nowhaveto extractthemiddle‘a’ fromtheresult:
1. +[][+[]]+[]=Nan instring
2.++[[]][+[]]=1(quirkbyoxotonick)
3.(+[][+[]]+[])[++[[]][+[]]]=‘a’
J A V A S C R I P T : A T T A C K & D E F E N S E
ALPHA NUMERICJS
Lets Trying ‘l’
We can find l in “false”
Fact ‘’==0 will be true opp of this is false
([![]]+[]) == “false”
++[++[[]][+[]]][+[]] Use previous quirk to
get 2
Combine them to create ‘l’
([![]]+[]) [++[++[[]][+[]]][+[]]] == l
J A V A S C R I P T : A T T A C K & D E F E N S E
ALPHA NUMERICJS
DEMO
(+[] [+[]]+[])[++[[]][+[]]]+([![]]+[])
[++[++[[]][+[]]][+[]]]+([!![]]+[]
)[++[++[++[[]][+[]]][+[]]]
[+[]]]+([!![]]+[])[++[[]][+[]]]+([!![]]+[]) [+[]]
“alert”
{“Email”,”shifu@thoughtworks.com”}

More Related Content

What's hot

Basic web security model
Basic web security modelBasic web security model
Basic web security modelG Prachi
 
Html5: something wicked this way comes
Html5: something wicked this way comesHtml5: something wicked this way comes
Html5: something wicked this way comesKrzysztof Kotowicz
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comMongoDB
 
VSA: The Virtual Scripted Attacker, Brucon 2012
VSA: The Virtual Scripted Attacker, Brucon 2012VSA: The Virtual Scripted Attacker, Brucon 2012
VSA: The Virtual Scripted Attacker, Brucon 2012Abraham Aranguren
 
Web Authenication with Shibboleth - a view from the Flat East
Web Authenication with Shibboleth - a view from the Flat EastWeb Authenication with Shibboleth - a view from the Flat East
Web Authenication with Shibboleth - a view from the Flat EastJon Warbrick
 

What's hot (6)

Basic web security model
Basic web security modelBasic web security model
Basic web security model
 
Html5: something wicked this way comes
Html5: something wicked this way comesHtml5: something wicked this way comes
Html5: something wicked this way comes
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.com
 
Html5 for Security Folks
Html5 for Security FolksHtml5 for Security Folks
Html5 for Security Folks
 
VSA: The Virtual Scripted Attacker, Brucon 2012
VSA: The Virtual Scripted Attacker, Brucon 2012VSA: The Virtual Scripted Attacker, Brucon 2012
VSA: The Virtual Scripted Attacker, Brucon 2012
 
Web Authenication with Shibboleth - a view from the Flat East
Web Authenication with Shibboleth - a view from the Flat EastWeb Authenication with Shibboleth - a view from the Flat East
Web Authenication with Shibboleth - a view from the Flat East
 

Viewers also liked

Interactive Dock – Visuelle Gestaltung Interaktiver Produkte
Interactive Dock – Visuelle Gestaltung Interaktiver ProdukteInteractive Dock – Visuelle Gestaltung Interaktiver Produkte
Interactive Dock – Visuelle Gestaltung Interaktiver ProdukteDavid Blum
 
Las damas, los niños y el contenido primero - El diseño de experiencia de us...
Las damas, los niños y el contenido primero - El diseño de experiencia  de us...Las damas, los niños y el contenido primero - El diseño de experiencia  de us...
Las damas, los niños y el contenido primero - El diseño de experiencia de us...Emiliano Cosenza
 
Top 10 qualities of a great truck driver - infographic
Top 10 qualities of a great truck driver - infographicTop 10 qualities of a great truck driver - infographic
Top 10 qualities of a great truck driver - infographicNational Heavy Haulage
 
小V童書系列 06 【 阿姨的生日 二】
小V童書系列 06 【 阿姨的生日 二】小V童書系列 06 【 阿姨的生日 二】
小V童書系列 06 【 阿姨的生日 二】Yu-Ping Su
 
Tuyen dung-du-an-innovation ecobuilder
Tuyen dung-du-an-innovation ecobuilderTuyen dung-du-an-innovation ecobuilder
Tuyen dung-du-an-innovation ecobuilderInnovation Hub
 
Inspirational Quotes For The New Year 2016
Inspirational Quotes For The New Year 2016Inspirational Quotes For The New Year 2016
Inspirational Quotes For The New Year 2016Makala D.
 
Feeling every sunset
Feeling every sunsetFeeling every sunset
Feeling every sunsetmaatias066318
 
人生で大事なことは XP白本と参考文献に教わった
人生で大事なことは XP白本と参考文献に教わった 人生で大事なことは XP白本と参考文献に教わった
人生で大事なことは XP白本と参考文献に教わった Takeshi Kakeda
 
O que pode acontecer na TMJ 93!
O que pode acontecer na TMJ 93!O que pode acontecer na TMJ 93!
O que pode acontecer na TMJ 93!AlexVieira3705
 
Marie de Médicis la dupée
Marie de Médicis la dupéeMarie de Médicis la dupée
Marie de Médicis la dupéeEdmond Nollomont
 
小V童書系列 08【 神奇火山大冒險 】
小V童書系列 08【 神奇火山大冒險 】小V童書系列 08【 神奇火山大冒險 】
小V童書系列 08【 神奇火山大冒險 】Yu-Ping Su
 
Facebook and Myspace App Platforms: A Brief Update
Facebook and Myspace App Platforms: A Brief UpdateFacebook and Myspace App Platforms: A Brief Update
Facebook and Myspace App Platforms: A Brief UpdateO'Reilly Media
 
CLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansamblu
CLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansambluCLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansamblu
CLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansambluSabin Buraga
 
小V童書系列 01 【 資源大回收-Ian囉!】
小V童書系列 01 【 資源大回收-Ian囉!】小V童書系列 01 【 資源大回收-Ian囉!】
小V童書系列 01 【 資源大回收-Ian囉!】Yu-Ping Su
 
Mr. President may I have a Selfie with you ?
Mr. President may I have a Selfie with you ?Mr. President may I have a Selfie with you ?
Mr. President may I have a Selfie with you ?Makala D.
 

Viewers also liked (20)

Interactive Dock – Visuelle Gestaltung Interaktiver Produkte
Interactive Dock – Visuelle Gestaltung Interaktiver ProdukteInteractive Dock – Visuelle Gestaltung Interaktiver Produkte
Interactive Dock – Visuelle Gestaltung Interaktiver Produkte
 
Las damas, los niños y el contenido primero - El diseño de experiencia de us...
Las damas, los niños y el contenido primero - El diseño de experiencia  de us...Las damas, los niños y el contenido primero - El diseño de experiencia  de us...
Las damas, los niños y el contenido primero - El diseño de experiencia de us...
 
Top 10 qualities of a great truck driver - infographic
Top 10 qualities of a great truck driver - infographicTop 10 qualities of a great truck driver - infographic
Top 10 qualities of a great truck driver - infographic
 
小V童書系列 06 【 阿姨的生日 二】
小V童書系列 06 【 阿姨的生日 二】小V童書系列 06 【 阿姨的生日 二】
小V童書系列 06 【 阿姨的生日 二】
 
Abner
AbnerAbner
Abner
 
Tuyen dung-du-an-innovation ecobuilder
Tuyen dung-du-an-innovation ecobuilderTuyen dung-du-an-innovation ecobuilder
Tuyen dung-du-an-innovation ecobuilder
 
Inspirational Quotes For The New Year 2016
Inspirational Quotes For The New Year 2016Inspirational Quotes For The New Year 2016
Inspirational Quotes For The New Year 2016
 
Feeling every sunset
Feeling every sunsetFeeling every sunset
Feeling every sunset
 
人生で大事なことは XP白本と参考文献に教わった
人生で大事なことは XP白本と参考文献に教わった 人生で大事なことは XP白本と参考文献に教わった
人生で大事なことは XP白本と参考文献に教わった
 
O que pode acontecer na TMJ 93!
O que pode acontecer na TMJ 93!O que pode acontecer na TMJ 93!
O que pode acontecer na TMJ 93!
 
Marie de Médicis la dupée
Marie de Médicis la dupéeMarie de Médicis la dupée
Marie de Médicis la dupée
 
小V童書系列 08【 神奇火山大冒險 】
小V童書系列 08【 神奇火山大冒險 】小V童書系列 08【 神奇火山大冒險 】
小V童書系列 08【 神奇火山大冒險 】
 
Good vs Bad Teamplayer
Good vs Bad TeamplayerGood vs Bad Teamplayer
Good vs Bad Teamplayer
 
Sonho de ícaro
Sonho de ícaroSonho de ícaro
Sonho de ícaro
 
Facebook and Myspace App Platforms: A Brief Update
Facebook and Myspace App Platforms: A Brief UpdateFacebook and Myspace App Platforms: A Brief Update
Facebook and Myspace App Platforms: A Brief Update
 
CLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansamblu
CLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansambluCLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansamblu
CLIW 2015-2016 (5/13) Vizualizarea datelor – o privire de ansamblu
 
Campanha Frotas
Campanha FrotasCampanha Frotas
Campanha Frotas
 
小V童書系列 01 【 資源大回收-Ian囉!】
小V童書系列 01 【 資源大回收-Ian囉!】小V童書系列 01 【 資源大回收-Ian囉!】
小V童書系列 01 【 資源大回收-Ian囉!】
 
Mr. President may I have a Selfie with you ?
Mr. President may I have a Selfie with you ?Mr. President may I have a Selfie with you ?
Mr. President may I have a Selfie with you ?
 
Tmj 94!
Tmj 94!Tmj 94!
Tmj 94!
 

Similar to Testing Javascript - Prasanna K, ThoughtWorks

Cross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterCross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterMichael Coates
 
Building Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTsBuilding Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTsrobertjd
 
How dojo works
How dojo worksHow dojo works
How dojo worksAmit Tyagi
 
Philip Stehlik at TechTalks.ph - Intro to Groovy and Grails
Philip Stehlik at TechTalks.ph - Intro to Groovy and GrailsPhilip Stehlik at TechTalks.ph - Intro to Groovy and Grails
Philip Stehlik at TechTalks.ph - Intro to Groovy and GrailsPhilip Stehlik
 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)jeresig
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in schoolMichael Galpin
 
웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격선협 이
 
XSS (Cross Site Scripting)
XSS (Cross Site Scripting)XSS (Cross Site Scripting)
XSS (Cross Site Scripting)Shubham Gupta
 
[Poland] It's only about frontend
[Poland] It's only about frontend[Poland] It's only about frontend
[Poland] It's only about frontendOWASP EEE
 
Browser Security 101
Browser Security 101 Browser Security 101
Browser Security 101 Stormpath
 
Talk about html5 security
Talk about html5 securityTalk about html5 security
Talk about html5 securityHuang Toby
 
夜宴36期《技术前哨站》
夜宴36期《技术前哨站》夜宴36期《技术前哨站》
夜宴36期《技术前哨站》Koubei Banquet
 
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Building Secure User Interfaces With JWTs (JSON Web Tokens)Building Secure User Interfaces With JWTs (JSON Web Tokens)
Building Secure User Interfaces With JWTs (JSON Web Tokens)Stormpath
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applicationsDevnology
 

Similar to Testing Javascript - Prasanna K, ThoughtWorks (20)

On Web Browsers
On Web BrowsersOn Web Browsers
On Web Browsers
 
Cross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterCross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning Center
 
Building Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTsBuilding Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTs
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
Philip Stehlik at TechTalks.ph - Intro to Groovy and Grails
Philip Stehlik at TechTalks.ph - Intro to Groovy and GrailsPhilip Stehlik at TechTalks.ph - Intro to Groovy and Grails
Philip Stehlik at TechTalks.ph - Intro to Groovy and Grails
 
Building Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 FeaturesBuilding Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 Features
 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in school
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격
 
XSS (Cross Site Scripting)
XSS (Cross Site Scripting)XSS (Cross Site Scripting)
XSS (Cross Site Scripting)
 
[Poland] It's only about frontend
[Poland] It's only about frontend[Poland] It's only about frontend
[Poland] It's only about frontend
 
Browser Security 101
Browser Security 101 Browser Security 101
Browser Security 101
 
Html5 hacking
Html5 hackingHtml5 hacking
Html5 hacking
 
Talk about html5 security
Talk about html5 securityTalk about html5 security
Talk about html5 security
 
夜宴36期《技术前哨站》
夜宴36期《技术前哨站》夜宴36期《技术前哨站》
夜宴36期《技术前哨站》
 
Banquet 36
Banquet 36Banquet 36
Banquet 36
 
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Building Secure User Interfaces With JWTs (JSON Web Tokens)Building Secure User Interfaces With JWTs (JSON Web Tokens)
Building Secure User Interfaces With JWTs (JSON Web Tokens)
 
Gwtcreatekeynote
GwtcreatekeynoteGwtcreatekeynote
Gwtcreatekeynote
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 

More from Thoughtworks

Design System as a Product
Design System as a ProductDesign System as a Product
Design System as a ProductThoughtworks
 
Designers, Developers & Dogs
Designers, Developers & DogsDesigners, Developers & Dogs
Designers, Developers & DogsThoughtworks
 
Cloud-first for fast innovation
Cloud-first for fast innovationCloud-first for fast innovation
Cloud-first for fast innovationThoughtworks
 
More impact with flexible teams
More impact with flexible teamsMore impact with flexible teams
More impact with flexible teamsThoughtworks
 
Culture of Innovation
Culture of InnovationCulture of Innovation
Culture of InnovationThoughtworks
 
Developer Experience
Developer ExperienceDeveloper Experience
Developer ExperienceThoughtworks
 
When we design together
When we design togetherWhen we design together
When we design togetherThoughtworks
 
Hardware is hard(er)
Hardware is hard(er)Hardware is hard(er)
Hardware is hard(er)Thoughtworks
 
Customer-centric innovation enabled by cloud
 Customer-centric innovation enabled by cloud Customer-centric innovation enabled by cloud
Customer-centric innovation enabled by cloudThoughtworks
 
Amazon's Culture of Innovation
Amazon's Culture of InnovationAmazon's Culture of Innovation
Amazon's Culture of InnovationThoughtworks
 
When in doubt, go live
When in doubt, go liveWhen in doubt, go live
When in doubt, go liveThoughtworks
 
Don't cross the Rubicon
Don't cross the RubiconDon't cross the Rubicon
Don't cross the RubiconThoughtworks
 
Your test coverage is a lie!
Your test coverage is a lie!Your test coverage is a lie!
Your test coverage is a lie!Thoughtworks
 
Docker container security
Docker container securityDocker container security
Docker container securityThoughtworks
 
Redefining the unit
Redefining the unitRedefining the unit
Redefining the unitThoughtworks
 
Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22Thoughtworks
 
A Tribute to Turing
A Tribute to TuringA Tribute to Turing
A Tribute to TuringThoughtworks
 
Rsa maths worked out
Rsa maths worked outRsa maths worked out
Rsa maths worked outThoughtworks
 

More from Thoughtworks (20)

Design System as a Product
Design System as a ProductDesign System as a Product
Design System as a Product
 
Designers, Developers & Dogs
Designers, Developers & DogsDesigners, Developers & Dogs
Designers, Developers & Dogs
 
Cloud-first for fast innovation
Cloud-first for fast innovationCloud-first for fast innovation
Cloud-first for fast innovation
 
More impact with flexible teams
More impact with flexible teamsMore impact with flexible teams
More impact with flexible teams
 
Culture of Innovation
Culture of InnovationCulture of Innovation
Culture of Innovation
 
Dual-Track Agile
Dual-Track AgileDual-Track Agile
Dual-Track Agile
 
Developer Experience
Developer ExperienceDeveloper Experience
Developer Experience
 
When we design together
When we design togetherWhen we design together
When we design together
 
Hardware is hard(er)
Hardware is hard(er)Hardware is hard(er)
Hardware is hard(er)
 
Customer-centric innovation enabled by cloud
 Customer-centric innovation enabled by cloud Customer-centric innovation enabled by cloud
Customer-centric innovation enabled by cloud
 
Amazon's Culture of Innovation
Amazon's Culture of InnovationAmazon's Culture of Innovation
Amazon's Culture of Innovation
 
When in doubt, go live
When in doubt, go liveWhen in doubt, go live
When in doubt, go live
 
Don't cross the Rubicon
Don't cross the RubiconDon't cross the Rubicon
Don't cross the Rubicon
 
Error handling
Error handlingError handling
Error handling
 
Your test coverage is a lie!
Your test coverage is a lie!Your test coverage is a lie!
Your test coverage is a lie!
 
Docker container security
Docker container securityDocker container security
Docker container security
 
Redefining the unit
Redefining the unitRedefining the unit
Redefining the unit
 
Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22
 
A Tribute to Turing
A Tribute to TuringA Tribute to Turing
A Tribute to Turing
 
Rsa maths worked out
Rsa maths worked outRsa maths worked out
Rsa maths worked out
 

Recently uploaded

UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
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
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
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
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
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
 

Recently uploaded (20)

UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
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
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.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
 

Testing Javascript - Prasanna K, ThoughtWorks

  • 1.
  • 2. JAVASCRIPT INTRODUCTION • Cement of the internet (personal thought) • De-facto language for web • Birth @ Netscape • Born as “Mocha” • Object oriented http://en.wikipedia.org/wiki/JavaScript
  • 3. AGENDA • DOM XSS • CORS • JSON Hijacking • POST Message • JavaScript Obfuscation (+[] [+[]]+[])[++[[]][+[]]]+([![]]+[]) [++[++[[]][+[]]][+[]]]+([!![]]+[] )[++[++[++[[]][+[]]][+[]]] [+[]]]+([!![]]+[])[++[[]][+[]]]+([!![]]+[]) [+[]]  This is not child drawing it is code 
  • 4. DOM XSS • Similarity with stored and Reflected XSS is it also results due to DOM Modification • The difference is in how it is triggered • Server might never see the payload Keywords : Source Filter Sink Source – Sink  Failure Source – Filter – Sink  Perfect https://www.owasp.org/index.php/DOM_Based_XSS https://www.owasp.org/index.php/DOM_based_XSS_Prevention _Cheat_Sheet
  • 5.
  • 6. CORS – CROSS ORIGIN RESOURCE SHARING As per the HTTP standards one domain cannot communicate with other. But in some cases there might be a need for applications to talk to each other which is were CORS comes into play. CORS allows domains to speak to each other For CORS to work browser asks the server for permission by method of pre-flight, the server responds with actions it would support, the client then proceeds with the request Request Header: Origin: http://yourapplication.com Server Response: Access-Control-Allow-Origin: *
  • 7. JSON HIJACKING (JSONP) • Cross Domain JSON sniffing. • Jsonp (JSON Padding) was created to communicate cross domain. • The JSON response is encapsulated in a function. • Malicious site could create a similar function call and get the contents of the JSON • The contact stealing attack of Jermiah grossman in gmail is a example of Json • Hijacking • Google uses while(1){XXXX} now in JSON which precedes the JSON.
  • 8.
  • 9. POST MESSAGE “ inner = document.getElementById("inner").contentWindow; inner.postMessage(document.getElementById("val").value, "*"); ” postMessage allows cross domain communication. One of the major flaw is fact that the receiver needs to verify if communication was for him before using it. PostMessage expects a target to given but supports a wildcard. Which can be abused Input validation issues could lead to XSS https://developer.mozilla.org/en- US/docs/Web/API/Window.postMessage http://www.cs.utexas.edu/~shmat/shmat_ndss13postman.pdf
  • 10.
  • 11. JAVASCRIPT OBFUSCATION Art of Hiding data in plain text Why obfuscation • Bypass WAF’s, filters • Decrypt Exploit Packs • Bypass filters (in-house and commercial) • hide implementation details • Social engineering payloads
  • 12. Creatinga JavaScriptSnippetWithoutanyAlphanumericcharacters (+[][+[]]+[])[++[[]][+[]]] = “a” Detailedsteps: 1. +[]=0 2. [+[]]=0inside objectaccessor 3. [][+[]]=Createa blankArray withtrying to0whichcreateserror ‘undefined’ ALPHA NUMERICJS
  • 13. 4. +[][+[]] =We useinfixoperator+ toperform a mathematical operationonresultofpreviousoperationwhichresultsa error NaN (Not a Number) We nowhaveto extractthemiddle‘a’ fromtheresult: 1. +[][+[]]+[]=Nan instring 2.++[[]][+[]]=1(quirkbyoxotonick) 3.(+[][+[]]+[])[++[[]][+[]]]=‘a’ J A V A S C R I P T : A T T A C K & D E F E N S E ALPHA NUMERICJS
  • 14. Lets Trying ‘l’ We can find l in “false” Fact ‘’==0 will be true opp of this is false ([![]]+[]) == “false” ++[++[[]][+[]]][+[]] Use previous quirk to get 2 Combine them to create ‘l’ ([![]]+[]) [++[++[[]][+[]]][+[]]] == l J A V A S C R I P T : A T T A C K & D E F E N S E ALPHA NUMERICJS