Security Testing OpenGGSN: a Case Study



Similar documents
Testing for Security

CMPT 471 Networking II

5.0 Network Architecture. 5.1 Internet vs. Intranet 5.2 NAT 5.3 Mobile Network

Source Code Review Using Static Analysis Tools

Secure Software Programming and Vulnerability Analysis

Firewalls Overview and Best Practices. White Paper

IP-based Mobility Management for a Distributed Radio Access Network Architecture. helmut.becker@siemens.com

Telecom Testing and Security Certification. A.K.MITTAL DDG (TTSC) Department of Telecommunication Ministry of Communication & IT

Chapter 9 Monitoring System Performance

NETWORK PENETRATION TESTING

Chapter 4 Customizing Your Network Settings

Application Code Development Standards

LAN TCP/IP and DHCP Setup

Network and Host-based Vulnerability Assessment

Network Management System (NMS) FAQ

Guideline for stresstest Page 1 of 6. Stress test

GTP Security in 3G Core Network

CS 356 Lecture 25 and 26 Operating System Security. Spring 2013

Automation of Smartphone Traffic Generation in a Virtualized Environment. Tanya Jha Rashmi Shetty

Peach Fuzzer Platform

10 METRICS TO MONITOR IN THE LTE NETWORK. [ WhitePaper ]

IPv6 SECURITY. May The Government of the Hong Kong Special Administrative Region

ETSI TS V9.0.0 ( ) Technical Specification

ECE 578 Term Paper Network Security through IP packet Filtering

ITEC441- IS Security. Chapter 15 Performing a Penetration Test

Performance Testing. Slow data transfer rate may be inherent in hardware but can also result from software-related problems, such as:

Chapter 4 Customizing Your Network Settings

CMSC 421, Operating Systems. Fall Security. URL: Dr. Kalpakis

The Benefits of Verio Virtual Private Servers (VPS) Verio Virtual Private Server (VPS) CONTENTS

Internet Security and Acceleration Server 2000 with Service Pack 1 Audit. An analysis by Foundstone, Inc.

Voice Over IP (VoIP) Denial of Service (DoS)

HoneyBOT User Guide A Windows based honeypot solution

AN OVERVIEW OF VULNERABILITY SCANNERS

Whitepaper. 10 Metrics to Monitor in the LTE Network. blog.sevone.com

nexvortex SIP Trunking Implementation & Planning Guide V1.5

DEFENSE THROUGHOUT THE VULNERABILITY LIFE CYCLE WITH ALERT LOGIC THREAT AND LOG MANAGER

Eudemon1000E Series Firewall HUAWEI TECHNOLOGIES CO., LTD.

UMTS/GPRS system overview from an IP addressing perspective. David Kessens Jonne Soininen

Overview of Network Security The need for network security Desirable security properties Common vulnerabilities Security policy designs

Broadband Phone Gateway BPG510 Technical Users Guide

co Characterizing and Tracing Packet Floods Using Cisco R

1.0 Basic Principles of TCP/IP Network Communications

Windows 7. Basic Network Connection Setup

Banking Security using Honeypot

Dedicated and Distributed Vulnerability Management

Security of IPv6 and DNSSEC for penetration testers

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

Protecting Critical Infrastructure

An Introduction to Network Vulnerability Testing

PCI-DSS Penetration Testing

Ovation Security Center Data Sheet

Cisco Change Management: Best Practices White Paper

Security Design.

Wireless VPN White Paper. WIALAN Technologies, Inc.

Web Application s Performance Testing

OPEN SOURCE SECURITY

Web Application Security

Why Leaks Matter. Leak Detection and Mitigation as a Critical Element of Network Assurance. A publication of Lumeta Corporation

Chapter 8 Router and Network Management

Linux Kernel. Security Report

Building Robust Signaling Networks

Prestige 202H Plus. Quick Start Guide. ISDN Internet Access Router. Version /2004

Basic & Advanced Administration for Citrix NetScaler 9.2

Birdstep Intelligent Mobile IP Client v2.0, Universal Edition. Seamless secure mobility across all networks. Copyright 2002 Birdstep Technology ASA

INFORMATION SECURITY TRAINING CATALOG (2015)

How To Classify A Dnet Attack

IMPLEMENTATION OF INTELLIGENT FIREWALL TO CHECK INTERNET HACKERS THREAT

Research on the Essential Network Equipment Risk Assessment Methodology based on Vulnerability Scanning Technology Xiaoqin Song 1

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

Linux Server Support by Applied Technology Research Center. Proxy Server Configuration

