SlideShare a Scribd company logo
Copyright 2007 © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
The OWASP Foundation
OWASP
http://www.owasp.org
I'm in ur browser, pwning your stuff
Attacking (with) Google Chrome
extensions
Krzysztof Kotowicz
SecuRing
kkotowicz@securing.pl
OWASP
About me
Security research
client side security
HTML5
UI redressing
Chrome extensions
Black Hat USA, BruCON, Hack in Paris, CONFidence, ...
IT security consultant @ SecuRing
web app, mobile pentests
security code reviews
2
OWASP
Plan
3
Chrome Extensions architecture
Exploiting legacy (v1) extensions
Manifest v2 fixes
Exploiting v2 extensions
"Break The Batman Part 3" by Eric Merced / Eric Merced aka stickfiguredancer
OWASP
Chrome Extensions
 Not plugins (Java, Flash, ...)
 HTML5 applications
 html, javascript, css
Installed from Chrome Web Store
 Access to privileged API
 chrome.tabs
 chrome.bookmarks
 chrome.history
 chrome.cookies
4
OWASP
Chrome Extensions - components
 UI pages
 background page
 option pages
 extension UI
Content scripts
 run alongside website
 interaction with
websites
5
OWASP 6
Diagram by Wade Alcorn. Thanks!
OWASP
Chrome Extensions - manifest
Manifest lists permissions, UI pages, content scripts
7
{
"manifest_version": 2,
"name": "Sample Extension",
"content_scripts": [
{
"matches": ["http://www.google.com/*"],
"js": ["jquery.js", "myscript.js"]
}
],
"background": {
"page": "background.html"
},
"permissions": [
"tabs",
"bookmarks",
"cookies"
"http://*/*",
"https://*/*",
]
}
OWASP
Chrome Extensions - restrictions
8
scheme websites chrome API
UI
page
content
script
chrome-
extension://
-
✔
limited by
permissions
http://
✔
limited by URL
-
OWASP
Isolated worlds
9
DOM
content script
JS
website
JS
OWASP
Exploiting v1 extensions
10
OWASP
UI page DOM XSS
 content-script takes data off website DOM
 sends it to UI page
 view fails to escape data upon viewing it
 cross-zone DOM XSS
11
OWASP 12
OWASP 12
OWASP 12
OWASP
UI page DOM XSS
 Consequences
 XSS in chrome-extension://
 access to chrome.* API
13
Slick RSS: feed finder 1.3
document.getElementById("heading").innerHTML =
"Subscribed to '<strong>" + title + "</strong>'";
OWASP
UI page DOM XSS
 Consequences
 XSS in chrome-extension://
 access to chrome.* API
13
<link rel="alternate" type="application/rss+xml"
title="hello <img src=x onerror='payload'>"
href="/rss.rss">
Slick RSS: feed finder 1.3
document.getElementById("heading").innerHTML =
"Subscribed to '<strong>" + title + "</strong>'";
OWASP
Exploiting UI page XSS
 Chrome Extension Exploitation Framework
 BEEF for Chrome extensions
14
https://github.com/koto/xsschef
OWASP
XSS ChEF
15
OWASP
XSS ChEF
16
OWASP
XSS ChEF
17
OWASP
XSS ChEF
18
OWASP
Chrome extensions v1 summary
 UI page XSS is very common
 note taking
 developer tools
 RSS readers
 Each XSS has big impact
 How do you eradicate XSS without relying
on developers?
19
OWASP 20
OWASP
Manifest v2 fixes
21
OWASP
Manifest v2
22
 Content Security Policy obligatory for UI pages
 no eval()
 no inline scripting
 no external scripts
 XSS exploitation very difficult
 Manifest v1 extensions slowly deprecating
 Jan 2014 - Chrome stops running them
 All fixed?
script-src 'self'; object-src 'self'
OWASP
Exploiting v2 extensions
23
OWASP
UI page XSS - new vectors
 eval() used in JS templating libraries
 mustachejs
 underscorejs
 jQuery template
 hoganjs
 ...
 Possible to relax CSP to allow unsafe-eval
 Some extensions use it
24
OWASP
Content script XSS
 Content scripts not subject to CSP
 Go figure...
