SlideShare a Scribd company logo
"Running vulnerable code
in local networks"
|| "how to get pwned by any website"
127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1
The web is broken!
Insecure standards, protocols and plugins
● WebRTC
● Leaks real IP behind VPN
● Can scan the local network
● SVG
● Not always blocked in picture uploads
● Leads to stored XSS, various filter bypasses, could be used to bypass CSP nonces
● Flash
● Unofficial competition between Flash and Firefox who gets most CVEs for code execution
● Exploit kit coder's choice
SOP is too permissive
● Cross Site History Manipulation (XSHM)
● Load images and scripts from any domain
● Frame all the web sites
● But X-Frame-options?!
■ Still leaks page loading times
■ In some cases window.open() also does the job
● Does NOT prevent making requests ONLY prevents receiving responses
● Cookies are sent by default
Are authenticated cross-origin requests necessary?
● Sending cookies when including remote images?
● Sending cookies when submitting forms to another website?
● Necessary? Sometimes.
● Should it be the default behaviour? Please no!
● Sending cookies with GET requests?
● There's not really a way around it
● Would annoy users
The Problem
● Users don't want to trade too much comfort for security
● It's up to developers to implement counter measures for those
shortcomings
■ CSRF Tokens
■ Same-Site Cookies
■ Checks for Origin header (web sockets)
● Developers don't want to trade too much comfort for security
● SOP is the enemy
■ crossdomain.xml
■ postMessage
■ CORS
■ JSONP
That's nothing new
● We know we should use strong passwords and 2FA
● We should implement every possible counter measure for permissive SOP
and other browser "features"
● We should not run insecure code in production
● We need to update our software
We all follow those guidelines
Except when we don't
well...
Let me explain
At what point do you consider your code as publicly accessible?
● While coding
● In your private repository
● In your testing environment
● In production ✔
✔
X
Wait what?
● My web server binds to 127.0.0.1!
● Other servers used for testing are behind a firewall!
● I am the only one who has access to my code!
● Windows Defender is up and running, so I don't even know why I watch this
presentation!11
You forget about your biggest attack surface
To hack your local application attackers can use
● CSRF
● DNS rebinding
● XSHM and similar attacks
● Timing side channels
Security guidelines
Now tell me again, at every stage of your web app development:
● Use strong passwords / 2FA / authentication?
● Exploitable through DNS rebinding, XSHM, CSRF
● Protect against CSRF?
● Exploitable through - well - CSRF
■ Also XSHM
■ Doesn't matter for DNS rebinding anyway if it's unauthenticated / passwords are
guessable
● Only run secure code?
● As hacker or security researcher?
■ Get another job.
● As a developer?
■ I have some small doubts here
Hacking the dev? Why not the server?
● Developers are the more valuable target when
● They have a copy of production data or access to backups
● They have access to other internal systems
● Production server is secured
● Their private movie collection is big enough (Critical mass > 500 GB)
● There might be multiple sites the developer is responsible for
● The application is announced but not online yet (startups, new features in
existing sites)
● There's a higher chance * to find buggy code in a development environment
● * Except if you develop the facebook messenger for android, chances should be equal then
But I'm not a developer
Good point. No testing environment, no vulnerable applications, right?
● Applications that run web apps on your computer
● Management interfaces
● websockets to exchange data between website and client
● Other devices in your network
● Your internet connected fidget spinner (or whatever monstrosity kickstarter creates next)
● NAS management interface
● One web interface almost every consumer has in the network
● Vulnerable home Router
DEMO
TIME
Well, this is bad
"That was a lucky guess with the default password. And stuff like an SQL injection
can't be abused just with CSRF while you are cross-domain."
● Completely right
● You can't read the response of a request
● You can't add data if it's a SELECT query
● OOB exfiltration is not possible without proper privileges
■ Conclusion: My data is safe!
XXX WRONG
● Oh come on, this is starting to get annoying
● Just because it is annoying. If you assume anything regarding SOP it's most likely wrong
● What's the matter now? How can an attacker possibly abuse an SQL injection
through the victim's browser even though there's SOP in place?
We've talked about them before: iframes!
Iframes can be used to extract data from an SQL injection
● Well, not only iframes, but also <img>, xhr and even the websocket API
● The problem? Leaking page loading times
● So what?
● SQL injection + delayed page loading time = ?
● Right. We can abuse blind SQL injections cross-domain!
● Seems like it's...
DEMO
TIME
Well, this is bad too
But what are the alternatives?
● Running your code in a VM
● Separation, but not that practical
● Can still lead to compromise of host machine or other machines in the network
● Code can be modified
● Don't visit the internet while you code
●
● Your code might require an active internet connection
Is there any way to be safe?
DNS Rebinding
● Side Effect:
● New host header
■ Shared hosting not vulnerable (only the default host)
■ We can whitelist the original host header
● Is it preventable?
● Yes. Either on application or server level (preferred).
● If the host header doesn't match a whitelisted value -> 403.
● Works for apache, IIS, nginx
Is there any way to be safe?
CSRF
● Problem:
● There might be no authentication yet
■ Critical functions might be exposed for everyone
■ No CSRF protection added yet
● You audit vulnerable code without CSRF protection at all
● There is not an easy solution for this
● Using frameworks
● Starting with
■ CSRF protection
■ Authentication
MEH
Is there any way to be safe?
(Experimental) Universal CSRF Protection in your environment? Conveniently
possible for PHP apps
● First: Create a file with the following content:
Is there any way to be safe?
Halfway done
● Next: Add the file to the PHP.ini directive auto_prepend_file
● This will automatically include the file whenever any PHP file is parsed. This works in a similar
fashion as PHP's require().
● This means, whenever a web page is opened it will
● Load the PHP file
● Check if a cookie with the name "access" is set
■ If it's not, it will just throw an error, set the cookie and stop execution
■ If it is, the file does nothing and doesn't interfere with your code
● Since it's a same site cookie requests can only be made from the same domain
Conclusion
Don't rely on SOP doing the right thing
● Everything we talked about is preventable, countermeasures are just not
always well known
● Developers and Security Researchers should keep in mind that their testing
environments are publicly accessible to a certain degree
● Even the average user is at risk. Passwords for routers should be strong and
unique like every other password
● SOP alone is not going to save you

