Top 10 most interesting SAP vulnerabilities and attacks Alexander Polyakov



Similar documents
Top 10 most interes.ng SAP vulnerabili.es and a9acks

THE STATE OF SAP SECURITY 2013: VULNERABILITIES, THREATS AND TRENDS

A GLOBAL SURVEY Authors:

EAS-SEC Project: Securing Enterprise Business Applications

Invest in security to secure investments. Breaking SAP Portal. Dmitry Chastuhin Principal Researcher at ERPScan

A crushing blow at the heart of SAP J2EE Engine. For BlackHat USA Version 1.0

If I want a perfect cyberweapon, I'll target ERP

sec.org

Forgotten World: Corporate Business Application Systems

Inception of the SAP Platform's Brain Attacks on SAP Solution Manager

PRACTICAL PENTESTING OF ERP SYSTEMS AND BUSINESS

How to hack VMware vcenter server in 60 seconds

Practical pentesting of ERP s and business applications

Attacks to SAP. Web Applications Your crown jewels online. Mariano Nuñez Di Croce. Troopers, Germany. March 30th,

Auditing the Security of an SAP HANA Implementation

Invest in security to secure investments Oracle PeopleSoft applications are under attacks!

ATTACKS TO SAP WEB APPLICATIONS

Application Security Testing. Erez Metula (CISSP), Founder Application Security Expert

Alexander Polyakov CTO ERPScan

Bank Hacking Live! Ofer Maor CTO, Hacktics Ltd. ATC-4, 12 Jun 2006, 4:30PM

Web Application Report

Members of the UK cyber security forum. Soteria Health Check. A Cyber Security Health Check for SAP systems

CRYPTUS DIPLOMA IN IT SECURITY

Andreas Wiegenstein Dr. Markus Schumacher

Evolution of Penetration Testing

The SAProuter An Internet Window to your SAP Platform (and beyond)

Vulnerability Assessment and Penetration Testing

Thick Client Application Security

COURSE NAME: INFORMATION SECURITY INTERNSHIP PROGRAM

ERP Security. Myths, Problems, Solutions

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

SAP Secure Operations Map. SAP Active Global Support Security Services May 2015

Some notes on SAP Security

Virtualization System Security

Hack In The Box Conference 2011, Amsterdam. Dr. Markus Schumacher

Out of the Fire - Adding Layers of Protection When Deploying Oracle EBS to the Internet

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Research Paper SAP Penetration Testing Using Metasploit

ABC LTD EXTERNAL WEBSITE AND INFRASTRUCTURE IT HEALTH CHECK (ITHC) / PENETRATION TEST

What is Web Security? Motivation

Penetration: from Application down to OS

Penetration Testing with Kali Linux

Sample Report. Security Test Plan. Prepared by Security Innovation

Security Guide SAP GUI for Windows

Automating Security Testing. Mark Fallon Senior Release Manager Oracle

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

Last update: February 23, 2004

Security Goals Services

Automated Penetration Testing with the Metasploit Framework. NEO Information Security Forum March 19, 2008

SAP. Penetration Testing. with Onapsis Bizploit. Mariano Nuñez. Di Croce. HITB Security Conference, Dubai. April 22,

Client logo placeholder XXX REPORT. Page 1 of 37

Attack Vector Detail Report Atlassian

SCP - Strategic Infrastructure Security

Web Application Security Considerations

SAP Netweaver Application Server and Netweaver Portal Security

Locking down a Hitachi ID Suite server

Attack and Penetration Testing 101

Securing a Web Service

Andreas Mertz (Founder/Man. Dir. it-cube SYSTEMS, CISSP) 360 SAP Security

Executive Summary On IronWASP

Criteria for web application security check. Version

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Web App Security Audit Services

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

MatriXay Database Vulnerability Scanner V3.0

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

Secrets of Vulnerability Scanning: Nessus, Nmap and More. Ron Bowes - Researcher, Tenable Network Security

Integrigy Corporate Overview

Medical Device Security Health Imaging Digital Capture. Security Assessment Report for the Kodak Capture Link Server V1.00

Medical Device Security Health Imaging Digital Capture. Security Assessment Report for the Kodak DR V2.0

SAP SECURITY OPTIMIZATION

Topics in Web Application Security BlackHat Seattle, by WhiteHat Security, Inc.