DATA SECURITY 1/12. Copyright Nokia Corporation All rights reserved. Ver. 1.0

Information Technology Career Cluster Introduction to Cybersecurity Course Number:

Configuring Your Computer and Network Adapters for Best Performance

Web Application Security Payloads. Andrés Riancho Director of Web Security OWASP AppSec USA Minneapolis

EE6390. Fall Research Report. Mobile IP in General Packet Radio System

Database Security Guide

What a Vulnerability Assessment Scanner Can t Tell You. Leveraging Network Context to Prioritize Remediation Efforts and Identify Options

Abstract. Introduction. Section I. What is Denial of Service Attack?

Evading Infrastructure Security Mohamed Bedewi Penetration Testing Consultant

Port Scanning and Vulnerability Assessment. ECE4893 Internetwork Security Georgia Institute of Technology

Quick Start for Network Agent. 5-Step Quick Start. What is Network Agent?

VPNSCAN: Extending the Audit and Compliance Perimeter. Rob VandenBrink

Firewalls and Intrusion Detection

Network Security: 30 Questions Every Manager Should Ask. Author: Dr. Eric Cole Chief Security Strategist Secure Anchor Consulting

WHITE PAPER ON SECURITY TESTING IN TELECOM NETWORK

SSDP REFLECTION DDOS ATTACKS

Web Application Security

Routing Security Server failure detection and recovery Protocol support Redundancy

Edgewater Routers User Guide

Advanced SIP Series: SIP and 3GPP Operations

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Step-by-Step Configuration

Network Interface Failover using FONA

SonicOS 5.9 / / 6.2 Log Events Reference Guide with Enhanced Logging

ICANWK406A Install, configure and test network security

Transcription:

Security Testing OpenGGSN: a Case Study Esa Tikkala, Mikko Rapeli, Kaarina Karppinen, Hannu Honkanen VTT Technical Research Centre of Finland, Oulu, Finland Abstract As systems today are more and more reliant on the communication between different systems and their co-operation, network security is crucial for the overall security of the whole system. Although protocols themselves can be theoretically proven secure, it is the implementations and complete systems built upon them where the most security bugs reside. Traditional testing is not so effective in finding the security problems and checking the implementations for security problems requires a lot of effort and expertise. Security bugs are often found by doing unexpected things and looking for changes in system and environment behavior and additional side effects. These negative side effects are the main cause that prevents companies from running these tests in their real networks requiring massive investments in parallel test networks. As security can never be absolute not even with vigorous testing - additional precautions are advisable. A set of different testing tools will provide a better coverage of the tested system. System should be made more rugged and more difficult for the crackers and malicious programs to take advantage of. Adopting some metrics also helps in evaluation the security of the system and the testing coverage achieved. In this paper we illustrate the experiences of security testing OpenGGSN, an open source implementation of a Gateway GPRS Support Node (GGSN) that uses the GPRS tunneling protocol (GTP). Keywords: Information security, security testing, OpenGGSN, GTP I Introduction In our Security Testing and Monitoring project we aimed at building a uniform security testing and monitoring framework by applying testing and monitoring products, which are provided by Finnish manufacturers. Development work in the project has been divided into phases, which each apply testing and monitoring methods in specific target environments. In this paper we concentrate entirely on one of the project s test targets - OpenGGSN, which is an open source implementation of a Gateway GPRS Support Node (GGSN) [1], licensed under the GNU General Public License (GPL). The purpose of testing the OpenGGSN was to study different approaches for improving the security attributes of a protocol implementation. OpenGGSN provides a freely available implementation of GTP protocol, with source codes, that could be tested with Codenomicon GTP test tool. In addition to using the commercial tools by Codenomicon, the availability of the sources and compilation environment allowed us to freely experiment with various source code analyzers, scanners and compilation options. These

