SAP Penetration Test Framework
SAP Penetration Test Framework
SAP Penetration Test Framework
insecurity, sap vulnerabilities, sap vulnerability, sap defense, hardening sap, sap hardening, protecting sap
Who is CYBSEC ?
Provides Information Security services since 1996.
More than 300 customers, located in LatinAmerica, USA and Europe.
Wide range of services: Strategic Management, Operation Management,
Control Management, Incident Management, PCI Services, SAP Security.
2
© 2008
Who am I?
Senior Security Researcher at CYBSEC.
Devoted to Penetration Testing and Vulnerability Research.
Discovered vulnerabilities in Microsoft, Oracle, SAP, Watchfire, …
Speaker/Trainer at Blackhat, Sec-T, Hack.lu, DeepSec, Ekoparty, CIBSI, …
SAP & Me
Started researching in 2005.
SAP Pentesting projects (customers).
Discovered more than 40 vulnerabilities in SAP software.
Published “Attacking the Giants: Exploiting SAP Internals”.
Developed sapyto, the first SAP Penetration Testing Framework.
CYBSEC’s “SAP (In)Security ” Training instructor.
3
Agenda
© 2008
Agenda
Introduction to the SAP World
Why SAP Penetration Testing?
PenTest Setup
SAP PenTesting
Discovery Phase
Exploration Phase
Vulnerability Assessment Phase
Exploitation Phase
Case Study: SAProuter Security Assessment
Conclusions
4
© 2008
Introduction to
the SAP World
Basic concepts for deep knowledge
5
Introduction to the SAP World
© 2008
So…
So… what is SAP?
SAP (Systems, Applications and Products in Data Processing) is a
german company devoted to the development of business solutions.
More than 41.600 customers in more than 120 countries.
More than 121.000 SAP implementations around the globe.
Third biggest independent software vendor (ISV).
7
Introduction to the SAP World
© 2008
Transaction
Related secuence of steps (dialog steps) aimed to perform an
operation in the SAP database.
Identified by a transaction code (ej: SU01, SE16, FK01, PA20,…)
8
Introduction to the SAP World
© 2008
Reports / Programs
ABAP programs that receive user input and produce a report in
the form of an interactive list.
Function Modules
Independent ABAP modules. Can be called locally or remotely.
Some “Low-
Low-level”
level” Knowledge
SAP_ALL profile = SAP God.
Many other profiles may enable a user become a god too.
Each SAP System uses its own Database.
SAP processes run under the <sid>adm or SAPService<SID> user
accounts.
Connections to the Database are done with the same UID. No
authorization at this level…
Direct access to the Database means full SAP compromise!
Connections between systems often based on Trust Relationships
(r* services).
Many customer’s interfaces are implemented through FTP (cleartext,
usually weak passwords).
11
© 2008
Why SAP
Penetration Testing?
Or why You and your CFO should care
12
Why SAP Penetration Testing? © 2008
13
Why SAP Penetration Testing? © 2008
14
Why SAP Penetration Testing? © 2008
15
Why SAP Penetration Testing? © 2008
16
Why SAP Penetration Testing? © 2008
17
Why SAP Penetration Testing? © 2008
18
Why SAP Penetration Testing? © 2008
19
Why SAP Penetration Testing?
© 2008
Alert
Security guy’
guy’s Mistake:
Mistake:
Alert
It will help you discover the weaknesses, secure them, and increase
the security level of your systems (a.k.a decrease fraud risk).
In this talk, we’ll see some of the activities that make up the different
phases of an SAP Penetration Testing (no way of covering them all). 21
© 2008
PenTest Setup
Before we begin …
22
PenTest Setup
© 2008
Preparation
What do you need? The Shopping List
sapyto SMB client & security tools
nmap BurpSuite / w3af
r* tools (rsh, rlogin, rexec) Nessus
SQL client tools john (patched)
NFS client tools hydra
Remember that everthing that breaks while you are pentesting *will*
be your fault (even if someone breaks his leg).
23
sapyto © 2008
sapyto
24
sapyto © 2008
Tools:
RFC Password Obfuscator / De-obfuscator.
25
sapyto © 2008
Hot News!
News! sapyto v0.98
Core and architecture fully re-built.
Based on connectors.
The SAPRFC* connectors and the RFCSDK.
Plugins are now categorized in Discovery, Audit and Exploit.
Discovery plugins find new targets.
Audit plugins carry out the vulnerability assessments.
Exploit plugins are used as proof of concepts for discovered vulns.
sapytoAgents deployment.
New plugins for auditing SAProuters, find clients, bruteforcing, …
26
© 2008
Discovery Phase
Finding SAP targets
27
Discovery Phase
© 2008
Exploration Phase
Getting as much information as possible
29
Exploration Phase
© 2008
getClients(target#0) {
Client 000 is available.
Client 001 is available.
Client 066 is available.
Client 101 is available.
Client 200 is available.
} res: Ok 32
Exploration Phase
© 2008
$ showmount –e sapserver
/export/usr/sap/trans (everyone)
/export/sapmnt/NP1 (everyone)
/export/informix/NP1 (everyone)
/export/interfacesNP1 (everyone)
/export/interfsrcNP1 (everyone)
33
Exploration Phase
© 2008
34
© 2008
Vulnerability
Assesment Phase
Analyzing the discovered components
35
Vulnerability Assessment Phase
© 2008
36
Vulnerability Assessment Phase
© 2008
37
Vulnerability Assessment Phase
© 2008
Exploitation Phase
Getting access and beyond
42
Exploitation Phase
© 2008
But…
But… why do we need Exploitation anyway?
Vulnerability Assessments reports enumerate discovered vulnerabilities
with the associated risk estimate.
A security aware individual would easily see the problems.
But, what about the people from the Financial areas?
For them to get involved, they need to see the facts! You must show
them how “their” information can be compromised -> screenshots, live-
demos…
43
Exploitation Phase
© 2008
On June 26 2008, a patch for John The Ripper for CODVN B and F was
published. 44
Exploitation Phase
© 2008
On June 26, a patch for John The Ripper for CODVN B and F was
published. 45
Exploitation Phase
© 2008
46
Exploitation Phase © 2008
47
Exploitation Phase © 2008
tcp.validnode_checking = yes
What do you need?
tcp.invited_nodes = (192.168.1.102, …)
Database host/port.
SAP System ID.
Oracle Instance ID ( = SAPSID?)
48
Exploitation Phase
© 2008
Case Study:
SAProuter Security
Assessment
51
Case Study: SAProuter Security Assessment
© 2008
SAProuter Introduction
SAProuter is an SAP program working as a proxy, which analyzes
connections between SAP systems and between SAP systems and
external networks.
Internal Network
External User
Other Internal
Systems
IntraWeb
SSH Server
SAProuter Introduction
If SAProuter is in place, clients have to specify a route string to connect.
/H/saprouter/S/3299/H/sapprd1/S/3200
First-match criteria.
In no match, deny connection. 53
Case Study: SAProuter Security Assessment
© 2008
S 10.1.*.* 10.1.2.* *
D * * * *
S 10.1.*.* 10.1.2.* *
P * * * * 54
Case Study: SAProuter Security Assessment
© 2008
55
Case Study: SAProuter Security Assessment
© 2008
56
Case Study: SAProuter Security Assessment
© 2008
SAProuter Introduction
SAProuter is an SAP program working as a proxy, which analyzes
connections between SAP systems and between SAP systems and
external networks.
Protection / Countermeasure
Typical SAProuter Architecture
SAProuter should be implemented in a separate DMZ.
Internal Network
Use VPNs and/or restrict connections at the border Firewall.
The RouteExternal
Permission
User Table should restrict access only to allowed parties, to
specific targets and ports. Other Internal
Systems
SNC should be required.
Internet DEV QAS PRD
Entries containing wildcards (*) are discouraged and should be carefully analyzed.
IntraWeb
SSH Server
Conclusions
Wrapping up
58
Conclusions
© 2008
Conclusions
It’s impossible to cover all the activities of an SAP Pentest in a one hour talk!
SAP systems deal with sensitive business information and processes. The
integrity, confidentiality and availability of this information is critical.
SAP systems security is often overlooked during the implementation phase, in
order to avoid “business delays”.
SAP security is much more than User Roles/Profiles and Authorizations!
By default, some configurations would expose the systems to high risk threats.
SAP provides many ways to secure systems and communications.
Administrators should enable security settings as soon as possible.
Pentesting your SAP systems will let you know the current security level of your
implementation (and show your managers why you need resources to secure it :P )
CYBSEC’s sapyto supports activities of all phases of the project.
SAP Penetration Tests should be carried out in controlled environments,
performed by qualified experts in the subject.
59
References
© 2008
References
“Attacking the Giants: Exploiting SAP Internals” White-paper
http://www.cybsec.com/upload/bh-eu-07-nunez-di-croce-WP_paper.pdf
sapyto
http://www.cybsec.com/EN/research/sapyto.php
SAP Note 931252 - Security Note: Authority Check for Function Group SRFC.
SAP Note 618516 - Security-related enhancement of RFCEXEC program.
SAP Note 1237762 - ABAP systems: Protection against password hash attacks
60
© 2008
¿Questions?
61
© 2008
Thank you!
www.cybsec.com
62