Definitive Guide To Penetration Testing
Definitive Guide To Penetration Testing
PENETRATION
TESTING
Chapter 1
Getting To Know Penetration Testing
Penetration testing will reveal vulnerabilities that otherwise would not be discovered through other
means such a vulnerability scan. The manual, human analysis means that false positives are filtered out.
Furthermore, it demonstrates what access can be gained, as well as what data may be obtained through
attempting to exploit vulnerabilities discovered in the way that a real world attacker would. This effectively
demonstrates the real risk of a successful exploitation given each vulnerability used to gain access.
Chapter 1
Getting To Know Penetration Testing
Penetration Testing will also test an organisations cyber defences. It can deployed to test the effectiveness
of web applications firewalls (WAF), intrusion detection systems (IDS), and Intrusion prevention systems
(IPS). When a penetration test is underway, these systems should automatically generate alerts and trigger
off the organisations internal procedures resulting in a response from internal security operations teams.
Reference:
https://securitycafe.ro/2015/01/05/penetration-testing-benefits/
Penetration Testing enables organisations to meet regulatory compliance requirements such as PCI-DSS,
and also addresses ISO 27001 control objective A12.6.
References:
https://www.pcisecuritystandards.org/documents/Penetration_Testing_Guidance_March_2015.pdf
http://www.itgovernance.co.uk/iso27001_pen_testing.aspx
Finally penetration testing provides an expert opinion from an independent third party outside of the
target organisation. This can help internal security teams influence management decisions in their favour
and obtain more budget for security enhancements.
Chapter 1
Getting To Know Penetration Testing
To ensure the effectiveness of current controls and how they are implemented and configured.
To examine the effects of multiple vulnerabilities and how they can be chained together.
To assess the effectiveness of an application’s input validation controls. Where ever user input is
entered, rigorous fuzz testing is performed to make sure that it only sanitized input is accepted.
To improve security response time. A penetration test can be used to identify how different teams
respond to an intrusion and improve internal incident response processes and procedures.
Penetration Testing and Vulnerability Assessments should both be part of an organisation’s security
program.
Following is a summary of each type of penetration test which all follow different methodologies and
utilize different frameworks.
Web Application Penetration Test. These tests focus on the various vulnerabilities found in web
application components; including frameworks, server software, API’s, forms, and anywhere where user
input is accepted.
Mobile Application Penetration Test. A mobile penetration test focuses on trying to exploit how a mobile
application accepts user input, how securely it is stored on the phone, how securely data is transmitted
across the internet, as well as all the web service vulnerabilities which may be present in the API.
External Infrastructure Test. Checks for ports open on all externally facing ranges, attempts are made to
fingerprint and exploit services discovered as well as bypass authentication mechanisms and brute force
VPN gateways.
Internal Infrastructure Penetration Test. This will be an attempt to get full system administrator privileges
from within the internal network. Checks are done to search for vulnerable services and software, and
exploits are used to obtain access. Network traffic is normally sniffed whilst ARP poisoning is executed in
order to capture credentials and other sensitive traffic in transit.
Wireless Penetration Testing. At a high level, this involves attempts to crack WEP and WPA encryption in
order to obtain access. Other attacks such as Man in the middle (MitM) attacks are attempted, as well as
tricking wireless clients into connecting to a dummy access point.
End point / Kiosk PC Penetration Test. These penetration tests attempt to break out of a kiosk PC or other
locked down device and gain elevated privileges or access to sensitive data that should otherwise not be
accessible.
Chapter 2
Penetration Testing Prerequisites
Review Past Threats and Vulnerabilities. Although It is generally good practice to perform a review on
what was previously discovered in a penetration test, it is also mandatory as part of PCI requirement 11.3.
This review allows you to specifically focus on things that were identified previously and make sure those
same issues have either been remediated or not arisen again.
Get Authorization. The actions performed during a penetration test would normally be considered illegal
without prior authorization. This can land you in some legal hot water unless you have your “Get Out of Jail
Free” paperwork signed off. A good template to use as an example is here:
http://www.counterhack.net/permission_memo.html
Chapter 2
Penetration Testing Prerequisites
Agree on Timing. There may be certain times in an organisation where the risk of interference or downtime
is considered a higher consequence; such as periods of high utilization or when project implementations
and upgrades are taking place. Because of this, make sure you agree on an acceptable time window to
perform the penetration test.
Whitelist Source IPs. The target organisation of a penetration test should be notified of the source IPs
from where you will be performing the test from. There are a number of reasons for this, but in order to
properly perform a penetration test without interference from a WAF or an IPS, you should request that
your source IPs are whitelisted on such appliances.
Confirm internal contacts available. It’s important that you agree on a communication plan and on who
your internal contacts will be within the organisation to be available during the penetration test. This is not
only so you can get them to support you during the testing process, but it’s also a good idea to notify the
target organisation immediately if a vulnerability is discovered that you deem to be ‘Critical”.
Reference:
https://www.pcisecuritystandards.org/documents/Penetration_Testing_Guidance_March_2015.pdf
There are a large suite of penetration testing tools which you may utilize within your arsenal depending on
what you are testing. This topic is too big to detail every tool for every type of test. Most of these tools
ship with Kali Linux which is considered the penetration tester’s Linux distribution. However, the following
are are tools you should get to know well:
Chapter 2
Penetration Testing Prerequisites
Bash. Learning the bash shell and how to script with associated linux
command line tools during a penetration test is essential. You should
be able to quickly put together custom scripts to filter and format
data for presentation or input into another tool.
Google is where you will find open source information that will
prove interesting during a penetration test, such as the discovery of
potentially sensitive documents that shouldn’t be publicly searchable.
Johnny Long wrote an excellent book on this topic. There is also a
Google Hacking Database (GHDB):
https://www.exploit-db.com/google-hacking-database/
Chapter 3
Executing Penetration Testing
https://www.pcisecuritystandards.org/documents/Penetration_Testing_Guidance_March_2015.pdf
It is important to follow an industry methodology as a baseline. You can then build your own processes
and procedures for testing on top of that.
OWASP testing guide - Contains a best practice framework and set of tests to perform when conducting a
web application penetration test.
https://www.owasp.org/images/1/19/OTGv4.pdf
Chapter 3
Executing Penetration Testing
PCI Penetration testing guide - Provides guidance for conducting penetration tests under PCI requirement
11.3.
https://www.pcisecuritystandards.org/documents/information_supplement_11.3.pdf
Penetration Testing Execution Standard - A standard put together by a bunch of InfoSec professionals
with the goal of developing a common framework for penetration tests.
http://www.pentest-standard.org/
NIST 800-115 - A high level technical guide for conducting information security tests and security
assessments.
http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-115.pdf
Penetration Testing Framework - Is a free penetration testing framework and walkthrough covering vari-
ous phases of penetration testing in detail.
http://www.pen-tests.com/penetration-testing-framework.html
Information Systems Security Assessment Framework (ISSAF) - An excellent reference for penetration
testing which covers everything from project management to testing.
https://sourceforge.net/projects/isstf/
Open Source Security Testing Methodology Manual (“OSSTMM”) - A penetration testing methodology
security testing, security analysis, and security metrics, among other things.
Make sure you do everything as discussed and set out within the agreed scope.
Make sure you do get authorization signed off to perform the penetration test.
Do not ever perform a penetration test without prior approval.
Do not perform testing outside of the agreed scope of the test.
Chapter 3
Executing Penetration Testing
This should have already been done by the penetration tester. The final report should contain details and
steps with screenshots showing exactly how certain vulnerabilities were exploited. Thus there should be no
false positives in the report.
Penetration should be done as part of any secure software development lifecycle, alongside a source code
review and secure development standards. It should be performed prior to going live, as well as after going
live. Following that, it should be performed periodically on any digital system.
PCI requirement 11.3 requires that penetration testing is performed at least annually and after any signifi-
cant change.
Chapter 4
Post Penetration Testing Questions
At least one re-test should be offered by the penetration tester as part of an engagement. The client
should request that a re-test is performed as soon as they have completed remediation tasks. The re-test
will test for the vulnerabilities discovered in the initial test in order to validate whether they have been
successfully remediated.
Chapter 5
Qualifications of Penetration Testers and
the Cost of the Service
CREST Registered Penetration Tester (CRT-Pen) - We don’t believe this one holds too much weight
from a technical point of view in comparison to the others but is gaining popularity as a compliance like
certification.
The PCI Security Standards Council also lists these certifications as indications of skill level and compe-
tence. https://www.pcisecuritystandards.org/documents/Penetration_Testing_Guidance_March_2015.pdf
Penetration testing is a niche skill which takes a lot of hands on experience to develop. Not only does it
require an exceptional attention to detail, but an excellent ability to write high quality technical reports as
the report is the deliverable of the engagement.
Chapter 5
Qualifications of Penetration Testers and
the Cost of the Service
This varies depending on the type of engagement, scope, and size of what needs to be tested. As such it is
best to get quoted accurately. Factors such as complexity of the environment, methodology, experience
and qualifications of the penetration tester, whether the test is performed onsite, and what re-test work is
required are all things which will affect cost.