Pg 50-2 trials enabled us to gain experience of various testing tools and their proper use. As a side product we found some security problems for which we developed fixes. Some good security and coding practices for the implementation and compilation environment are also discussed. The rest of the paper is organized in the following way. Section II discusses the details of OpenGGSN and Section III presents the test environment and methods used. Section IV analyses the test results. Finally, Section V discusses future work and Section VI gives conclusions. II OpenGGSN OpenGGSN is an open source implementation of a Gateway GPRS Support Node (GGSN), licensed for free under the GNU General Public License (GPL). It is used by mobile operators as the interface between the Internet and the rest of the mobile network infrastructure as shown in Figure 1. Uu Uu Uu Figure 1 UMTS/3G network overview. OpenGGSN implements the GPRS tunneling protocol (GTP) version 0 and version 1, and provides an SGSN emulator suitable for GPRS core network testing [2]. The GGSN is the anchor point that enables the mobility of the user terminal in the GPRS/UMTS networks. In essence, it carries out the role in GPRS equivalent to the Home Agent in Mobile IP. It maintains routing necessary to tunnel the Protocol Data Units (PDUs) to the SGSN that service a particular MS (Mobile Subscriber). Other functions include subscriber screening, IP Pool management and address mapping, QoS and PDP context enforcement. From the external IP network s point of view the GGSN is seen as a normal IP router [3]. According to OpenGGSN project web page [2] the main design goals of OpenGGSN were stability, portability and scalability. The following design choices were made: Programmed in (ANSI) C in order to improve portability to other platforms.

Pg 50-3 Concurrency is implemented using a single select() loop in order to improve portability and at the same time achieve high throughput. Application was developed in userspace only. Provides good portability at the cost of performance. Performance can be increased by implementing user plane handling in kernel space. Conservative handling of memory allocation and error checking. Helps improve stability, but should be optimized for performance at a later stage. A typical architecture for installation of OpenGGSN is given below: Figure 2 A typical installation of OpenGGSN [2] Two different networks are involved in the architecture: Gi. The Gi network is the interface between the GGSN and an external data network. Access to the Gi network is controlled by the GGSN. Gi is typically the Internet or a corporate intranet. Gn. The Gn network is connecting the SGSN with the GGSN. It is used for tunneling IP packets between the SGSN and the GGSN as well as control plane traffic and management traffic (NMS). In the example above the Gn network is allocated the address range 172.16.0.0/24. The DNS servers on the Gn network are used used by the SGSN for determining the IP address of the GGSN. OpenGGSN provides 3 components: gtplib; a library, which contains all functionality relating to the GTP protocol. ggsn, which implements a Gateway GPRS Support Node. sgsnemu; an application, which emulates a Serving GPRS Support Node (SGSN). According to OpenGGSN developers OpenGGSN can be used for testing and developing new systems and equipment by mobile operators, infrastructure vendors, test equipment manufacturers, consultants, systems integrators and universities [2].

Pg 50-4 III Conducting the testing Testing was divided in several use cases where different methods and tools were used. Methods included robustness, black box and white box testing along with source code and execution analysis. Codenomicon GTP Test Tools Figure 3 illustrates the Linux based testing environment consisting of the OpenGGSN version 0.84-1 in a chroot environment to keep it in a separate "sandbox". Once the GGSN server was started it provided the implementation necessary for the testing. With the Codenomicon GTP Test Tools the test tool was run on a separate workstation connected with a cross over RJ-45 LAN cable directly to the workstation running the GGSN. Figure 3 GGSN test setup In order for the systems to communicate properly the testing host IP address was set to be in the same subnet as the GGSN and any firewalls on the machines were disabled. A direct connection was used so the robustness tests do not accidentally affect other devices like routers. The GTP test tools, containing more than 100,000 test cases, can be used to test the protocol implementation for development flaws using a unique fault injection technology. The test tool uses a black box approach for the security and robustness testing of products. [4] Flawfinder Flawfinder is a program that examines source code and reports possible security weaknesses ``flaws'' sorted by risk level. It can be used to find and remove some typical potential security problems.[5] Flawfinder was used to inspect the OpenGGSN sources for possible programming errors. The reported errors were then correlated with the results of the Codenomicon GTP test tool. RATS

