Getting started with OWASP WebGoat 4.0 and SOAPUI.



Similar documents
Secure Web Development Teaching Modules 1. Threat Assessment

T320 E-business technologies: foundations and practice

Web attacks and security: SQL injection and cross-site scripting (XSS)

Immotec Systems, Inc. SQL Server 2005 Installation Document

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

TANDBERG MANAGEMENT SUITE 10.0

Case Closed Installation and Setup

Kaseya 2. User Guide. Version 6.1

How to Setup and Connect to an FTP Server Using FileZilla. Part I: Setting up the server

Quick Scan Features Setup Guide

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

Signiant Agent installation

Installing and Configuring Microsoft Dynamics Outlook Plugin to Use with ipipeline MS CRM

DSI File Server Client Documentation

Firewalls and Software Updates

National Fire Incident Reporting System (NFIRS 5.0) Configuration Tool User's Guide

Elluminate Live! Access Guide. Page 1 of 7

Installing SQL Express. For CribMaster 9.2 and Later

How to Earn IPv6 Certifications (Windows Version: Fast) Why? Macintosh Instructions Windows Versions Tips for Windows Home Edition Users

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

IIS, FTP Server and Windows

Installation Guide For Choic Enterprise Edition

Crystal Reports Installation Guide

The Citrix service is now available to faculty and staff at Cypress College.

Table of Contents. Requirements and Options 1. Checklist for Server Installation 5. Checklist for Importing from CyberAudit

Author: Gennaro Frazzingaro Universidad Rey Juan Carlos campus de Mostòles (Madrid) GIA Grupo de Inteligencia Artificial

HOW TO SETUP AN APACHE WEB SERVER AND INTEGRATE COLDFUSION

Elluminate Live! Access Guide. Page 1 of 7

Using SSH Secure Shell Client for FTP

SSH Secure Client (Telnet & SFTP) Installing & Using SSH Secure Shell for Windows Operation Systems

Bitrix Site Manager ASP.NET. Installation Guide

Installation / Backup \ Restore of a Coffalyser.Net server database using SQL management studio

Department of Veterans Affairs VistA Integration Adapter Release Enhancement Manual

Thinspace deskcloud. Quick Start Guide

Quick Scan Features Setup Guide. Scan to Setup. See also: System Administration Guide: Contains details about setup.

Customer Tips. Configuring Color Access on the WorkCentre 7328/7335/7345 using Windows Active Directory. for the user. Overview

1. Tutorial Overview

SAIP 2012 Performance Engineering

Setting Up a Unisphere Management Station for the VNX Series P/N Revision A01 January 5, 2010

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL

Installing the SSH Client v3.2.2 For Microsoft Windows

MadCap Software. Upgrading Guide. Pulse

RHEV 2.2: REST API INSTALLATION

Remote Desktop Web Access. Using Remote Desktop Web Access

isupplier PORTAL ACCESS SYSTEM REQUIREMENTS

EMC Clinical Archiving

HP Operations Orchestration Software

National Fire Incident Reporting System (NFIRS 5.0) NFIRS Data Entry/Validation Tool Users Guide

enicq 5 System Administrator s Guide

Installation Manual v2.0.0

Getting Started with Dynamic Web Sites

Tenrox. Single Sign-On (SSO) Setup Guide. January, Tenrox. All rights reserved.

EXTRA. Vulnerability scanners are indispensable both VULNERABILITY SCANNER

Remote Connectivity to XV, XP and epro units running Visual Designer

5. At the Windows Component panel, select the Internet Information Services (IIS) checkbox, and then hit Next.

Server & Workstation Installation of Client Profiles for Windows

Configuring your client to connect to your Exchange mailbox

1. Open the Account Settings window by clicking on Account Settings from the Entourage menu.

Setting Up a Dreamweaver Site Definition for OIT s Web Hosting Server

Knowledge Base Article: Article 218 Revision 2 How to connect BAI to a Remote SQL Server Database?

Installing Oracle 12c Enterprise on Windows 7 64-Bit

VIDEO intypedia007en LESSON 7: WEB APPLICATION SECURITY - INTRODUCTION TO SQL INJECTION TECHNIQUES. AUTHOR: Chema Alonso

Secure Messaging Server Console... 2

BUILDER 3.0 Installation Guide with Microsoft SQL Server 2005 Express Edition January 2008

IUCLID 5 Guidance and Support

