bsides to 2016-penetration-testing

77
@haydnjohnson Penetration Testing I don’t think it means, what you think it means

Upload: haydn-johnson

Post on 15-Apr-2017

386 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Bsides to 2016-penetration-testing

@haydnjohnson

Penetration Testing

I don’t think it means,

what you think it

means

Page 2: Bsides to 2016-penetration-testing

@haydnjohnson

Whoami

Haydn Johnson -

Twitter: @haydnjohnsonFrom: Australia, Lives in TorontoTalks : http://www.slideshare.net/HaydnJohnsonCerts: OSCP | GXPN

Just shy of 4yrs Industry Experience

Page 3: Bsides to 2016-penetration-testing

@haydnjohnson

Penetration Testing

- I don’t think it

means, what you

think it means

Page 4: Bsides to 2016-penetration-testing

@haydnjohnson

Backstory

Multiple understandings of a VA

Multiple Understandings of a PT

Presented at BSidesLV - Automation of Pentesting

Page 5: Bsides to 2016-penetration-testing

@haydnjohnson

Many definitions

Penetration Testing is a term misusedabused Exploited

To the point where it is taken out back in the rain and given a 12-gauge to the head.

Page 6: Bsides to 2016-penetration-testing

@haydnjohnson

Automation of Pentesting - The Trend

Commoditization

Page 7: Bsides to 2016-penetration-testing

@haydnjohnson

Pentest Puppy Mills

� Scan� Scan� Scan� Report� Make report look nice� Make report look nicer� Remove on clients request� Send

Page 8: Bsides to 2016-penetration-testing

@haydnjohnson

The differences

Vulnerability Assessment List Oriented

Penetration TestingGoal Oriented

https://danielmiessler.com/study/vulnerability-assessment-penetration-test/

VULN A

VULN B

VULN C

Phishing

Local Admin

Dump Hashes

Domain Admin

Page 9: Bsides to 2016-penetration-testing

@haydnjohnson

Was I correct????

Let's delve deeper

Page 10: Bsides to 2016-penetration-testing

@haydnjohnson

Penetration Testing - The term

Means many things, or does it?

Are you sure?

Page 11: Bsides to 2016-penetration-testing

@haydnjohnson

But Burp is a penetration Test

It attempts sqli injection.. It penetrates…

It checks for XSS.. It penetrates

id=5 order by 1

Page 12: Bsides to 2016-penetration-testing

@haydnjohnson

NOT a Penetration Test

Page 13: Bsides to 2016-penetration-testing

@haydnjohnson

But Nessus / Nexpose is a Penetration Test

It checks if an exploit is there..

Some checks “do” exploit..

It penetrates

Page 14: Bsides to 2016-penetration-testing

@haydnjohnson

NOT a Penetration Test

Page 15: Bsides to 2016-penetration-testing

@haydnjohnson

Because the title says penetration test

Page 16: Bsides to 2016-penetration-testing

@haydnjohnson

So what is a penetration

test

Page 17: Bsides to 2016-penetration-testing

@haydnjohnson

But you still know it's a CAT err Penetration Test

Round Square

Page 18: Bsides to 2016-penetration-testing

@haydnjohnson

Where does one start

In order to understand what a Penetration Test is, we must look at some standards.

No really. A standard exists!

Page 19: Bsides to 2016-penetration-testing

@haydnjohnson

There are multiple standards

Best practices - just google!

Page 20: Bsides to 2016-penetration-testing

@haydnjohnson

Let us look at

The PTES standard What is in the standard Compare VA -> PT

first second third

� Will explain the key points� Compare with vulnerability assessment� Show example

Page 21: Bsides to 2016-penetration-testing

@haydnjohnson

Penetration Testing Execution Standard

Page 22: Bsides to 2016-penetration-testing

@haydnjohnson

Penetration Testing Execution Standard

By REAL infosec people:Chris NickersonDave KennedyCarlos PerezJohn StrandChris Gates

+ Many more

http://www.pentest-standard.org/index.php/FAQ

Page 23: Bsides to 2016-penetration-testing

@haydnjohnson

The Penetration Testing Execution Standard

Main Section

� Pre-engagement Interactions� Intelligence Gathering� Threat Modeling� Vulnerability Analysis� Exploitation� Post Exploitation� Reporting

http://www.pentest-standard.org/index.php/Main_Page

Page 24: Bsides to 2016-penetration-testing

@haydnjohnson

Goals of the standard

BusinessesThe goal is to enable them to demand a specific baseline of work as part of a pentest.

Service ProvidersThe goal is to provide a baseline for the kinds of activities needed.

Page 25: Bsides to 2016-penetration-testing

@haydnjohnson

“The standard is written for us….anyone and everyone who’s dealing with penetration testing. It is not about a specific product, or even a specific approach or methodology for testing.”

“It is designed so that when it is adhered to, the delivery will be well above a “minimal standard”.

http://www.iamit.org/blog/2016/09/ptes-remaining-impartial-and-insisting-on-high-standards/