Pg 50-5 RATS - Rough Auditing Tool for Security - is an open source tool for scanning C, C++, Perl, PHP and Python source code and flagging common security related programming errors such as buffer overflows and TOCTOU (Time Of Check, Time Of Use) race conditions. RATS can identify potential trouble spots on which to focus, along with describing the problem, and potentially suggest remedies. It also provides a relative assessment of the potential severity of each problem, to better help an auditor prioritize. [6] RATS was used to analyze the OpenGGSN sources for potential security problems. The reported problems were then correlated with the results of the Codenomicon GTP test tool. GCC Warnings Compilers can detect bad programming habits and warn about them. Compilers like GNU Compiler Collection (gcc) also support additional security related checks such as -Wformat-security and even fixes like -funsigned-char. [7] OpenGGSN sources were analyzed with gcc -Wall g compiler flags. Valgrind Valgrind is a tool for memory debugging, memory leak detection, and profiling. There are multiple tools included with Valgrind. Most known is the Memcheck which keeps track of the validity and addressability of memory. Memcheck can also detect off-by-one bugs where a program reads or writes outside an allocated block by a small amount. [8] OpenGGSN was run with Valgrind during a subset of Codenomicon GTP test. Gprof GNU profiler (gprof) is a performance analysis that investigates the behavior of a program using information gathered as the program runs, as opposed to static code analysis. The usual goal of performance analysis is to determine which parts of a program to optimize for speed or memory usage. Profilers use a wide variety of techniques to collect data, including hardware interrupts, code instrumentation, operating system hooks, and performance counters. [9] We ran into a problem with this tool as it requires the test target to call exit or return from the main function correctly to log the results. The default OpenGGSN implementation had only a crude timer based exit and no proper handling for signals generated for example from control-c key press (SIGINT) that was required to function correctly with the gprof. A proper signal handler had to be made to get the logging function correctly. Another unfortunate side effect was that the gprof tools internal timer signal interrupted a select loop and caused the OpenGGSN server to jam while reading data from an empty socket. This was due to improper signal handling in the GGSN implementation, which incorrectly trusted a file descriptor set (FDS) after select system call was interrupted by a signal and returned with an error value. After some heavy manual reading and debugging the error was found and fixed by clearing FDS if select returned an error.

Pg 50-6 Gcov GNU coverage tool (gcov) is a test coverage program that can be used to analyze programs efficiency and to discover untested parts of the program. Gcov can be used along with the other profiling tool, gprof, to assess which parts of the code use the greatest amount of computing time. Coverage tools can be used together with testsuites, to see how much of the program is exercised by the testsuite and what kinds of test cases need to be added to make sure software is tested thoroughly. [10] OpenGGSN was compiled with execution coverage logging -fprofile-arcs and -ftestcoverage from the GCC suite and tested against the Codenomicon GTP test suite. The build process was modified to use these variables. IV Test Results Test results were analyzed from the perspective of system developers with both software and hardware knowledge. Used methods include stress and robustness testing, white and black box testing combined with source code and execution analysis. Codenomicon GTP Test Tools During first tests, the Codenomicon GTP test tools reported problems in OpenGGSN. The tester and the test target were jammed to the last test case indicated by "possible denial of service" note. Testing and debugging reveled that this was caused by a bug in the GTPIE parsing routine. It was found that running any test case containing a message with more than 256 information elements in the payload caused the OpenGGSN to go into a infinite loop and thus causing an Denial of Service condition and unnecessary consumption of CPU resources. This bug required a complete restart of both the GTP test tool and the GGSN implementation. This made testing quite labor intensive as the testsuite contained thousands of test cases of which several consecutive tests failed. This triggered the need to fix the problem as illustrated in Figure 4.