Secret Server Installation Windows 8 / 8.1 and Windows Server 2012 / R2

Kaseya Server Instal ation User Guide June 6, 2008

Synchronizer Installation

Ad Hoc Transfer Plug-in for Outlook Installation Guide

Configuring SonicWALL TSA on Citrix and Terminal Services Servers

Virtual Appliance for VMware Server. Getting Started Guide. Revision Warning and Disclaimer

Fiery EX4112/4127. Printing from Windows

Working With Your FTP Site

The FlexiSchools Online Order Management System Installation Guide

SMART Vantage. Installation guide

Single-sign-on between MWS custom portlets and IS services

Web Application Report

What is Aconex Local Copy? Controlling Access to a Datastore Hardware Requirements Software Requirements Installing Aconex Local Copy Troubleshooting

OutDisk 4.0 FTP FTP for Users using Microsoft Windows and/or Microsoft Outlook. 5/1/ Encryptomatic LLC

Installation and Deployment

Active Directory Reporter Quick start Guide

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

Web Application Vulnerability Testing with Nessus

Sharp Remote Device Manager (SRDM) Server Software Setup Guide

INFORMATION SYSTEMS SERVICE NETWORKS AND TELECOMMUNICATIONS SECTOR. User Guide for the RightFax Fax Service. Web Utility


How to use FTP Commander

How To Create An Easybelle History Database On A Microsoft Powerbook (Windows)

Connect the Host to attach to Fast Ethernet switch port Fa0/2. Configure the host as shown in the topology diagram above.

Xerox EX Print Server, Powered by Fiery, for the Xerox 700 Digital Color Press. Printing from Windows

Using Remote Web Workplace Version 1.01

Password Reset Server Installation Guide Windows 8 / 8.1 Windows Server 2012 / R2

This document is intended to make you familiar with the ServersCheck Monitoring Appliance

VMware vcenter Log Insight Security Guide

SQL Injection Attack Lab

WhatsUp Gold v16.1 Installation and Configuration Guide

Sophos SafeGuard Native Device Encryption for Mac Administrator help. Product version: 7

Secure Global Desktop (SGD)

Access Instructions for United Stationers ECDB (ecommerce Database) 2.0

Installation and Administration Guide

Transcription:

Getting started with OWASP WebGoat 4.0 and SOAPUI. Hacking web services, an introduction. Version 1.0 by Philippe Bogaerts Philippe.Bogaerts@radarhack.com www.radarhack.com Reviewed by Erwin Geirnaert Erwin.geirnaert@zionsecurity.com www.zionsecurity.com

1. Introduction SOA, web services, WS-security and lot of other related protocols and technologies become at fast pace business critical corner stones of today s IT infrastructures and business applications. Security efforts must undoubtedly focus more on the applications in use, simply because this is where companies are vulnerable today. Organizations can be impacted the most when applications, (read: the business processes), are adversely used. This paper should serve as a starting point for everyone that wants to learn, in a practical way, the basics of web services and how they can be exploited. This paper has the only purpose of education and awareness creation, towards people wanting the world to become a better and saver world. The tools used in this paper are freely available at http://www.owasp.org and http://www.soapui.org. 2. A word on WebGoat 4.0 From the OWASP website: WebGoat is a deliberately insecure J2EE web application maintained by OWASP designed to teach web application security lessons. In each lesson, users must demonstrate their understanding of a security issue by exploiting a real vulnerability in the WebGoat application. For example, in one of the lessons the user must use SQL injection to steal fake credit card numbers. The application is a realistic teaching environment, providing users with hints and code to further explain the lesson. More info can be found at: http://www.owasp.org/index.php/category:owasp_webgoat _Project

3. A word on Soapui From the SOAPUI website: Soapui is a desktop application for inspecting, invoking, developing and functional/load/compliance testing of web services over HTTP. It is mainly aimed at developers/testers providing and/or consuming web services (java,.net, etc). Functional and Load-Testing can be done both interactively in soapui and within an automated build/integration process using the soapui command-line tools. Soapui currently requires java 1.5 and is licensed under the LGPL license. More info can be found at: http://www.soapui.org/ 4. Installing WebGoat 4.0 Installing WebGoat 4.0 is a straightforward process. Simply download the zipped binaries via the WebGoat project pages on http://www.owasp.org. This paper is based on the Windows_WebGoat -4.0_Release.zip of the tool. 1. Unzip Windows_WebGoat -4.0_Release.zip in a directory of your choice. 2. Make sure that all other web servers running on port 80 are stopped. Stop Microsoft IIS services and Apache services via the control panel if they were previously installed. Especially pay attention to Skype, it can/will use port 80 when available on startup and will inhibit WebGoat from booting correctly. Note: Use netstat an on the command line to verify that port 80 is not in use. REMARK: It is possible to change the connector port that Tomcat uses via editing the file server.xml located in Windows_WebGoat-4.0_Release\tomcat\conf. Just change the value 80 to whatever you want, e.g. 80803, and save the file when exiting.