More Related Content

PPTX
Same-origin Policy (SOP)
PDF
Bypassing Web Application Firewalls and other security filters
PDF
Make CSRF Again
PPSX
Scaling-up and Automating Web Application Security Tech Talk
PPTX
Learn to pen-test with OWASP ZAP
PPTX
Owasp web application security trends
PDF
My tryst with sourcecode review
PPTX
Security Testing - Zap It
Same-origin Policy (SOP)
Bypassing Web Application Firewalls and other security filters
Make CSRF Again
Scaling-up and Automating Web Application Security Tech Talk
Learn to pen-test with OWASP ZAP
Owasp web application security trends
My tryst with sourcecode review
Security Testing - Zap It

What's hot (20)

PPTX
Security Code Review 101
PDF
Tale of Forgotten Disclosure and Lesson learned
PDF
I got 99 trends and a # is all of them
PPTX
Javascript Security - Three main methods of defending your MEAN stack
PPTX
OWASP Zed Attack Proxy
PPTX
Javascript Security
PDF
Buried by time, dust and BeEF
PPT
Same Origin Policy Weaknesses
PPTX
Everybody loves html5,h4ck3rs too
PPTX
Security testautomation
PDF
Using the Zed Attack Proxy as a Web App testing tool
PPTX
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
PDF
Secure Your Wordpress
PPTX
Client-side JavaScript Vulnerabilities
PDF
Content Security Policy - Lessons learned at Yahoo
PDF
When the internet bleeded : RootConf 2014
PDF
JavaScript Security
PDF
[OWASP Poland Day] A study of Electron security
PPT
[Php Camp]Owasp Php Top5+Csrf
PDF
How to secure web applications
Security Code Review 101
Tale of Forgotten Disclosure and Lesson learned
I got 99 trends and a # is all of them
Javascript Security - Three main methods of defending your MEAN stack
OWASP Zed Attack Proxy
Javascript Security
Buried by time, dust and BeEF
Same Origin Policy Weaknesses
Everybody loves html5,h4ck3rs too
Security testautomation
Using the Zed Attack Proxy as a Web App testing tool
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Secure Your Wordpress
Client-side JavaScript Vulnerabilities
Content Security Policy - Lessons learned at Yahoo
When the internet bleeded : RootConf 2014
JavaScript Security
[OWASP Poland Day] A study of Electron security
[Php Camp]Owasp Php Top5+Csrf
How to secure web applications

