SlideShare a Scribd company logo
Howto get browser
persistence and
remote execution
Goals:
● Infect web browsers
● Be able to execute javascript in victim(s) browser
● Intercept user traffic (“keylogger”)
● Create a botnet
● Don’t fuck up for anyone (at least good people)
Security Challenge: First off, how to get access?
Option #1: Physical access
● Hassle to spread
● Expensive with many USBs
● Risky
● Requires a lot of traveling
● Or social engineering
How to infect, and run javascript?
Option #2: Hack a server
● Everyone is doing it
● You have to work with PHP
● Looking for exploits and weakspots in PHP software is lame
● Web sites with great visitor numbers are more secured
How to infect, and run javascript?
Option #3: Pishing
● It just sounds lame
● Trick stupid people isn’t funny
● Lot of heat for little gain
● The need of fake websites
● The need to distribute a shitload of spam
How to infect, and run javascript?
Option #3.1: Man in the middle attacks: Local LAN
● Works great when you’re on the <LAN>
● Hassle to get into private LAN’s
● You need access to a lot of LAN’s
● Can’t start with fake certificates, too risky
● Don’t scale
How to infect, and run javascript?
Option #3.2: Man in the middle attacks: Tor exit node
● Again,everyone does it..
● Short lived fun, automatic scans of modified content
● You need to switch IP quite often to avoid ban
● Tor Browsers have NoScript on per default
● Don’t give Tor a worse name than it got, it’s our last hope :)
How to infect, and run javascript?
Option #3.3: Man in the middle attacks: Ads
● Visiting ads company sites is fun for your javascript engine
● Less options on most sites (bbcodes and “IDEs”)
● Pay for browser minutes is actually an industry
● Lame to pay for servers, and ads
How to infect, and run javascript?
Option #3.4: Man in the middle attacks: Http proxy
● It’s built upon MITM architecture
● It’s a lot of proxy lists out there, which copies each others
● Less to hassle with, perfect when lazy
● Apparently still quite popular
● Often chained, so the user can feel “safe”
● At least 80% of all users are bad people
How to infect, and run javascript?
Interesting facts about http proxies
● Access to edit or remove the following security headers
• Cross-Origin Resource Sharing (CORS)
• Same-Origin Policy
• X-Frame-Options
● TLS/SSL traffic often leak info at the start of connection
• URL
• POST body
How to infect, and run javascript?
So how do we do it then, where to start?
● Write a TOS/Privacy policy warn good people
● The TOS is quite similar to US gov’s TOS, should be legal
● Then, find countries with no deal with Norway/EU
● Preferably a countries without internet laws at all (to be safe)
● Use Tor for registration with a fake name and for ssh
How to infect, and run javascript?
So how do we do it then, technical speaking?
● Setup a proxy chain where all non TLS/SSL traffic is checked
● Inject minimal javascript code (2-3lines) into all .js fetched
● Fallback on html inject if no .js fetched
● Pass through all other traffic as normal
How to infect, and run javascript?
So, what about this javascript code?
● Don’t use Beef (The Browser Exploitation Framework) loaders
● Or any other well known loader for that matter
● Pain, but just ECMA 5 written without any babel/webpack
● Build your own “webpack” if needed
● Use workers if available
How to infect, and run javascript?
Why strict javascript rules?
● Beef and common loaders get picked up by AV and similar
● It need to load and run fast, undetected
● Support old browsers without big third party libraries
● Being detected often tend to make the proxy marked bad
● The script needs to adjust to all kinds of environments
How to infect, and run javascript?
So, how about the persistence part?
● This is the tricky and fun part, it’s no good way
● However, you can make your code load quite often
• Specially target small CDN’s delivering jquery or whatever
• Set cache time to 2070 on CDN’s javascript file or something
• Runs on each website that uses the lib and the CDN
• Bonus: no evidence on victim computer if wished (Drop cache)
How to infect, and run javascript?
Did it work?
● Too good
● A botnet is archived
● No legitimate traffic found (out of ~1Tb of traffic)
● Nothing done to victim computers, content & bots removed
● Data deleted
● No, Knowit didn’t have anything at all to do with this test
How to infect, and run javascript?
What did we learn?
● Again, Knowit didn’t have anything at all to do with this test
● You can archive a botnet quite easy
● Could perform quite massive DDoS attacks (lame)
● Could control victim’s browser “tab” after proxy usage
● Can be updated over internet, “unlimited possibilities”
How to infect, and run javascript?
Mikal Villa
mikal.villa@knowit.no, @mikalv
2017-08-21 TSC Summit #4
Thanks

More Related Content

PDF
Building your own web based Authenticator
PPTX
Same-origin Policy (SOP)
PDF
Bypassing Web Application Firewalls and other security filters
PDF
Node js oc meetup 2 socket io intro
PDF
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
PDF
Make CSRF Again
PDF
Hacking Vulnerable Websites to Bypass Firewalls
PDF
Introduction To ICT Security Audit OWASP Day Malaysia 2011
Building your own web based Authenticator
Same-origin Policy (SOP)
Bypassing Web Application Firewalls and other security filters
Node js oc meetup 2 socket io intro
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
Make CSRF Again
Hacking Vulnerable Websites to Bypass Firewalls
Introduction To ICT Security Audit OWASP Day Malaysia 2011