3. Click WebGoat.bat in the installation directory and a command shell window will display the WebGoat starting process. If everything goes as planned, it will display a message like INFO: Server startup in 4719 ms. 4. Connect to http://127.0.0.1/webgoat/attack (mind the capital letters in the URL) and login with the username guest and password guest. 5. A nice welcome page is displayed in your browser inviting you to click start.

5. Installing soapui Installing soapui is very easy. You need a Java Runtime Environment or Java Developer Kit from http://java.sun.com. WebGoat is bunled with a JRE so you can use this java virtual machine. Just click the Webstart button on the http://www.soapui.org. Throughout the paper soapui 1.5 is used to guarantee the best results, although most functionality is working fine in the beta versions available on the website. Another option to install soapui is to download the binaries. This latter option is used in this paper. 1. Download the soapui 1.5 binaries (soapui-1.5-bin.zip) 2. Unzip the archive in a folder of your choice 3. Double click in the soapui-1.5\bin folder, the soapui.bat icon. Soapui starts and presents you a nice looking interface.

6. A hair rising explanation of web services Web services are about applications communicating with other applications, opposed to a user to application communication model. New applications might want to communicate to reuse existing services already offered by applications on the corporate network, partner network or simply somewhere available on the internet. Imagine you want to develop a simple network monitoring application that sends an SMS when a certain host on your network goes down. The first part could be easily achieved by a simple ping command (or something more fancy if you have the time ), but sending the SMS when something goes wrong, might be difficult and a much more expensive undertaking. Wouldn t it be handy if you could, with some few lines of code, reuse the existing SMS system already in place within the company s mail-to-sms service application? Well, web services make this possible. A web services infrastructure provides you with a simple, documented and standardized way of invoking a remote service. One of the building blocks of web services is XML. XML is a way to represent the data being exchanged between systems in an unambiguously way, independently of the OS or development environment in use. So, the first question is, where do I find the service I potentially want to reuse? Companies might use an UDDI repository in which developers (or applications) can look for available services. In our case (and often the case), the information about the web service is provided on a webpage. Here is a starting link in WebGoat: http://127.0.0.1/webgoat/attack?screen=14&menu=1110

Once you know what service is suitable for your application, it is of course mandatory to know how to invoke the remote service (what operations are available, what syntax needs to be used, what parameters need to be passed, what responses can be expected ). All this is described in the corresponding WSDL file (Web Services Description Language). Take a look at the WSDL file of one of the web services available in WebGoat 4.0. It might be possible that you need to authenticate again, using guest as the username and password. http://127.0.0.1/webgoat/services/wsdlscanning?wsdl

This WSDL file contains all the information your application needs to invoke the remote services. Typically, your application downloads the WSDL file and is able to craft the necessary requests and interpreting the responses. This can be achieved easily with a few lines of PERL code or soapui! Where does SOAP come into the picture? Web services are designed to be totally independent of the underlying network protocols, whether you use TCP, UDP, SMTP, FTP or HTTP. An independent layer and standardized protocols on top of all these protocols is necessary to exchange our service related messages between applications. In our example, SOAP is almost overhead. In more complex environments SOAP is used to address web services more accurately, route messages and much more. 7. Enough theory, let s start playing Visit http://127.0.0.1/webgoat/attack?menu=1110. The information provided in the web interface, the Account Number, is received by an underlying java application when clicking the submit button. The java application builds the correct SOAP message (corresponding to the WSDL file) and sends it to the web service that interrogates a database for the associated credit card numbers. A SOAP response message received by the java application is interpreted and the results are displayed in the browser.