Similar to Hacking Vulnerable Websites to Bypass Firewalls (20)

PDF
Web Security: What's wrong, and how the bad guys can break your website
PPTX
TSC Summit #4 - Howto get browser persitence and remote execution (JS)
PDF
Higher Level Malware
PDF
Anatomy of PHP Shells
PDF
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
PDF
Black hat dc-2010-egypt-uav-slides
PDF
12 tricks to avoid hackers breaks your CI / CD
PDF
Wordpress security
PDF
How to get started with Site Reliability Engineering
PDF
AV Evasion with the Veil Framework
PDF
Joomla Code Quality Control and Automation Testing
PPTX
Rooted con 2020 - from the heaven to hell in the CI - CD
PPTX
Introduce native client
PDF
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
PPTX
Security research over Windows #defcon china
PPTX
PDF
Defcon 20-zulla-improving-web-vulnerability-scanning
PDF
Defcon 20-zulla-improving-web-vulnerability-scanning
PDF
MobSecCon 2015 - Burning Marshmallows
PDF
Jinx - Malware 2.0
Web Security: What's wrong, and how the bad guys can break your website
TSC Summit #4 - Howto get browser persitence and remote execution (JS)
Higher Level Malware
Anatomy of PHP Shells
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Black hat dc-2010-egypt-uav-slides
12 tricks to avoid hackers breaks your CI / CD
Wordpress security
How to get started with Site Reliability Engineering
AV Evasion with the Veil Framework
Joomla Code Quality Control and Automation Testing
Rooted con 2020 - from the heaven to hell in the CI - CD
Introduce native client
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Security research over Windows #defcon china
Defcon 20-zulla-improving-web-vulnerability-scanning
Defcon 20-zulla-improving-web-vulnerability-scanning
MobSecCon 2015 - Burning Marshmallows
Jinx - Malware 2.0

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development

