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

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

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