cloud post exploitation - immunity inc...cloud post exploitation. ways 2 azure overview cloud pivots...

27
Andrew Johnson @secprez | Sacha Faust @sachafaust | Cloud & Enterprise Red Team CLOUD POST EXPLOITATION

Upload: others

Post on 05-Feb-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Andrew Johnson @secprez | Sacha Faust @sachafaust | Cloud & Enterprise Red Team

CLOUDPOST EXPLOITATION

Page 2: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Key

Take

Aw

ays

2

Azure Overview

Cloud Pivots

Trends and Countermeasures

Page 3: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

C+

E R

ed

Team • Red Team Success

MTTC + MTTO

MTTD + MTTR

• Clear rules of engagement

• P0 focus – break glass scenarios

• Cloud vs Cloud

• Shift from Operation to Recovery Games

Culture – Collective Growth Mindset• “Let’s make it harder!”• Engineering Focused• Diplomatic• Operate like Next Generation APT™

3

Crawl

Walk

Run AdaptAdapt+

Page 4: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Azure Crash Course

Page 5: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Domain ControllerSQL ServerFile Server

ApplicationServer

Internet

Network ACL, Ingress & Egress

Monitoring

Private Network

Production Domain

Azure VM (IAAS)

Azure Storage

SQL Azure

Azure Analytics(Logging)Azure VNET

VM VM Azure Redis Cache

Azure PAAS

Service

Azure Document DB

AzureKey Vault

5

Page 6: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Server

Domain

Domain Admin

Pass the Hash

Private IPs

RDP / SSH

Services

Subscription

Subscription Admin

Credential Pivot

Public IPs

Management APIs

Clo

ud

Min

dse

t

6

Page 7: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Pivoting

Page 8: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Basi

c -

Sto

rag

e t

o V

M Option 1 – Exfil running VMShadow copy VMStart-AzureStorageBlobCopy

Option 2 –override VM when turned off

Research Area – Tamper running VM

8

Page 9: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Attacking Hosted Services - PAAS

• Hosted Services are created from three elements:• Certificates hosting in the cloud service

• A configuration file containing secrets and other service metadata

• A package containing the code and resources

Hosted Service

Certificates

Configuration (cscfg)

Package (cspkg)

PAA

S 1

01

9

Page 10: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

RD

P E

xtensi

on Step 1 – Get role configuration

Get-AzureDeployment

Step 2 – Create ExtensionNew-AzureServiceRemoteDesktopExtensionConfig

Step 4 – Remove when doneRemove-PAASRemoteAccessExtension

Step 3 – Push tampered packageSet-AzureDeployment

Remote Desktop

10

Page 11: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Pla

tfo

rm A

s a S

erv

ice (

PAA

S)

11

Page 12: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

PAA

S C

ert

ific

ate

s Step 1 – Query management API to get Certificates availableGet-AzureDeployment

Step 2 – Create custom service package• Add target certificate thumbprint• Make service dump certs from OS

and exfil

Step 3 – Initiate deploymentSet-AzureDeployment with Use upgrade flag to staging slot

Step 4 – Wait for cert and pivot

12

Page 13: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

PAA

S U

pg

rad

e Step 1 - Exfiltrate cspkg fileGet PackageGet-AzureBlobContent

Step 2 – Find/Create elevated task and bootstrap malware

Step 3 – Update file hash

Step 4 – Push tampered packageSet-AzureBlobContent

Step 5 – Initiate deploymentSet-AzureDeployment with Use upgrade flag

13

Page 14: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Hyb

rid

Piv

ot

On Premise toCloud Pivot!

14

Page 15: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Persistence

Page 16: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

• Service Principals support multiple passwords

• App provides rich landscapeIdentity

• Subscription administrators

• Management CertificatesSubscription

• Storage Account Key

• Secure Access Url (SAS) key (offline minting)

Storage Account

• Tamper DeploymentCloud Service

• OS persistence

• Override

• Shadow copy

Virtual Machine

• Add resource to resource group (VM)

• Modify Network Security GroupNetwork

Pers

iste

nce

-Pyr

am

id

17

Page 17: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •
Page 18: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

As an operator/attacker, do

you have enough visibility in

the risks you are accepting?

Indicators of

• Monitoring (IOM)

• Detection (IOD)

• Recovery (IOR)

Page 19: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

IOM

/D T

rend

s Rise of Anomaly Detection

Azure Security Center

Azure Security Center

Anomaly Detection API – Cortana Intelligence Galleryhttps://aka.ms/infiltrate2017-anomalyapi

“Anomaly Detection is an API built with Azure Machine Learning that is useful for detecting different types of anomalous patterns in your time series data”

20

Page 20: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

IOM

/D T

rend

s Purple Teaming – https://aka.ms/scalingredteam

21

Page 21: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

IOM

/D T

rend

s The commoditization of Threat Intel

Azure Security Center

22

Page 22: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

IOM

/D T

rend

s “Stealth” features in Defense

VHD

Azure Storage

VM

DATA PLANE

Forensic @ScaleOff-Node Analysis

VHDVHD

VHDVHD

VHDVHD

CONTROL PLANE

23

Page 23: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Trend

s –

Eng

ineering

• Monoculture • Shift from cost center to

profit• Used to scale - system

engineering and data scientist

• Used to very high expectation – Azure 99.9%

https://www.youtube.com/watch?v=R31Ez1XJEeI

Page 24: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Trend

s –

Eng

ineering

Assume Breach mindset

Page 25: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Co

unte

r M

easu

res

26

Specific/sequential targeting

Effective reconnaissance

Practiced tool usage

Sophisticated planning

Social engineering

Advanced & persistent

Infiltrate 2015 - Data Driven Offence https://vimeo.com/133292422

Diversionary TacticsMachine Learning

Varied PersistenceIntelligence Driven

Multi-Front Assaults

Page 26: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Co

unte

r M

easu

res

27

Page 27: CLOUD POST EXPLOITATION - Immunity Inc...CLOUD POST EXPLOITATION. ways 2 Azure Overview Cloud Pivots Trends and Countermeasures. eam • Red Team Success MTTC + MTTO MTTD + MTTR •

Thank you

Sacha Faust

@sachafaust

Andrew Johnson

@secprez

https://aka.ms/cesecurityjobsse