Hacking Vulnerable Websites to Bypass Firewalls

  • 1. "Running vulnerable code in local networks" || "how to get pwned by any website" 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1
  • 2. The web is broken! Insecure standards, protocols and plugins ● WebRTC ● Leaks real IP behind VPN ● Can scan the local network ● SVG ● Not always blocked in picture uploads ● Leads to stored XSS, various filter bypasses, could be used to bypass CSP nonces ● Flash ● Unofficial competition between Flash and Firefox who gets most CVEs for code execution ● Exploit kit coder's choice
  • 3. SOP is too permissive ● Cross Site History Manipulation (XSHM) ● Load images and scripts from any domain ● Frame all the web sites ● But X-Frame-options?! ■ Still leaks page loading times ■ In some cases window.open() also does the job ● Does NOT prevent making requests ONLY prevents receiving responses ● Cookies are sent by default
  • 4. Are authenticated cross-origin requests necessary? ● Sending cookies when including remote images? ● Sending cookies when submitting forms to another website? ● Necessary? Sometimes. ● Should it be the default behaviour? Please no! ● Sending cookies with GET requests? ● There's not really a way around it ● Would annoy users
  • 5. The Problem ● Users don't want to trade too much comfort for security ● It's up to developers to implement counter measures for those shortcomings ■ CSRF Tokens ■ Same-Site Cookies ■ Checks for Origin header (web sockets) ● Developers don't want to trade too much comfort for security ● SOP is the enemy ■ crossdomain.xml ■ postMessage ■ CORS ■ JSONP
  • 6. That's nothing new ● We know we should use strong passwords and 2FA ● We should implement every possible counter measure for permissive SOP and other browser "features" ● We should not run insecure code in production ● We need to update our software
  • 7. We all follow those guidelines Except when we don't well...
  • 8. Let me explain At what point do you consider your code as publicly accessible? ● While coding ● In your private repository ● In your testing environment ● In production ✔ ✔ X
  • 9. Wait what? ● My web server binds to 127.0.0.1! ● Other servers used for testing are behind a firewall! ● I am the only one who has access to my code! ● Windows Defender is up and running, so I don't even know why I watch this presentation!11
  • 10. You forget about your biggest attack surface To hack your local application attackers can use ● CSRF ● DNS rebinding ● XSHM and similar attacks ● Timing side channels
  • 11. Security guidelines Now tell me again, at every stage of your web app development: ● Use strong passwords / 2FA / authentication? ● Exploitable through DNS rebinding, XSHM, CSRF ● Protect against CSRF? ● Exploitable through - well - CSRF ■ Also XSHM ■ Doesn't matter for DNS rebinding anyway if it's unauthenticated / passwords are guessable ● Only run secure code? ● As hacker or security researcher? ■ Get another job. ● As a developer? ■ I have some small doubts here
  • 12. Hacking the dev? Why not the server? ● Developers are the more valuable target when ● They have a copy of production data or access to backups ● They have access to other internal systems ● Production server is secured ● Their private movie collection is big enough (Critical mass > 500 GB) ● There might be multiple sites the developer is responsible for ● The application is announced but not online yet (startups, new features in existing sites) ● There's a higher chance * to find buggy code in a development environment ● * Except if you develop the facebook messenger for android, chances should be equal then
  • 13. But I'm not a developer Good point. No testing environment, no vulnerable applications, right? ● Applications that run web apps on your computer ● Management interfaces ● websockets to exchange data between website and client ● Other devices in your network ● Your internet connected fidget spinner (or whatever monstrosity kickstarter creates next) ● NAS management interface ● One web interface almost every consumer has in the network ● Vulnerable home Router
  • 15. Well, this is bad "That was a lucky guess with the default password. And stuff like an SQL injection can't be abused just with CSRF while you are cross-domain." ● Completely right ● You can't read the response of a request ● You can't add data if it's a SELECT query ● OOB exfiltration is not possible without proper privileges ■ Conclusion: My data is safe! XXX WRONG ● Oh come on, this is starting to get annoying ● Just because it is annoying. If you assume anything regarding SOP it's most likely wrong ● What's the matter now? How can an attacker possibly abuse an SQL injection through the victim's browser even though there's SOP in place?
  • 16. We've talked about them before: iframes! Iframes can be used to extract data from an SQL injection ● Well, not only iframes, but also <img>, xhr and even the websocket API ● The problem? Leaking page loading times ● So what? ● SQL injection + delayed page loading time = ? ● Right. We can abuse blind SQL injections cross-domain! ● Seems like it's...
  • 18. Well, this is bad too But what are the alternatives? ● Running your code in a VM ● Separation, but not that practical ● Can still lead to compromise of host machine or other machines in the network ● Code can be modified ● Don't visit the internet while you code ● ● Your code might require an active internet connection
  • 19. Is there any way to be safe? DNS Rebinding ● Side Effect: ● New host header ■ Shared hosting not vulnerable (only the default host) ■ We can whitelist the original host header ● Is it preventable? ● Yes. Either on application or server level (preferred). ● If the host header doesn't match a whitelisted value -> 403. ● Works for apache, IIS, nginx
  • 20. Is there any way to be safe? CSRF ● Problem: ● There might be no authentication yet ■ Critical functions might be exposed for everyone ■ No CSRF protection added yet ● You audit vulnerable code without CSRF protection at all ● There is not an easy solution for this ● Using frameworks ● Starting with ■ CSRF protection ■ Authentication MEH
  • 21. Is there any way to be safe? (Experimental) Universal CSRF Protection in your environment? Conveniently possible for PHP apps ● First: Create a file with the following content:
  • 22. Is there any way to be safe? Halfway done ● Next: Add the file to the PHP.ini directive auto_prepend_file ● This will automatically include the file whenever any PHP file is parsed. This works in a similar fashion as PHP's require(). ● This means, whenever a web page is opened it will ● Load the PHP file ● Check if a cookie with the name "access" is set ■ If it's not, it will just throw an error, set the cookie and stop execution ■ If it is, the file does nothing and doesn't interfere with your code ● Since it's a same site cookie requests can only be made from the same domain
  • 23. Conclusion Don't rely on SOP doing the right thing ● Everything we talked about is preventable, countermeasures are just not always well known ● Developers and Security Researchers should keep in mind that their testing environments are publicly accessible to a certain degree ● Even the average user is at risk. Passwords for routers should be strong and unique like every other password ● SOP alone is not going to save you