8. Invoking the web services directly Instead of using the web interface, we can try to access the web service directly. The web page provides a link to the WSDL file describing a service to retrieve credit card numbers. (http://127.0.0.1/webgoat/services/wssqlinjection?wsdl) 1. Open soapui, create a new WSDL project and name it Good_Web_Service, and save the project file to disk when prompted. 2. Next important step, import all information necessary to send and receive correct soap messages, because, as explained, this is how you interrogate web services!

3. Click Add WSDL from URL, provide the URL for the WSDL file and click OK. (You might be prompted for authentication. Always use the guest account) Note: soapui sometimes displays an error exception when downloading the WSDL file. If you experience any problems, just open the same link in a browser and save the file as web_service_good.wsdl and import it into soapui. 4. Soapui now prompts to create all default requests for all operations. This simply means that soapui can build the correct messages to interrogate the web service, based on the WSDL file just imported. 5. Double click Request 1 in the interface and soapui shows a kind of template of the soap message to be

send (over http in this case) to the web service. A closer look at the message reveals the structure of the SOAP message. The service request is encapsulated in a SOAP envelop. The SOAP envelop contains an optional SOAP header (not present in this case) and a mandatory SOAP body. The interesting part to notice is the XML message in the SOAP body. This XML message is build according to the information in the WSDL file and is different for most web services available. To illustrate the full picture, this soap message is send across the network within typically http(s), using the POST method to the service endpoint http://127.0.0.1/webgoat/services/wssqlinjection.

6. To easily use the service, create a test case by right-clicking request 1. 7. Now take a look at the SOAP message in the test case and change the id (Account Number)? in 101. Other valid id values are 102 and 103. <soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschemainstance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:les="http://lessons.webgoat.owasp.org"> <soapenv:body> <les:getcreditcard soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <id xsi:type="xsd:string">101</id> </les:getcreditcard> </soapenv:body> </soapenv:envelope>

8. Before you click the play button, make sure to tell soapui it needs to authenticate to use the service. The authentication mechanism in use is basic HTTP authentication Note: In most cases, the authentication step is not necessary. A lot of web services on the internet do not need authentication. 9. When done, click the play button in the interface.

10. A quick look at the SOAP response reveals the requested information. <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschemainstance"> <soapenv:body> <ns1:getcreditcardresponse soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://lessons.webgoat.owasp.org"> <getcreditcardreturn soapenc:arraytype="xsd:string[2]" xsi:type="soapenc:array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <getcreditcardreturn xsi:type="xsd:string">987654321</getcreditcardreturn> <getcreditcardreturn xsi:type="xsd:string">223420065411</getcreditcardreturn> </getcreditcardreturn> </ns1:getcreditcardresponse> </soapenv:body> </soapenv:envelope> Remark: The SOAP messages in these examples have no SOAP header. The SOAP header is optional. 11. Create new test cases and change the id value in some other valid and invalid values. Monitor the SOAP error messages, when the service fails to fulfill the request.

9. Time to hack Revisit the web page to obtain associated credit card numbers and account numbers. As explained, to fulfill the request, the web services interrogate a database for the information linked to the account number. In plain words, the account number will eventually be part of a SQL statement. This is a snippet of code that builds the SQL statement: String query = "SELECT * FROM user_data WHERE userid = " + accountnumber; This is really bad! The accountnumber is simply appended to the string that will be used as the SQL statement. So in normal conditions, this would be: SELECT * FROM user_data WHERE userid = 101; Now use your imagination. What happens if I could execute SELECT * FROM user_data WHERE userid = 101 or 1=1;? Let s try this!

As you can see, the web application does not expect this trick. But perhaps, the protection is build within the java code and not in the web service being used to interrogate the database. Let s create a SOAP message that interrogates the database with 1 or 1=1. Create a new test case (think about the authentication) and adjust to your needs. <soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:les="http://lessons.webgoat.owasp.org"> <soapenv:body> <les:getcreditcard soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <id xsi:type="xsd:string">1 or 1=1</id> </les:getcreditcard> </soapenv:body> </soapenv:envelope> Well, you re supposed to be rich at this moment, if it wasn t a training application!

10. Conclusion Web services might be vulnerable to the same type of attacks as web applications. It is important to notice that every component of the application needs to be secured and coded with security mind. Just imagine what would happen if this web service would be available and reused by other applications? I hope to have guided any reader through an exciting and at first sight complicated world of web services and XML related technology and hope this paper might serve as a good starting point. If you have any questions, comments or come across mistakes, feel free to drop me an email at xxradar@radarhack.com.