25
OWASP 26
OWASP 26
OWASP 26
OWASP
Content script XSS
 XSS in http://
 chrome-extension CSP bypass
 access to DOM
 access to cookies
27
OWASP
As sexy as self XSS...
28
OWASP
Content script XSS
 website CSP bypass
 “Content scripts can also make cross-site
XMLHttpRequests to the same sites as their parent
extensions”
 http://developer.chrome.com/extensions/
content_scripts.html
29
OWASP
Content script XSS
 website CSP bypass
 “Content scripts can also make cross-site
XMLHttpRequests to the same sites as their parent
extensions”
 http://developer.chrome.com/extensions/
content_scripts.html
29
"permissions": [
"http://*/*",
"https://*/*",
]
OWASP
Content script XSS
 website CSP bypass
 “Content scripts can also make cross-site
XMLHttpRequests to the same sites as their parent
extensions”
 http://developer.chrome.com/extensions/
content_scripts.html
29
"permissions": [
"http://*/*",
"https://*/*",
]
40%
OWASP
Content script XSS
 Introducing Mosquito
 (Another) Chrome Extension XSS Exploitation tool
 XSS-Proxy for the new era
30
http://www.growingherbsforbeginners.com/growing-herbs-for-mosquito-season/
https://github.com/koto/mosquito
OWASP
Mosquito
31
XSS
ws:// HTTP/S proxy
 inspired by MalaRIA by Erlend Oftedal
 and BeEF tunneling proxy by @antisnatchor
x = new XMLHttpRequest();
x.open("GET", 'http://gmail.com', false);
x.setRequestHeader('X-Mosquito', 'yeah!');
x.send(null);
GET http://gmail.com HTTP/1.1
Host: gmail.com
X-Mosquito: yeah!
OWASP
DEMO TIME
 v 1.0.3.3
 https://chrome.google.com/webstore/detail/
anydo/kdadialhpiikehpdeejjeiikopddkjem
 0.5 mln users
 found by Sergey Belov
32
OWASP
NPAPI plugins vulnerabilities
 UI page gets the payload
 Forwards it to NPAPI plugin
 Binary vulnerability in plugin
 buffer overflow
 command injection
 ...
 Code run with OS user permission
 No sandbox!