Hardening of SAP HTTP- and Webservices

Hardening of SAP HTTP- and Webservices

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Network Security and Firewall 1

Learn Ethical Hacking, Become a Pentester

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

North Dakota 2013 IT Security Audit Vulnerability Assessment & Penetration Test Project Briefing

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

Security Code Review- Identifying Web Vulnerabilities

Evaluation of Penetration Testing Software. Research

Installing and Configuring Nessus by Nitesh Dhanjani

TEXAS AGRILIFE SERVER MANAGEMENT PROGRAM

In the name of God. 1 Introduction. 2 General Plan

How to hack VMware vcenter server in 60 seconds

EC-Council CAST CENTER FOR ADVANCED SECURITY TRAINING. CAST 619 Advanced SQLi Attacks and Countermeasures. Make The Difference CAST.

Columbia University Web Security Standards and Practices. Objective and Scope

How to scan/exploit a ssl based webserver. by xxradar. mailto:xxradar@radarhack.com. Version 1.

CSE331: Introduction to Networks and Security. Lecture 32 Fall 2004

SENSITIVE AUSTRALIAN SPORTS COMMISSION ATHLETE MANAGEMENT SYSTEM (AMS) SMARTBASE SECURITY TEST PLAN. Final. Version 1.0

Detecting Data Leaks in SAP -

The monsters under the bed are real World Tour

Chapter 4 Application, Data and Host Security

CS5008: Internet Computing

Remote Administration

HTTPParameter Pollution. ChrysostomosDaniel

Transcription:

Invest in security to secure investments Top 10 most interesting SAP vulnerabilities and attacks Alexander Polyakov CTO at ERPScan May 9, 2012

Me Business application security expert

What is SAP? Shut up And Pay

Really The most popular business application More than 120000 customers 74% of Forbes 500

Agenda Intro SAP security history SAP on the Internet Top 10 latest interesting attacks DEMOs Conclusion

3 areas of SAP Security 2002 Business logic security Prevents attacks or mistakes made by insiders 2008 2010 Solution: GRC ABAP Code security Prevents attacks or mistakes made by developers Solution: Code audit Application platform security Prevents unauthorized access both within the corporate network and from remote attackers Solution?

Talks about SAP security 35 30 25 20 15 10 Most popular: BlackHat HITB Troopers RSA Source DeepSec etc. 5 0 2006 2007 2008 2009 2010 2011 2012

SAP Security notes 900 800 700 600 500 By April 26, 2012, a total of 2026 notes 400 300 200 100 0 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012

SAP vulnerabilities by type 1 - Directory Traversal 2 - XSS/Unauthorised modification of stored content 3 - Missing Auth check 4 - Information Disclosure 5 - Unauthorized usage of application functionality 6 - Hard-coded credentials 7 - Code injection vulnerability 8 - Verb tampering 9 - Remote Code Execution 10 - Denial of service Stats from : 1Q 2012 1Q 2010 4Q 2009 11 - BOF 12 -SQL Inj 0 50 100 150 200 250 300 350

SAP on the Internet MYTH: SAP systems attacks available only for insiders We have collected data about SAP systems in the WEB Have various stats by countries, applications, versions Information from Google, Shodan, Nmap scan

SAP on the Internet About 5000 systems including Dispatcher, Message server, SapHostcontrol, Web- services

SAP on the Internet

Top 10 vulnerabilities 2011-2012 1. Authentication Bypass via Verb tampering 2. Authentication Bypass via the Invoker servlet 3. Buffer overflow in ABAP Kernel 4. Code execution via TH_GREP 5. MMC read SESSIONID 6. Remote portscan 7. Encryption in SAPGUI 8. BAPI XSS/SMBRELAY 9. XML Blowup DOS 10. GUI Scripting DOS N N w N N Nw w N N w N N w

10 GUI-Scripting DOS: Description SAP users can run scripts which automate their user functions A script has the same rights in SAP as the user who launched it Security message which is shown to user can be turned off in the registry Almost any user can use SAP Messages (SM02 transaction) New It is possible to run DOS attack on any user using a simple script Author: Dmitry Chastukhin (ERPScan)

10 GUI-scripting: Other attacks Script can be uploaded using: SAPGUI ActiveX vulnerability Teensy USB flash Any other method of client exploitation Other attacks like changing banking accounts in LFBK also possible