Page 26: Bsides to 2016-penetration-testing

Pre-engagement

Time EstimationTied to experience of tester.

20% for padding

Scoping MeetingWhat will be tested

Customer owned?

Validate assumptions

General QuestionsNetwork Pentest

Web Pentest

Physical Pentest

Scope CreepWanting more covered

How to deal with

Specific IP ranges and DomainsIP blocks

Owned by client

Payment TermsUp front

Half way

End

Page 27: Bsides to 2016-penetration-testing

@haydnjohnson

Pre-engagement Interactions

Rules of engagement - what can and cannot be done Scope Testing ScheduleEscalation Procedures

Page 28: Bsides to 2016-penetration-testing

@haydnjohnson

Pre-engagement Interactions - Example

Pentest Form

NameContactsDatesIP Address

https://aws.amazon.com/security/penetration-testing/

Page 29: Bsides to 2016-penetration-testing

@haydnjohnson

Pre-engagement Interactions VA comparison

“I need the things scanned”Overall security postureWhat do I have out there?

Page 30: Bsides to 2016-penetration-testing

Intelligence Gathering

Level 1Compliance

Automated Tools

Level 2Best practice

Understanding of business

Physical location, org chart

Level 3State Sponsored

Heavy analysis,

Social Networks etc

What is itInformation gathering to be utilized to penetrate a target during vulnerability and exploitation phases.

More information, the better.

What it is notNothing found from on-premises

FootprintingScanning

IP blocks

Page 31: Bsides to 2016-penetration-testing

@haydnjohnson

Intelligence Gathering - key points

Dig - axfr

Finding informationHelp identify systemsUsed as base for further steps

Page 32: Bsides to 2016-penetration-testing

@haydnjohnson

Intelligence Gathering - Relationships

Business Partners

Customers

Manual Analysis to vet level 1

Shared office spaces

Shared infrastructure

Rented / Leased Equipment

1 2 3

Amazon

Reseller A

Shop B

Shop C

Page 33: Bsides to 2016-penetration-testing

@haydnjohnson

Intelligence Gathering - Example

DNS Servers

Page 34: Bsides to 2016-penetration-testing

@haydnjohnson

Intelligence Gathering VA comparison

Find hosts that are up and in scope…Scan

Page 35: Bsides to 2016-penetration-testing

Threat Modelling

High Level ProcessGather relevant documentation

Identify & Categorize Assets

Identify & Categorize threats

Map threats against assets

Business Asset AnalysisAsset centric viewAssets most likely to be targeted

Value of assets and impact of loss

Business Process AnalysisHow it makes money

Critical vs noncritical processes

How they can be made to lose money

Threat AgentsInternal / External

Community within location

Capabilities / Motivation

Motivation ModellingConstantly changing

Increase decrease

Threat CapabilityProbability of success

Technical and opportunity

Page 36: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - High Level

Gather relevant documentationIdentify and categorize primary and secondary assetsIdentify and categorize threats and threat communitiesMap threat communities against primary and secondary assets

Threat Modelling - High Level

Page 37: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - Business Asset Analysis

Identify assets that are most likely to be targetedOrganisational Data - how the organization does businessTrade secretsInfrastructure design

**Can feed other areas - intel?

Page 38: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - Business Process Analysis

How the company makes money Value chains - assets and processes

Page 39: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - Threat Agents / Community Analysis

Relevant threats - internal & external

Internal employees motivated by outsiders??

Page 40: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - Threat Capability analysis

What skills do they haveHow manyTechnical & Opportunity analysis

Exploits / Payloads

Page 41: Bsides to 2016-penetration-testing

@haydnjohnson

Page 42: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - Motivation

$$$$ Bored Activism

Page 43: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modeling - Key Points

Enables the tester to focus on delivering an engagement that closely emulates the tools, techniques, capabilities, accessibility and general profile of the attacker….

Tools | Techniques | Capabilities | Access

Page 44: Bsides to 2016-penetration-testing

@haydnjohnson

Threat Modelling - Example

Tofsee MalwareJavascript DownloaderPE32 executable into the %USERPROFILE% directory.SpamDelivered via RIG Exploit Kit

http://blog.talosintel.com/2016/09/tofsee-spam.htmlhttps://www.recordedfuture.com/threat-actor-types/

Page 45: Bsides to 2016-penetration-testing

@haydnjohnson

Threat modeling VA comparison

Internal or External

Page 46: Bsides to 2016-penetration-testing

Vulnerability Analysis

Discovering Flaws /TestingLeveraged by attackers

Host & service

Insecure design

RelevantCorrect level of depth

Expectations

Goals

PassiveHow it makes money

Meta Data Analysis

ActiveDirect Interaction

AutomatedManual

ResearchConstantly changing

Increase decrease

ValidationProbability of success

Technical and opportunity

Page 47: Bsides to 2016-penetration-testing

@haydnjohnson

Vulnerability Analysis - can include

Services | BannersMultiple exit nodesIDS evasion

Need to get to the target

Page 48: Bsides to 2016-penetration-testing