33
OWASP 34
OWASP 34
OWASP 34
OWASP 34
OWASP
NPAPI plugins vulnerabilities
35
FB::variant gmailGPGAPI::encryptMessage(const FB::variant& recipients,const
FB::variant& msg)
{
string gpgFileLocation = """+m_appPath +"gpg.exe" ";
//...
vector<string> peopleToSendTo = recipients.convert_cast<vector<string> >();
string cmd = "c:windowssystem32cmd.exe /c ";
cmd.append(gpgFileLocation);
cmd.append("-e --armor");
cmd.append(" --trust-model=always");
for (unsigned int i = 0; i < peopleToSendTo.size(); i++) {
cmd.append(" -r");
cmd.append(peopleToSendTo.at(i));
}
cmd.append(" --output ");
CR-GPG 0.7.4
OWASP
NPAPI plugins vulnerabilities
35
FB::variant gmailGPGAPI::encryptMessage(const FB::variant& recipients,const
FB::variant& msg)
{
string gpgFileLocation = """+m_appPath +"gpg.exe" ";
//...
vector<string> peopleToSendTo = recipients.convert_cast<vector<string> >();
string cmd = "c:windowssystem32cmd.exe /c ";
cmd.append(gpgFileLocation);
cmd.append("-e --armor");
cmd.append(" --trust-model=always");
for (unsigned int i = 0; i < peopleToSendTo.size(); i++) {
cmd.append(" -r");
cmd.append(peopleToSendTo.at(i));
}
cmd.append(" --output ");
CR-GPG 0.7.4
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.10 (GNU/
Linux)
hQIOA5iUCyMfX/
D2EAgAhikRs40xo05gNu9XSIO2jrjTI
ShwfWK2d7+9xlv9UjDN
...
-----END PGP MESSAGE-----
OWASP
Bonus
 CSP bypass through filesystem: API
 Filesystem API - virtual filesystem for HTML app
 filesystem:http://example.com/file.png
 filesystem:chrome-extension://<id>/path.html
 Postman - REST client
 v 0.8.1
 180K users
 including @webtonull
36
OWASP
Summary
 Chrome extensions v2 still XSSable
 CSP should be treated as mitigation, not
prevention
 New tools for attack
37
OWASP
EOF
 @kkotowicz
 http://blog.kotowicz.net
 https://github.com/koto
 More research:
 Kyle Osborn, Matt Johansen – Hacking Google ChromeOS (Black
Hat 2011)
 http://www.eecs.berkeley.edu/~afelt/extensionvulnerabilities.pdf
 http://kotowicz.net/bh2012/advanced-chrome-extension-
exploitation-osborn-kotowicz.pdf
 Thanks: @0x[0-9a-f]{10}, @webtonull, @wisecwisec,
@johnwilander, @garethheyes, @antisnatchor,
@freddyb,@internot_, @pdjstone, ....
38

More Related Content

What's hot (20)

PPTX
Understanding Cross-site Request Forgery
Daniel Miessler
 
PPTX
Secure Coding 101 - OWASP University of Ottawa Workshop
Paul Ionescu
 
PPTX
OWASP Top 10 2021 Presentation (Jul 2022)
TzahiArabov
 
PDF
Using MITRE PRE-ATTACK and ATTACK in Cybercrime Education and Research
MITRE - ATT&CKcon
 
PPTX
Bug Bounty for - Beginners
Himanshu Kumar Das
 
PDF
FridaによるAndroidアプリの動的解析とフッキングの基礎
ken_kitahara
 
DOCX
ethical hacking report
Akhilesh Patel
 
PPTX
Xss attack
Manjushree Mashal
 
PDF
Bug Bounty Hunter Methodology - Nullcon 2016
bugcrowd
 
PPTX
最近のやられアプリを試してみた
zaki4649
 
PPTX
WTF is Penetration Testing v.2
Scott Sutherland
 
PDF
Penetration testing web application web application (in) security
Nahidul Kibria
 
PDF
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Shotaro Suzuki
 
PPTX
Getting Started with API Security Testing
SmartBear
 
PDF
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
Masato Kinugawa
 
PDF
Bug Bounty - Hackers Job
Arbin Godar
 
PPTX
Vulnerabilities in modern web applications
Niyas Nazar
 
PPTX
Red teaming probably isn't for you
Toby Kohlenberg
 
PPTX
Security testing
Khizra Sammad
 
PPTX
Bug Bounty 101
Shahee Mirza
 
Understanding Cross-site Request Forgery
Daniel Miessler
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Paul Ionescu
 
OWASP Top 10 2021 Presentation (Jul 2022)
TzahiArabov
 
Using MITRE PRE-ATTACK and ATTACK in Cybercrime Education and Research
MITRE - ATT&CKcon
 
Bug Bounty for - Beginners
Himanshu Kumar Das
 
FridaによるAndroidアプリの動的解析とフッキングの基礎
ken_kitahara
 
ethical hacking report
Akhilesh Patel
 
Xss attack
Manjushree Mashal
 
Bug Bounty Hunter Methodology - Nullcon 2016
bugcrowd
 
最近のやられアプリを試してみた
zaki4649
 
WTF is Penetration Testing v.2
Scott Sutherland
 
Penetration testing web application web application (in) security
Nahidul Kibria
 
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Shotaro Suzuki
 
Getting Started with API Security Testing
SmartBear
 
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
Masato Kinugawa
 
Bug Bounty - Hackers Job
Arbin Godar
 
Vulnerabilities in modern web applications
Niyas Nazar
 
Red teaming probably isn't for you
Toby Kohlenberg
 
Security testing
Khizra Sammad
 
Bug Bounty 101
Shahee Mirza
 

Viewers also liked (20)

PDF
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Krzysztof Kotowicz
 
PDF
Conférence Wikipedia pour l'Eracom
Florence Devouard
 
PDF
Certificate of Completion
David Lim
 
PPTX
バリアフリー推進ワークショップ(交通エコロジー・モビリティ財団)
Dementia Friendly Japan Initiative
 
PDF
Streams of Social Impact Work: Building Bridges in a New Evaluation Era with ...
The Rockefeller Foundation
 
PDF
USA on the Web
ron mader
 
PDF
2016 Veteran Insights Report
LinkedIn for Good
 
PDF
Dark Fairytales from a Phisherman (Vol. II)
Michele Orru
 
PDF
Practical Phishing Automation with PhishLulz - KiwiCon X
Michele Orru
 
PDF
Advanced Chrome extension exploitation
Krzysztof Kotowicz
 
DOC
NV kunstenaar Jan De Cock in de financiële problemen
Thierry Debels
 
PPTX
Church. Got an app for that?
ASDSVV
 
PPT
My social representation
Socialconsulting.gr
 
PDF
Symbiosis international university
yunus khan
 
PDF
Kunst, økonomi, kreativ kapitalisme
Jan Løhmann Stephensen
 
PDF
PrivateWave - sales presentation_en
Marco Pissarello
 
PDF
Greythorn Market Insights - February 2013
GreythornAU
 
PDF
Grafico diario del dax perfomance index para el 12 12-2012
Experiencia Trading
 
PDF
Jane's Pick of 10 Learning Tools for SchoolNetSA
Jane Hart
 
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Krzysztof Kotowicz
 
Conférence Wikipedia pour l'Eracom
Florence Devouard
 
Certificate of Completion
David Lim
 
バリアフリー推進ワークショップ(交通エコロジー・モビリティ財団)
Dementia Friendly Japan Initiative
 
Streams of Social Impact Work: Building Bridges in a New Evaluation Era with ...
The Rockefeller Foundation
 
USA on the Web
ron mader
 
2016 Veteran Insights Report
LinkedIn for Good
 
Dark Fairytales from a Phisherman (Vol. II)
Michele Orru
 
Practical Phishing Automation with PhishLulz - KiwiCon X
Michele Orru
 
Advanced Chrome extension exploitation
Krzysztof Kotowicz
 
NV kunstenaar Jan De Cock in de financiële problemen
Thierry Debels
 
Church. Got an app for that?
ASDSVV
 
My social representation
Socialconsulting.gr
 
Symbiosis international university
yunus khan
 
Kunst, økonomi, kreativ kapitalisme
Jan Løhmann Stephensen
 
PrivateWave - sales presentation_en
Marco Pissarello
 
Greythorn Market Insights - February 2013
GreythornAU
 
Grafico diario del dax perfomance index para el 12 12-2012
Experiencia Trading
 
Jane's Pick of 10 Learning Tools for SchoolNetSA
Jane Hart
 
Ad

Similar to I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions (20)

DOCX
Cisco WebEx vulnerability: it’s a kind of magic
ITrust - Cybersecurity as a Service
 
PPTX
Cross Context Scripting attacks & exploitation
Roberto Suggi Liverani
 
PPT
Hacking The World With Flash
joepangus
 
PPT
(In)Security Implication in the JS Universe
Stefano Di Paola
 
PDF
Xss frame work
Ngọc Liệu Nguyễn
 
PDF
Neat tricks to bypass CSRF-protection
Mikhail Egorov
 
PDF
The Hidden XSS - Attacking the Desktop & Mobile Platforms
kosborn
 
PPTX
News bytes Oct-2011
Ashwin Patil, GCIH, GCIA, GCFE
 
DOCX
Continuing in your role as a human service provider for your local.docx
richardnorman90310
 
PDF
Be ef presentation-securitybyte2011-michele_orru
Michele Orru
 
PPTX
W3 conf hill-html5-security-realities
Brad Hill
 
PPT
4.Xss
phanleson
 
PPS
Introducing Malware Script Detector
guest31a5be
 
PPS
Introducing Msd
Aung Khant
 
PPT
OWASP App Sec US - 2010
Aditya K Sood
 
PPTX
CONFidence 2015: The Top 10 Web Hacks of 2014 - Matt Johansen, Johnathan Kuskos
PROIDEA
 
PPTX
DevSecOps - automating security
John Staveley
 
PDF
Students of Navgujarat College of Computer Applications, Ahmedabad felt excit...
cresco
 
PDF
Antiviruxss
Marcusgcm
 
PDF
Rich Web App Security - Keeping your application safe
Jeremiah Grossman
 
Cisco WebEx vulnerability: it’s a kind of magic
ITrust - Cybersecurity as a Service
 
Cross Context Scripting attacks & exploitation
Roberto Suggi Liverani
 
Hacking The World With Flash
joepangus
 
(In)Security Implication in the JS Universe
Stefano Di Paola
 
Xss frame work
Ngọc Liệu Nguyễn
 
Neat tricks to bypass CSRF-protection
Mikhail Egorov
 
The Hidden XSS - Attacking the Desktop & Mobile Platforms
kosborn
 
News bytes Oct-2011
Ashwin Patil, GCIH, GCIA, GCFE
 
Continuing in your role as a human service provider for your local.docx
richardnorman90310
 
Be ef presentation-securitybyte2011-michele_orru
Michele Orru
 
W3 conf hill-html5-security-realities
Brad Hill
 
4.Xss
phanleson
 
Introducing Malware Script Detector
guest31a5be
 
Introducing Msd
Aung Khant
 
OWASP App Sec US - 2010
Aditya K Sood
 
CONFidence 2015: The Top 10 Web Hacks of 2014 - Matt Johansen, Johnathan Kuskos
PROIDEA
 
DevSecOps - automating security
John Staveley
 
Students of Navgujarat College of Computer Applications, Ahmedabad felt excit...
cresco
 
Antiviruxss
Marcusgcm
 
Rich Web App Security - Keeping your application safe
Jeremiah Grossman
 
Ad

More from Krzysztof Kotowicz (15)

PDF
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Krzysztof Kotowicz
 
PDF
Trusted Types @ W3C TPAC 2018
Krzysztof Kotowicz
 
PDF
Trusted Types and the end of DOM XSS
Krzysztof Kotowicz
 
PDF
Hacking HTML5 offensive course (Zeronights edition)
Krzysztof Kotowicz
 
PDF
HTML5: Atak i obrona
Krzysztof Kotowicz
 
PDF
I'm in your browser, pwning your stuff
Krzysztof Kotowicz
 
PDF
Html5: Something wicked this way comes (Hack in Paris)
Krzysztof Kotowicz
 
PDF
Something wicked this way comes - CONFidence
Krzysztof Kotowicz
 
PDF
Html5: something wicked this way comes - HackPra
Krzysztof Kotowicz
 
PDF
Html5: something wicked this way comes
Krzysztof Kotowicz
 
PDF
Creating, obfuscating and analyzing malware JavaScript
Krzysztof Kotowicz
 
PDF
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Krzysztof Kotowicz
 
PDF
Jak ocalić swoje dane przed SQL injection?
Krzysztof Kotowicz
 
PDF
SQL Injection: complete walkthrough (not only) for PHP developers
Krzysztof Kotowicz
 
PPT
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Krzysztof Kotowicz
 
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Krzysztof Kotowicz
 
Trusted Types @ W3C TPAC 2018
Krzysztof Kotowicz
 
Trusted Types and the end of DOM XSS
Krzysztof Kotowicz
 
Hacking HTML5 offensive course (Zeronights edition)
Krzysztof Kotowicz
 
HTML5: Atak i obrona
Krzysztof Kotowicz
 
I'm in your browser, pwning your stuff
Krzysztof Kotowicz
 
Html5: Something wicked this way comes (Hack in Paris)
Krzysztof Kotowicz
 
Something wicked this way comes - CONFidence
Krzysztof Kotowicz
 
Html5: something wicked this way comes - HackPra
Krzysztof Kotowicz
 
Html5: something wicked this way comes
Krzysztof Kotowicz
 
Creating, obfuscating and analyzing malware JavaScript
Krzysztof Kotowicz
 
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Krzysztof Kotowicz
 
Jak ocalić swoje dane przed SQL injection?
Krzysztof Kotowicz
 
SQL Injection: complete walkthrough (not only) for PHP developers
Krzysztof Kotowicz
 
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Krzysztof Kotowicz
 

Recently uploaded (20)

PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
July Patch Tuesday
Ivanti
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
July Patch Tuesday
Ivanti
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 

I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions

  • 1. Copyright 2007 © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation OWASP http://www.owasp.org I'm in ur browser, pwning your stuff Attacking (with) Google Chrome extensions Krzysztof Kotowicz SecuRing [email protected]
  • 2. OWASP About me Security research client side security HTML5 UI redressing Chrome extensions Black Hat USA, BruCON, Hack in Paris, CONFidence, ... IT security consultant @ SecuRing web app, mobile pentests security code reviews 2
  • 3. OWASP Plan 3 Chrome Extensions architecture Exploiting legacy (v1) extensions Manifest v2 fixes Exploiting v2 extensions "Break The Batman Part 3" by Eric Merced / Eric Merced aka stickfiguredancer
  • 4. OWASP Chrome Extensions  Not plugins (Java, Flash, ...)  HTML5 applications  html, javascript, css Installed from Chrome Web Store  Access to privileged API  chrome.tabs  chrome.bookmarks  chrome.history  chrome.cookies 4
  • 5. OWASP Chrome Extensions - components  UI pages  background page  option pages  extension UI Content scripts  run alongside website  interaction with websites 5
  • 6. OWASP 6 Diagram by Wade Alcorn. Thanks!
  • 7. OWASP Chrome Extensions - manifest Manifest lists permissions, UI pages, content scripts 7 { "manifest_version": 2, "name": "Sample Extension", "content_scripts": [ { "matches": ["http://www.google.com/*"], "js": ["jquery.js", "myscript.js"] } ], "background": { "page": "background.html" }, "permissions": [ "tabs", "bookmarks", "cookies" "http://*/*", "https://*/*", ] }
  • 8. OWASP Chrome Extensions - restrictions 8 scheme websites chrome API UI page content script chrome- extension:// - ✔ limited by permissions http:// ✔ limited by URL -
  • 11. OWASP UI page DOM XSS  content-script takes data off website DOM  sends it to UI page  view fails to escape data upon viewing it  cross-zone DOM XSS 11
  • 15. OWASP UI page DOM XSS  Consequences  XSS in chrome-extension://  access to chrome.* API 13 Slick RSS: feed finder 1.3 document.getElementById("heading").innerHTML = "Subscribed to '<strong>" + title + "</strong>'";
  • 16. OWASP UI page DOM XSS  Consequences  XSS in chrome-extension://  access to chrome.* API 13 <link rel="alternate" type="application/rss+xml" title="hello <img src=x onerror='payload'>" href="/rss.rss"> Slick RSS: feed finder 1.3 document.getElementById("heading").innerHTML = "Subscribed to '<strong>" + title + "</strong>'";
  • 17. OWASP Exploiting UI page XSS  Chrome Extension Exploitation Framework  BEEF for Chrome extensions 14 https://github.com/koto/xsschef
  • 22. OWASP Chrome extensions v1 summary  UI page XSS is very common  note taking  developer tools  RSS readers  Each XSS has big impact  How do you eradicate XSS without relying on developers? 19
  • 25. OWASP Manifest v2 22  Content Security Policy obligatory for UI pages  no eval()  no inline scripting  no external scripts  XSS exploitation very difficult  Manifest v1 extensions slowly deprecating  Jan 2014 - Chrome stops running them  All fixed? script-src 'self'; object-src 'self'
  • 27. OWASP UI page XSS - new vectors  eval() used in JS templating libraries  mustachejs  underscorejs  jQuery template  hoganjs  ...  Possible to relax CSP to allow unsafe-eval  Some extensions use it 24
  • 28. OWASP Content script XSS  Content scripts not subject to CSP  Go figure... 25
  • 32. OWASP Content script XSS  XSS in http://  chrome-extension CSP bypass  access to DOM  access to cookies 27
  • 33. OWASP As sexy as self XSS... 28
  • 34. OWASP Content script XSS  website CSP bypass  “Content scripts can also make cross-site XMLHttpRequests to the same sites as their parent extensions”  http://developer.chrome.com/extensions/ content_scripts.html 29
  • 35. OWASP Content script XSS  website CSP bypass  “Content scripts can also make cross-site XMLHttpRequests to the same sites as their parent extensions”  http://developer.chrome.com/extensions/ content_scripts.html 29 "permissions": [ "http://*/*", "https://*/*", ]
  • 36. OWASP Content script XSS  website CSP bypass  “Content scripts can also make cross-site XMLHttpRequests to the same sites as their parent extensions”  http://developer.chrome.com/extensions/ content_scripts.html 29 "permissions": [ "http://*/*", "https://*/*", ] 40%
  • 37. OWASP Content script XSS  Introducing Mosquito  (Another) Chrome Extension XSS Exploitation tool  XSS-Proxy for the new era 30 http://www.growingherbsforbeginners.com/growing-herbs-for-mosquito-season/ https://github.com/koto/mosquito
  • 38. OWASP Mosquito 31 XSS ws:// HTTP/S proxy  inspired by MalaRIA by Erlend Oftedal  and BeEF tunneling proxy by @antisnatchor x = new XMLHttpRequest(); x.open("GET", 'http://gmail.com', false); x.setRequestHeader('X-Mosquito', 'yeah!'); x.send(null); GET http://gmail.com HTTP/1.1 Host: gmail.com X-Mosquito: yeah!
  • 39. OWASP DEMO TIME  v 1.0.3.3  https://chrome.google.com/webstore/detail/ anydo/kdadialhpiikehpdeejjeiikopddkjem  0.5 mln users  found by Sergey Belov 32
  • 40. OWASP NPAPI plugins vulnerabilities  UI page gets the payload  Forwards it to NPAPI plugin  Binary vulnerability in plugin  buffer overflow  command injection  ...  Code run with OS user permission  No sandbox! 33
  • 45. OWASP NPAPI plugins vulnerabilities 35 FB::variant gmailGPGAPI::encryptMessage(const FB::variant& recipients,const FB::variant& msg) { string gpgFileLocation = """+m_appPath +"gpg.exe" "; //... vector<string> peopleToSendTo = recipients.convert_cast<vector<string> >(); string cmd = "c:windowssystem32cmd.exe /c "; cmd.append(gpgFileLocation); cmd.append("-e --armor"); cmd.append(" --trust-model=always"); for (unsigned int i = 0; i < peopleToSendTo.size(); i++) { cmd.append(" -r"); cmd.append(peopleToSendTo.at(i)); } cmd.append(" --output "); CR-GPG 0.7.4
  • 46. OWASP NPAPI plugins vulnerabilities 35 FB::variant gmailGPGAPI::encryptMessage(const FB::variant& recipients,const FB::variant& msg) { string gpgFileLocation = """+m_appPath +"gpg.exe" "; //... vector<string> peopleToSendTo = recipients.convert_cast<vector<string> >(); string cmd = "c:windowssystem32cmd.exe /c "; cmd.append(gpgFileLocation); cmd.append("-e --armor"); cmd.append(" --trust-model=always"); for (unsigned int i = 0; i < peopleToSendTo.size(); i++) { cmd.append(" -r"); cmd.append(peopleToSendTo.at(i)); } cmd.append(" --output "); CR-GPG 0.7.4 -----BEGIN PGP MESSAGE----- Version: GnuPG v1.4.10 (GNU/ Linux) hQIOA5iUCyMfX/ D2EAgAhikRs40xo05gNu9XSIO2jrjTI ShwfWK2d7+9xlv9UjDN ... -----END PGP MESSAGE-----
  • 47. OWASP Bonus  CSP bypass through filesystem: API  Filesystem API - virtual filesystem for HTML app  filesystem:http://example.com/file.png  filesystem:chrome-extension://<id>/path.html  Postman - REST client  v 0.8.1  180K users  including @webtonull 36
  • 48. OWASP Summary  Chrome extensions v2 still XSSable  CSP should be treated as mitigation, not prevention  New tools for attack 37
  • 49. OWASP EOF  @kkotowicz  http://blog.kotowicz.net  https://github.com/koto  More research:  Kyle Osborn, Matt Johansen – Hacking Google ChromeOS (Black Hat 2011)  http://www.eecs.berkeley.edu/~afelt/extensionvulnerabilities.pdf  http://kotowicz.net/bh2012/advanced-chrome-extension- exploitation-osborn-kotowicz.pdf  Thanks: @0x[0-9a-f]{10}, @webtonull, @wisecwisec, @johnwilander, @garethheyes, @antisnatchor, @freddyb,@internot_, @pdjstone, .... 38