10 GUI-scripting: Business risks Sabotage High Espionage No Fraud No Ease of exploitation Medium

10 GUI-scripting: Prevention SAP GUI Scripting Security Guide sapgui/user_scripting = FALSE Block registry modification on workstations

9 XML Blowup DOS: Description WEBRFC interface can be used to run RFC functions By default any user can have access Even without S_RFC auth SAP NetWeaver is vulnerable to malformed XML packets It is possible to run DOS attack on server using simple script It is possible to run over the Internet! New Author: Alexey Tyurin (ERPScan)

9 XML Blowup DOS: Demo

9 XML Blowup DOS: Business risks Sabotage Critical Espionage No Fraud No Ease of exploitation Medium

9 XML Blowup DOS: Prevention Disable WEBRFC Prevent unauthorized access to WEBRFC using S_ICF Install SAP notes 1543318 and 1469549

8 BAPI script injection/hash stealing : Description SAP BAPI transaction fails to properly sanitize input Possible to inject JavaScript code or link to a fake SMB server SAP GUI clients use Windows so their credentials will be transferred to attackers host. Author: Dmitry Chastukhin (ERPScan)

8 BAPI script injection/hash stealing: Demo New

8 BAPI script injection/hash stealing: Business risks Espionage High Sabotage High Fraud High Ease of exploitation Low

7 SAP GUI bad encryption: Description New SAP FrontEnd can save encrypted passwords in shortcuts Shortcuts stored in.sap file This password uses byte-xor algorithm with secret key Key has the same value for every installation of SAP GUI Any password can be decrypted in 1 second Author: Alexey Sintsov (ERPScan)

7 SAP GUI bad encryption: Business risks Espionage High Sabotage Medium Fraud High Ease of exploitation Medium

7 SAP GUI bad encryption: Prevention Disable password storage in GUI

6 Remote port scan via JSP: Description It is possible to scan internal network from the Internet Authentication is not required SAP NetWeaver J2EE engine is vulnerable /ipcpricing/ui/bufferoverview.jsp? server=172.16.0.13 & port=31337 & password= & dispatcher= & targetclient= & view= Author: Alexander Polyakov (ERPScan)

6 Remote port scan via JSP: Demo Host is not alive HTTP port Port closed SAP port

6 Remote port scan via JSP: Business risks Sabotage Low Espionage Medium Fraud No Ease of exploitation High

6 Remote port scan via JSP: Prevention Install SAP notes: 1548548, 1545883, 1503856, 948851, 1545883 Disable unnecessary applications

5 MMC JSESSIONID stealing: Description Remote management of SAP Platform By default, many commands go without auth Exploits implemented in Metasploit (by ChrisJohnRiley) Most of the bugs are information disclosure It is possible to find information about JSESSIONID Only if trace is ON New 1) Original bug by ChrisJohnRiley 2) JSESSIONID by Alexey Sintsov and Alexey Tyurin (ERPScan) Can be authenticated as an existing user remotely

5 MMC JSESSIONID stealing: Business risks Espionage Critical Fraud High Sabotage Medium Ease of exploitation Medium

5 MMC JSESSIONID stealing: Prevention The JSESSIONID by default will not be logged in log file Don t use TRACE_LEVEL = 3 on production systems or delete traces after use Other info http://help.sap.com/saphelp_nwpi71/helpdata/en/d6/49543b1e49bc1fe10000000 a114084/frameset.htm

4 Remote command execution in TH_GREP: Description RCE vulnerability in RFC module TH_GREP Found by Joris van de Vis SAP was not properly patched (1433101) We have discovered that the patch can be bypassed in Windows Original bug by Joris van de Vis (erp-sec) Bypass by Alexey Tyurin (ERPScan)

