Cloud Penetration Testing Playbook
Cloud Penetration Testing Playbook
www.ministryofsecurity.co
Follow ministryofsecurity for more such infosec
content.
Cloud Penetration
Testing Playbook
The permanent and official location for Cloud Security Alliance Top Threats research is
https://cloudsecurityalliance.org/working-groups/top-threats/#_overview
© 2019 Cloud Security Alliance – All Rights Reserved. You may download, store, display on your comput-
er, view, print, and link to the Cloud Security Alliance at https://cloudsecurityalliance.org subject to the
following: (a) the draft may be used solely for your personal, informational, non-commercial use; (b) the
draft may not be modified or altered in any way; (c) the draft may not be redistributed; and (d) the trade-
mark, copyright or other notices may not be removed. You may quote portions of the draft as permitted
by the Fair Use provisions of the United States Copyright Act, provided that you attribute the portions to
the Cloud Security Alliance.
Alexander Getsin
Contributors
Asaf Hecht
Michael Roza
Jon-Michael Brook
Shlomi Ohayon
Chris Farris
Scott Piper
Greg Jensen
Victor Chin
Victor Chin
Special Acknowledgement
The CSA Top Threats Working Group would like to thank CyberInt for their support in the development
of this document.
Introduction........................................................................................................................... 5
Target Audience....................................................................................................... 5
Scope of this Document....................................................................................................... 6
Cloud Penetration Testing Scope........................................................................................ 6
Cloud Penetration Testing in Context................................................................................ 9
Cloud Penetration Testing Objectives..............................................................................10
Cloud Penetration Test Cases and Concerns..................................................................11
Preparation.............................................................................................................11
Threat Modelling....................................................................................................11
Reconnaissance and Research.............................................................................12
Testing.....................................................................................................................13
Report......................................................................................................................16
Legal.....................................................................................................................................16
Training and Resources......................................................................................................17
Conclusions.........................................................................................................................18
References...........................................................................................................................19
Traditionally, the primary objective of penetration testing is to identify technical security weaknesses
and systems resilience. However, a broader application of security testing also serves to assess an
organization’s implementation of security policy, compliance requirements, the effectiveness of employees’
security awareness and ability to identify and respond to security incidents3. Hence, penetration testing
is essential to any holistic cyber defense effort as it provides visibility into system security, its assurance
(or lack thereof), and produces highly actionable mitigations to drive the security of the systems and
environments involved.
As cloud services continue to enable new technologies, see massive adoption and become foundational
for many businesses, there is a need to extend the scope of penetration testing into public cloud
systems and components.
The process described here aims to provide the foundation for a public cloud penetration testing
methodology and is designed for current and future technologies that are hosted on public cloud
environments or services. In particular, this document focuses on penetration testing of applications and
services hosted in the cloud. It addresses the methodological and knowledge gaps in security testing of
information systems and applications in public cloud environments.
Target Audience
The target audience of this document are penetration testers and cloud / cloud-based systems
security practitioners. However, the first few pages will provide CIOs, CISOs and Senior Management
an understanding of what cloud penetration testing is, its scope, its context, its objectives and how it
fits within a cybersecurity strategy. Developers and Architects will also find this document useful while
designing secure (public cloud based) systems.
• Raise awareness of the importance and methods of cloud penetration testing in a cybersecurity
strategy
1
https://nvd.nist.gov/800-53/Rev4/control/CA-8#Rev4Statements
2
https://www.enisa.europa.eu/topics/csirts-in-europe/glossary/vulnerabilities-and-exploits
3
https://www.fedramp.gov/assets/resources/documents/CSP_Penetration_Test_Guidance.pdf
Subject matter scope – guidance on how to test cloud implementation of applications and
systems is provided, but is not provided on testing the application itself. That’s what OWASP
(Open Web Application Security Project) would be for, for example.
Existing testing and assurance frameworks – while testing program and delivery phases,
as well as some test cases not unique to the cloud, are outlined within, this is done purely
for context and due diligence and are NOT comprehensive. The cloud-unique test cases and
considerations are meant to complement existing frameworks by allowing ease of adoption
and integration.
This resource also provides reflection and insights on scoping and legal aspects of public cloud security
testing and training opportunities and resources.
Security controls that fall under the complete responsibility of the Cloud Service Provider (CSP) are
usually not within the scope of a penetration test that is commissioned by the cloud consumer. For
example, in a Software as a Service (SaaS) environment, it is within the penetration tester’s scope of
authority to exploit excessive permissions given to a particular user to conduct business level attacks
(i.e. approve expenditure). However, the tester should not test the implementation of access control
(session validation) or the SaaS application input filtering (i.e. SQL injection) in the SaaS application. This
is because the test involves compromising underlying infrastructure that is out of the scope of authority
of the recipient of the penetration test. Therefore, underlying infrastructure is normally not part of the
scope of a penetration test unless explicit permission from the CSP is given.
Security in the cloud is tested, not security of the cloud. For example, in an IaaS environment, as per
Fig 1, User Access/Identity, Data, Application, and Operating System layers are in-scope. All other
components below the red line are under the control and management of the CSP and are, thus, out
of scope. The same logic applies to PaaS and SaaS environments with the scope of the penetration test
dependent on the service model. The degree of testing and the scope of testing depends on the various
services provided by the cloud service provider(s). Nevertheless, the accidental discovery of any flaws
and vulnerabilities of the cloud service should still be reported.
The scope for testing and application of test cases also differs from service model to service model
(Fig 1). In an SaaS application, a relatively small scope exists: data and user access/identity controls. In
PaaS, the application layer (and some platform configuration) is in scope; all layers lower are excluded.
The same principle is applicable to IaaS; the client responsibility is expanded and so does the scope of
potential security testing. Implementing or moving a workload to the cloud changes the scope for potential
security tests (and breaches!). Additional scope for testing is introduced (e.g. the cloud management
plane), but some is still offloaded to the CSP (virtualization, hardware, and sometimes OS).
Although client-side application testing would be included in IaaS and PaaS testing, this document
does not detail testing of the application layer (e.g. SQL injection, XSS vulnerabilities) and the OS layer
(e.g. virtual machines) as that has been sufficiently covered by OWASP and other resources. Thus, this
document is concerned only with the following domains:
• Account security as it relates to user identity and access (e.g. Identity and Access management,
logging, account level hardening practices, Cloud Federation and Single Sign-On interface and more)
• Cloud service security as it relates to data structures and cloud infrastructure that can be configured
by the cloud customer (e.g. s3 bucket policies, vpc network access restrictions, risky cloud formation
templates and on)
• Application / business logic that is under the control of the end user (e.g. Application and design flaws,
business logic flaws, code scripting flaws, data loss prevention, etc.)
The scoping of a penetration test can and should consider all three domains, even if any are excluded
from the scope of a penetration test as the three domains can substantially impact each other.
For example:
• a misconfigured account user (neglect to formulate restricted role based access controls) can
and will contribute to the severity and likelihood of an application breach
• an application in AWS could be badly designed, implemented or configured with high cloud
privileges (e.g. Assume/Pass Role Cloud Administrator), the breach of which is considered a
complete compromise.
• neglecting account level service use and billing thresholds and controls could make the
application highly vulnerable to DOS, resource starvation or billing abuse.
The Microsoft Secure Development Lifecycle places Security Testing in the Verification Phase, including
Dynamic Testing and verification of threat model/attack surface.
Assurance Program
Penetration testing can also be – and often is – carried out as part of a security program. CREST
advocates their best practice Penetration Testing Programme -
A A
A Preparation
Preparation
Preparation
Penetration
Penetration
Penetration
Testing
Testing
Testing
B B Testing
Testing
Testing
Programme
Programme
Programme C
C Follow
Followup
up
C Follow up
The CREST program aims to assist with effectively managing penetration testing carried out in or
delivered for a consumer organization. It outlines the steps and good practices for utilizing to greatest
benefit a good penetration testing service. As such, there would appear to be some ‘duplicate scope’;
however, it must be said that the preparation phase for a recipient of a penetration test is different
from the preparation phase of the security service provider (i.e. organization providing penetration
testing services). The methodology described in this document is written from the perspective of
the security service provider. This perspective aligns with and meets some ‘client’/’recipient’ program
requirements, such as the testing phase, in particular the need to ‘use an effective testing methodology’.
The cloud penetration testing playbook is adapted from CREST Preparation (Part 3) and Testing (Part
4) and suggests five main phases. They are Preparation, Threat Modelling, Reconnaissance and Research,
Testing and Report Writing. This document details the unique cloud security test cases and considerations
in each of these phases.
It is important to remember that the test cases below consider only unique, cloud-inherited test cases
and flaws. The cloud is a canvas with many possible deployments and uses (e.g. workload, storage or
container). Depending on what is being hosted and its implementation, the resulting vulnerability or
security weakness will differ. Naturally, such components will require their own testing guidelines.
The model we choose to guide the offensive and defensive efforts by priming exploration of what can go
wrong is STRIDE, a threat model developed at Microsoft for identifying computer security threats. We
have decided to group suggested test cases by the STRIDE model since the terminology and format are
widely known and used.
1. Preparation
a. Sign off on the Non-Disclosure, Liability and Testing Agreements with the Client
b. Define and agree on the purpose and scope of the penetration test
i. Identify testing constraints
ii. Identify targets and environments in scope
1. Is the cloud account in scope?
2. Are cloud Supply Chain services and partners in scope?
3. How are various tenants considered in the scope? Are they excluded? Are they
purposefully targeted? What is considered a separate tenant?
4. Have the CSPs pentesting approval/constraints been considered?
5. A detailed assessment of the Attack vectors and Risks in Public Cloud are understood
c. Establish cloud penetration testing approval per Cloud Service Provider and the client, per the
appropriate (and often public) security testing procedure
d. Produce/Receive requirements specification
i. Consider cloud compliance, guidance and frameworks (CSA CCM for example)
e. Tailor, agree and sign off on the penetration testing tools, tactics and procedures (TTP), as well
as the methodology
i. Non-cloud TTPs like OWASP Application testing guide
ii. Cloud reconnaissance, phishing, account hijacking / password reset TTPs
iii. Cloud audit tools for identification of best post-exploitation - Azurite, ScoutSuite
iv. Acceptable and minimum test cases for spoofing, tampering, repudiation, information
disclosure, denial of service and elevation of privilege
v. Acceptable action on objectives, constitutes and evidence to prove success of testing and
meeting objectives
vi. Implement management control and operation processes
vii. Appoint points of contact
viii. Submit and manage change requests
ix. Resolve testing operational issues
x. Isolating, restricting and resolve system impact from testing
2. Threat Modelling
5. Report
LEGAL
Penetration testing needs to comply with all applicable local and national laws. A formal, written and signed
client authorization should be obtained before any penetration testing services are rendered.
• Amazon Web Services no longer mandates a testing permit issued by them. However, there are
still several constraints which are mentioned here.
• Tests that may impact European citizens’ personal Identifiable information (PII) must consider
that any such data must be handled per the GDPR guidelines (anonymizing, safely handling in
transit, breach reporting). That may often be overlooked since the GDPR mandates such testing
in the first place.
We advocate the study of CSA Security Guidance for Critical Areas of Focus in Cloud Computing. In
addition, the following resources might also be useful.
Few offensive cloud security hands-on training opportunities are available outside of setting your own or
on the job experience; however, the following are advisable:
• FLAWS - challenges you to learn by moving through a series of levels, about common mistakes
and “gotchas” when using AWS.
• CloudGoat Rhino Security Labs’ “Vulnerable by Design” AWS infrastructure setup tool
Tools
Many open tools for assessing and testing security of and within cloud environments are available. A few
honorable mentions include
• NCC Groups open source cloud auditing tools (ScoutSuite and more) - a multi cloud auditing suite
• LazyS3 - a tool for enumerating AWS s3 buckets
• CloudBurst - a collection of tools inclusive to enumeration of (Azure) services, data stores,
credentials harvesting and more
• Nimbusland - a tool for resolving cloud IP address spaces
• pacu - a post exploitation AWS toolkit
• Shodan - the search engine for Internet-connected devices can assist with identification, research
into and reconnaissance of public cloud-based systems and assets.
A more comprehensive register of open cloud security tools is available at ToniBlyx - link.