@haydnjohnson

Vulnerability Analysis - Example

Page 49: Bsides to 2016-penetration-testing

@haydnjohnson

Vulnerability Analysis VA comparison

Primarily focused on KNOWN vulnerabilities.Network / Business Logic Not assessed.

Whitelisted | Trusted

No Evasion Needed

Page 50: Bsides to 2016-penetration-testing

Exploitation

CountermeasuresEncoding

Process Injection

DEP | ASLR

EvasionPrevent detection

Physical

Network

Precision StrikeNot hail mary

Based on previous steps

Tailored ExploitsCustomize known exploit

Zero Day AngleLast resort

Fuzzing

Code Analysis

Page 51: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Objective

Least path of resistanceUndetectedMost impactCircumventing security controls

Page 52: Bsides to 2016-penetration-testing

@haydnjohnson

EASY ROAD

Page 53: Bsides to 2016-penetration-testing

@haydnjohnson

Hard Road

Page 54: Bsides to 2016-penetration-testing

@haydnjohnson

Biggest Impact

Page 55: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Countermeasures

Anti-virus needs to be evadedEncoding data to hide what is being doneHiding information through process injectionMemory protection such as DEP and ASLR

Page 56: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Precision

Previous steps usedBest vulnerabilities analyzed for exploitationMinimal disruptionsMethod to the madness

Page 57: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Zero Days

FuzzingBuffer OverFlowsSEH OverwritesRet2Libc

Page 58: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - IS NOT THE DIFFERENCE BETWEEN A VA & PT

Exploitation can be used in a VA or a PT.

Clients may want a high risk vulnerability proven.

Exploitation is highly used in a Penetration Test - but not the definition

https://danielmiessler.com/study/vulnerability-assessment-penetration-test/

Page 59: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Vulnerability Assessment

Validate a Vulnerability

REMOTE CODE EXECUTION A

Page 60: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Penetration Test

Part of the JobNetworkWebCredentials

Page 61: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - Example

https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/#jboss

Page 62: Bsides to 2016-penetration-testing

@haydnjohnson

Exploitation - VA comparison

SpecificLimitedProofNo post exploitation

Page 63: Bsides to 2016-penetration-testing

Post Exploitation

Rules of engagementProtecting Client

Protecting yourself

Infrastructure AnalysisRouting

Network Services

Neighbors

PillagingInstalled Programs | services

File/Printer Shares

Host configuration

Monitoring

Deep in targetIdentification of impact

Affect 1 system

Affect infrastructure

Persistence & PivotingBackdoors

Lateral Movement

Data ExfiltrationTesting

Measure controls and detection

Page 64: Bsides to 2016-penetration-testing

@haydnjohnson

Post Exploitation - think like the attacker

What is in the networkWhere is the Data - customer - financial - health - Credit CardWhere is the domain admin

Page 65: Bsides to 2016-penetration-testing

@haydnjohnson

Post Exploitation - think like the attacker

BackdoorsPersistenceData Exfiltration

Page 66: Bsides to 2016-penetration-testing

@haydnjohnson

Post Exploitation VA comparison

Exploitation proves the vulnerability can be exploited

This does not show the business impact.

Not “how deep, real impact”

Page 67: Bsides to 2016-penetration-testing

@haydnjohnson

Post Exploitation - Example

http://www.slideshare.net/HaydnJohnson/power-sploit-persistence-walkthrough

Page 68: Bsides to 2016-penetration-testing

Reporting

Exec SummaryGoals of Pentest

High Level Findings

Background

Overall posture

C-Level | management

Systemic issues

Technical ReportIntroduction

Information Gathering

Vulnerability Assessment

Exploitation / Vuln Confirmation

Post Exploitation

Risk Exposure

Conclusion

Page 69: Bsides to 2016-penetration-testing

@haydnjohnson

Reporting - Exec Summary

High level Background Key pointsKey impact and ratingsRecommendationsStrategic Road map

Similar to VA - But shows real impact not just Vulns

Page 70: Bsides to 2016-penetration-testing

@haydnjohnson

Reporting - Technical Report

Deep Explanation of each stageStep by step of process / exploitationStep by step of Post exploitation

Similar to VA - But shows much more than a list of vulns

Page 71: Bsides to 2016-penetration-testing

@haydnjohnson

Reporting - Vulnerability Analysis

Exec Summary

List of VULNERABILITIES

Ratings & Prioritization

Attack COULD exploit

Page 72: Bsides to 2016-penetration-testing

@haydnjohnson

Reporting - Example

https://www.offensive-security.com/reports/sample-penetration-testing-report.pdf

Page 73: Bsides to 2016-penetration-testing

@haydnjohnson

In Summary - VA

Page 74: Bsides to 2016-penetration-testing

@haydnjohnson

In Summary - Exploitation

Page 75: Bsides to 2016-penetration-testing

@haydnjohnson

In Summary - Penetration test

Page 76: Bsides to 2016-penetration-testing

@haydnjohnson

Thank you!

Questions?Debate?