4 RCE in TH_GREP: Details elseif opsys = 'Windows NT'. concatenate '/c:"' string '"' filename into grep_params in character mode. else. /*if linux*/ /* 185 */ replace all occurrences of '''' in local_string with '''"''"'''. /* 186 */ concatenate '''' local_string '''' filename into grep_params /* 187*/ in character mode. /* 188*/ endif. /* 188*/

4 RCE in TH_GREP: Demo #1

4 - RCE in TH_GREP: More details 4 ways to execute vulnerable program Using transaction "Se37 Using transaction SM51 (thanks to Felix Granados) Using remote RFC call "TH_GREP" Using SOAP RFC call "TH_GREP" via web

4 RCE in TH_GREP: Demo #2

4 RCE in TH_GREP: Business risks Espionage High Sabotage Medium Fraud High Ease of exploitation medium

4 RFC in TH_GREP: Prevention Install SAP notes 1580017, 1433101 Prevent access to critical transactions and RFC functions Check the ABAP code of your Z-transactions for similar vulnerabilities

3 - ABAP Kernel BOF: Description Presented by Andreas Wiegenstein at BlackHat EU 2011 Buffer overflow in SAP kernel function C_SAPGPARAM When NAME field is more than 108 chars Can be exploited by calling an FM which uses C_SAPGPARAM Example of report RSPO_R_SAPGPARAM Author: (VirtualForge)

3 ABAP Kernel BOF: Business risks Espionage Critical Sabotage Critical Fraud Critical Ease of exploitation Medium

3 ABAP Kernel BOF: Prevention Install SAP notes: - 1493516 Correcting buffer overflow in ABAP system call - 1487330 Potential remote code execution in SAP Kernel Prevent access to critical transactions and RFC functions Check the ABAP code of your Z-transactions for critical calls

2 Invoker Servlet: Description Rapidly calls servlets by their class name Published by SAP in their security guides Possible to call any servlet from the application Even if it is not declared in WEB.XML Can be used for auth bypass

2 - Invoker Servlet: Details <servlet> <servlet-name>criticalaction</servlet-name> <servlet-class>com.sap.admin.critical.action</servlet-class> </servlet> <servlet-mapping> <servlet-name>criticalaction</</servlet-name> <url-pattern>/admin/critical</url-pattern> </servlet-mapping <security-constraint> <web-resource-collection> <web-resource-name>restrictedaccess</web-resource-name> <url-pattern>/admin/*</url-pattern> <http-method>get</http-method> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint> Author: Dmitry Chastukhin (ERPScan) What if we call /servlet/com.sap.admin.critical.action

2 Invoker servlet: Business risks Espionage High Sabotage High Fraud High Ease of use Very easy!

2 - Invoker servlet: Prevention Update to the latest patch 1467771, 1445998 EnableInvokerServletGlobally property of the servlet_jsp must be false If you can t install patches for some reason, you can check all WEB.XML files using ERPScan web.xml scanner manually.

1 VERB Tampering

1 st Place Verb Tampering <security-constraint> <web-resource-collection> <web-resource-name>restrictedaccess</web-resource-name> <url-pattern>/admin/*</url-pattern> <http-method>get</http-method> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint> Author: Alexander Polyakov (ERPScan) What if we use HEAD instead of GET?

1 Verb tampering: Details CTC Secret interface for managing J2EE engine Can be accessed remotely Can run user management actions: Add users Add to groups Run OS commands Start/Stop J2EE Remotely without authentication!

1 Verb tampering: Demo

1 Verb tampering: More details If patched, can be bypassed by the Invoker servlet! erpscan.com ERPScan invest in security to secure investments 53

1 Verb tampering: Business risks Espionage Critical Sabotage Critical Fraud Critical Ease of use Very easy!

1 st Place Verb tampering: Prevention Prevention: Install SAP notes 1503579,1616259 Install other SAP notes about Verb Tampering (about 18) Scan applications using ERPScan WEB.XML check tool or manually Secure WEB.XML by deleting all <http-method> Disable the applications that are not necessary

Conclusion It is possible to be protected from almost all those kinds of issues and we are working hard with SAP to make it secure SAP Guides Regular Security assessments Monitoring technical security ABAP Code review Segregation of Duties It s all in your hands

Future work Many of the researched things cannot be disclosed now because of our good relationship with SAP Security Response Team, whom I would like to thank for cooperation. However, if you want to see new demos and 0-days, follow us at @erpscan and attend the future presentations: PHDays in May (Moscow) Just4Meeting in July (Portugal) BlackHat USA in July (Las Vegas)

web: www.erpscan.com e-mail: info@erpscan.com sales@erpscan.com Twitter: @erpscan @sh2kerr Greetz to our crew who helped: Dmitriy Evdokimov, Alexey Sintsov, Alexey Tyurin, Pavel Kuzmin, Evgeniy Neelov.