What's hot (19)

PPTX
Hacking - Breaking Into It
ODP
Wordpress Plugins Scanner
PPTX
"Introduction to Bug Hunting", Yasser Ali
PDF
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
PDF
Петър Николов. "Mobile Ecommerce Technical Performance"
PPTX
Pen Testing, Red Teaming, and More
PDF
Ever Present Persistence - Established Footholds Seen in the Wild
PDF
Wordlist Generation and Wifi Cracking
PDF
Lessons learned from Node.js - Callbacks / Promises
PPTX
11 Commandments of Cyber Security for the Home
PDF
An EyeWitness View into your Network
PDF
WordCamp Barcelona 2015 : From Design to a Theme
PDF
MonkeySpider at Sicherheit 2008
PDF
CheckPlease: Payload-Agnostic Targeted Malware
PDF
HTML5 Messaging (Post Message)
PDF
Sencha Touch in Action
PDF
Understanding and implementing website security
PDF
Error Handling in WebRTC
PDF
Egress-Assess and Owning Data Exfiltration
Hacking - Breaking Into It
Wordpress Plugins Scanner
"Introduction to Bug Hunting", Yasser Ali
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
Петър Николов. "Mobile Ecommerce Technical Performance"
Pen Testing, Red Teaming, and More
Ever Present Persistence - Established Footholds Seen in the Wild
Wordlist Generation and Wifi Cracking
Lessons learned from Node.js - Callbacks / Promises
11 Commandments of Cyber Security for the Home
An EyeWitness View into your Network
WordCamp Barcelona 2015 : From Design to a Theme
MonkeySpider at Sicherheit 2008
CheckPlease: Payload-Agnostic Targeted Malware
HTML5 Messaging (Post Message)
Sencha Touch in Action
Understanding and implementing website security
Error Handling in WebRTC
Egress-Assess and Owning Data Exfiltration
Ad

Similar to TSC Summit #4 - Howto get browser persitence and remote execution (JS) (20)

PDF
MUD Workshop 2025 - The rise of the machines.pdf
PDF
Introduction to Web Application Security - Blackhoodie US 2018
PDF
All Aboard The Stateful Train
PDF
Defcon 23 - David Huerta - alice and bob are really confused
PPTX
Breaking The Curse of Web Application Encryption Using Browser Bruter
PDF
SPDY and What to Consider for HTTP/2.0
PPTX
Ransomware - what is it, how to protect against it
PDF
Defcon 20-zulla-improving-web-vulnerability-scanning
PDF
Defcon 20-zulla-improving-web-vulnerability-scanning
PDF
Real Time Realitites
PDF
PyMultitor
PDF
Web Security: What's wrong, and how the bad guys can break your website
PDF
Practical Phishing Automation with PhishLulz - KiwiCon X
PDF
HTML5 - The Good, the Bad, the Ugly
PDF
CONFidence 2018: XSS is dead. We just don't get it (Mario Heiderich)
ODP
Security and why you need to review yours.
PDF
12 tricks to avoid hackers breaks your CI / CD
PPTX
External JavaScript Widget Development Best Practices
PDF
Hyper Island - 2012
PDF
Security Vulnerabilities: How to Defend Against Them
MUD Workshop 2025 - The rise of the machines.pdf
Introduction to Web Application Security - Blackhoodie US 2018
All Aboard The Stateful Train
Defcon 23 - David Huerta - alice and bob are really confused
Breaking The Curse of Web Application Encryption Using Browser Bruter
SPDY and What to Consider for HTTP/2.0
Ransomware - what is it, how to protect against it
Defcon 20-zulla-improving-web-vulnerability-scanning
Defcon 20-zulla-improving-web-vulnerability-scanning
Real Time Realitites
PyMultitor
Web Security: What's wrong, and how the bad guys can break your website
Practical Phishing Automation with PhishLulz - KiwiCon X
HTML5 - The Good, the Bad, the Ugly
CONFidence 2018: XSS is dead. We just don't get it (Mario Heiderich)
Security and why you need to review yours.
12 tricks to avoid hackers breaks your CI / CD
External JavaScript Widget Development Best Practices
Hyper Island - 2012
Security Vulnerabilities: How to Defend Against Them
Ad

Recently uploaded (20)

PPTX
Funds Management Learning Material for Beg
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
innovation process that make everything different.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
Internet___Basics___Styled_ presentation
PDF
Testing WebRTC applications at scale.pdf
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Funds Management Learning Material for Beg
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
WebRTC in SignalWire - troubleshooting media negotiation
PptxGenJS_Demo_Chart_20250317130215833.pptx
An introduction to the IFRS (ISSB) Stndards.pdf
Power Point - Lesson 3_2.pptx grad school presentation
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
innovation process that make everything different.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Sims 4 Historia para lo sims 4 para jugar
introduction about ICD -10 & ICD-11 ppt.pptx
522797556-Unit-2-Temperature-measurement-1-1.pptx
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Internet___Basics___Styled_ presentation
Testing WebRTC applications at scale.pdf
Design_with_Watersergyerge45hrbgre4top (1).ppt
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
The New Creative Director: How AI Tools for Social Media Content Creation Are...