Pg 50-7 The problem lies in the parsing of information elements in GTP messages, which is implemented in the gtpie_decaps function of gtp/gtpie.c file. The implementation has a bug that does not check if there are too many information elements in the message thus causing the software to loop infinitely in the while-loop. In addition, handling routine for the error situation had to be implemented outside the while-loop. --- openggsn-0.84.orig/gtp/gtpie.c +++ openggsn-0.84/gtp/gtpie.c @@ -188,7 +188,7 @@ memset(ie, 0, 4 * GTPIE_SIZE); - while (p<end) { + while ((p<end) && (j<gtpie_size)) { if (GTPIE_DEBUG) { printf("the packet looks like this:\n"); for( i=0; i<(end-p); i++) { @@ -346,6 +346,10 @@ (unsigned long) p, (unsigned long) end); return 0; /* We landed at the end of the packet: OK */ } + else if (!(j<gtpie_size)) { + if (GTPIE_DEBUG) printf("gtpie too many elements.\n"); + return EOF; /* We received too many information elements */ + } else { if (GTPIE_DEBUG) printf("gtpie exceeded end of packet. %lx %lx\n", (unsigned long) p, (unsigned long) end); Figure 4 Fix for the OpenGGSN DoS Once the GGSN implementation was fixed and we were able to execute the complete Codenomicon GTP testsuite we took the other tools into use. Flawfinder Flawfinder found several issues in the source code and these findings were manually checked for validity. Our analysis did not reveal any security problems and most of the flawfinder findings came from potentially bad C programming habits.

Pg 50-8 RATS RATS provided several warnings and suggestions for better coding practices but our analysis did not find any clear security problems. GCC Warnings None of the reported warnings seemed to be exploitable security related bugs and they were also very easily fixed. OpenGGSN could have some more protection against possible stack based buffer overflows by using a new GCC feature: -fstack-protector that checks and guards for buffer overflows, such as stack smashing attacks. Valgrind The only error found was a false positive since Valgrind did not understand a Linux system call correctly and falsely interpreted it as an error. Also, all of the 14 warnings were not bugs but bad programming habits and could be fixed by freeing memory before exit. Gprof Some improvement and optimization targets were identified but no action was taken as they were not security errors. The fixes done to get the tool running properly in the first place could have increased the overall quality of the GGSN but did very little in raising the security level. Only if the malicious person or program was already running with administrative lever rights they could have been utilized. Gcov Running gcov against the Codenomicon GTP test suite revealed that we did not get a full 100% coverage with testing although all the test cases in the GTP test suite passed. V Future work Unfortunately the OpenGGSN website has been abandoned and it is no longer available. The implementation is still available from sourceforge archives [11] and it provides a good test bed for various testing tools and methods. Some new tools such as Fuzzers could be tested with the now fixed implementation to see if new problems are found. Integrating the GGSN implementation in a real network with all the other relevant entities could also be an interesting experiment. It would also enable testing the system with real user load.

Pg 50-9 VI Conclusion A common problem with the source code scanners and analyzers is that they do not find all the errors and that they produce a vast amount of false positives. These tools can aid the developers but they do not replace manual code inspection. For example Flawfinder seems to be good for checking the source code tree for potentially bad habits, but that is all. The tool logs must be carefully analyzed since most of the warnings are not actual bugs. Also, Flawfinder does not like highly portable code, which relies on the most basic functions and system calls. Compilers and their inbuilt features are often forgotten. Authors should pay more attention to compiler warnings and fix the potential problems early on. Compilers also facilitate various security related features that can enhance the security of the programs simply by enabling the right compiler flags. The project group developed patches for some of the problems. These patches provided a fix to a remote Denial-of-Service condition in GTPIE parsing and signal- and select error path handling in ggsn.c, added stack protection, fixed signedness issues, freeing used memory at exit and updating the gengetopt command line option parser. A signal handler for the SIGINT signal (ctrl + c) was also added for successful usage of the GNU profiler tool. In the end the patched version of OpenGGSN: passed all the test cases with the Codenomicon GTP test suite [4], had no security problems to be found by Flawfinder [5], and did not leak any memory during robustness tests with Valgrind [8]. Despite all the testing we did not achieve a full testing coverage which is a clear sign that bugs might remain. We also learned that even though there are tools that are easy to use and produce lots of helpful data it only helps you if you know your how to utilize this information. Especially finding the root causes of the bugs and fixing them properly requires solid expertise. Testing and analyzing large open source implementations not only provide realistic test benches but also give something back to the open source community - if the testing and development results are shared. Too often the results are dismissed and forgotten due to the effort required to make it public or simply because fixing the target systems is not part of ones job or allowed by the companies. Sometimes the biggest problem is finding the right party to whom one can tell about the security issues. All these issues are manageable and the open source community is setting an example for the whole software industry how to do it. References [1] 3GPP (2006). TS 23.060 V7.2.0 General Packet Radio Service (GPRS) Service description. 3GPP, 10/2006. [2] OpenGGSN Project (2004). Web reference: http://web.archive.org/web/20040415073742/www.openggsn.org/.

Pg 50-10 [3] Jeong-Hyun, P. & Jong-Heung, P. (2006). Interworking between GPRS AND ISP for Wireless Internet Service of Mobile ISP Subscriber. Network Operations and Management Symposium, NOMS 2006. 10th IEEE/IFIP. no.pp. 1-4. [4] Codenomicon GTP Test Tool(2006). Web reference: http://www.codenomicon.com/brochures/codenomicon-gtp-test-tool.pdf/. [5] FlawFinder (2006). Web reference: http://www.dwheeler.com/flawfinder/. [6] RATS (2006). Web reference: http://www.securesoftware.com/resources/download_rats.html [7] GCC (2006) Web reference: http://gcc.gnu.org/ [8] Valgrind (2006). Web reference: http://valgrind.org/. [9] GNU gprof (2006) Web reference: http://www.gnu.org/software/binutils/manual/gprof- 2.9.1/html_chapter/gprof_toc.html. [10] gcov (2006). Web reference: http://gcc.gnu.org/onlinedocs/gcc/gcov-intro.html. [11] OpenGGSN (2006). Web reference: http://sourceforge.net/projects/ggsn/.