TSC Summit #4 - Howto get browser persitence and remote execution (JS)

  • 1. Howto get browser persistence and remote execution
  • 2. Goals: ● Infect web browsers ● Be able to execute javascript in victim(s) browser ● Intercept user traffic (“keylogger”) ● Create a botnet ● Don’t fuck up for anyone (at least good people) Security Challenge: First off, how to get access?
  • 3. Option #1: Physical access ● Hassle to spread ● Expensive with many USBs ● Risky ● Requires a lot of traveling ● Or social engineering How to infect, and run javascript?
  • 4. Option #2: Hack a server ● Everyone is doing it ● You have to work with PHP ● Looking for exploits and weakspots in PHP software is lame ● Web sites with great visitor numbers are more secured How to infect, and run javascript?
  • 5. Option #3: Pishing ● It just sounds lame ● Trick stupid people isn’t funny ● Lot of heat for little gain ● The need of fake websites ● The need to distribute a shitload of spam How to infect, and run javascript?
  • 6. Option #3.1: Man in the middle attacks: Local LAN ● Works great when you’re on the <LAN> ● Hassle to get into private LAN’s ● You need access to a lot of LAN’s ● Can’t start with fake certificates, too risky ● Don’t scale How to infect, and run javascript?
  • 7. Option #3.2: Man in the middle attacks: Tor exit node ● Again,everyone does it.. ● Short lived fun, automatic scans of modified content ● You need to switch IP quite often to avoid ban ● Tor Browsers have NoScript on per default ● Don’t give Tor a worse name than it got, it’s our last hope :) How to infect, and run javascript?
  • 8. Option #3.3: Man in the middle attacks: Ads ● Visiting ads company sites is fun for your javascript engine ● Less options on most sites (bbcodes and “IDEs”) ● Pay for browser minutes is actually an industry ● Lame to pay for servers, and ads How to infect, and run javascript?
  • 9. Option #3.4: Man in the middle attacks: Http proxy ● It’s built upon MITM architecture ● It’s a lot of proxy lists out there, which copies each others ● Less to hassle with, perfect when lazy ● Apparently still quite popular ● Often chained, so the user can feel “safe” ● At least 80% of all users are bad people How to infect, and run javascript?
  • 10. Interesting facts about http proxies ● Access to edit or remove the following security headers • Cross-Origin Resource Sharing (CORS) • Same-Origin Policy • X-Frame-Options ● TLS/SSL traffic often leak info at the start of connection • URL • POST body How to infect, and run javascript?
  • 11. So how do we do it then, where to start? ● Write a TOS/Privacy policy warn good people ● The TOS is quite similar to US gov’s TOS, should be legal ● Then, find countries with no deal with Norway/EU ● Preferably a countries without internet laws at all (to be safe) ● Use Tor for registration with a fake name and for ssh How to infect, and run javascript?
  • 12. So how do we do it then, technical speaking? ● Setup a proxy chain where all non TLS/SSL traffic is checked ● Inject minimal javascript code (2-3lines) into all .js fetched ● Fallback on html inject if no .js fetched ● Pass through all other traffic as normal How to infect, and run javascript?
  • 13. So, what about this javascript code? ● Don’t use Beef (The Browser Exploitation Framework) loaders ● Or any other well known loader for that matter ● Pain, but just ECMA 5 written without any babel/webpack ● Build your own “webpack” if needed ● Use workers if available How to infect, and run javascript?
  • 14. Why strict javascript rules? ● Beef and common loaders get picked up by AV and similar ● It need to load and run fast, undetected ● Support old browsers without big third party libraries ● Being detected often tend to make the proxy marked bad ● The script needs to adjust to all kinds of environments How to infect, and run javascript?
  • 15. So, how about the persistence part? ● This is the tricky and fun part, it’s no good way ● However, you can make your code load quite often • Specially target small CDN’s delivering jquery or whatever • Set cache time to 2070 on CDN’s javascript file or something • Runs on each website that uses the lib and the CDN • Bonus: no evidence on victim computer if wished (Drop cache) How to infect, and run javascript?
  • 16. Did it work? ● Too good ● A botnet is archived ● No legitimate traffic found (out of ~1Tb of traffic) ● Nothing done to victim computers, content & bots removed ● Data deleted ● No, Knowit didn’t have anything at all to do with this test How to infect, and run javascript?
  • 17. What did we learn? ● Again, Knowit didn’t have anything at all to do with this test ● You can archive a botnet quite easy ● Could perform quite massive DDoS attacks (lame) ● Could control victim’s browser “tab” after proxy usage ● Can be updated over internet, “unlimited possibilities” How to infect, and run javascript?