Smartphone Network Connection Monitoring
Tools for monitoring and modifying connections between web browsers and web servers are essential for debugging, testing, optimizing performance, and assessing vulnerabilities of web-based applications and native applications. Developers, security professionals, and anyone with an interest in gaining insight into the lower levels of web traffic commonly use these tools.
There are many mature options for monitoring connections from desktop machines. Unfortunately, there are fewer tools to monitor connections on smartphones and these tools often require more complex configurations, as the monitoring software must run on a separate device. In this article, I present an overview of tools and methods for monitoring network connections on Smartphones including devices based on Apple’s iOS–iPhone, iPod Touch, iPad), Google’s Android OS, BlackBerry OS, and Symbian. This article focuses on inspecting HTTP and HTTPS traffic, although many of the tools and techniques described work equally well to analyze other protocols.
This article is the first part in a series: The articles in the series include:
- An overview of the tools and techniques for monitoring smartphone network connection
- Pros, cons, and limitations for monitoring smartphone network connections
- Network monitoring for security analysis and self-defense
Why Monitoring is Useful
Potential use cases for monitoring HTTP and HTTPS traffic–the two primary protocols of the Web:
- Inspecting network traffic often simplifies debugging AJAX XMLHttpRequest requests, compressed content encoding, and cookies.
- Network connection details such as number of HTTP requests, DNS lookups, cache hits are also valuable for optimizing web application performance.
- Many tools allow modifying requests and responses to simulate valid and invalid user input when testing applications for vulnerability analysis in addition to monitoring.
- Network monitoring is an effective way to verify that a smartphone application securely handles user authentication and identify any inappropriate transmission of personally identifiable information such as unique identifiers and location.
- Inspecting and modifying network traffic is essential for security analysis. For example, searching for Cross Site Scripting (XSS), SQL injection, and path traversal vulnerabilities.
Types of Monitoring Tools
Common network monitoring tools come in four major varieties: browser-based development tools, general purpose packet sniffers and network protocol analyzers, specialized HTTP/HTTPS sniffers, and specialized web proxies for debugging and security analysis.
Each type of tool has advantages and disadvantages, but there is no requirement to use a single type and combinations of tools may offer more power and flexibility. This list is in no way comprehensive, there are many specialized and hybrid tools for monitoring connections.
- Browser-based development tools such as the WebKit Web Inspector in Safari and Chrome or the Firebug LiveHTTPHeaders extensions for Firefox
- General purpose packet sniffers such as the cross-platform Wireshark, Colasoft Capsa Network Analyzer and the venerable command line tcpdump
- Specialized HTTP/HTTPS sniffers such as HTTP Scoop on the Mac OS X or IEInspector HTTP Analyzer on Windows
- Specialized web proxies used for debugging and security analysis such as the Java-based cross-platform Charles Web Debugging Proxy, Andiparos (an actively developed fork of the Paros Proxy), Burp Proxy and the .NET-based Fiddler2 Web Debugging Proxy for Windows.
- Server access logs are also useful for debugging. Think of them a bonus fifth tool.
Two LiveCD Linux distributions contain a large number of tools optimized for penetration testing a subset of which is useful for network connection monitoring. BackTrack Linux is a very well-regarded distribution. AppSecLive the OWASP Live CD Project–soon to be known as the OWASP Web Testing Environment (WTE)–is another respected collection.
See the Top 100 Network Security Tools from SecTools.org provides a larger list.
Configurations for Monitoring
I’ll talk more about the constraints and pros and cons for each option in the second piece of this article, but briefly here are several potential configurations for monitoring.
- Simulators allow the simplest configurations where the simulator and the monitoring software run on the same machine and share a common network interface.
- Web proxies are a convenient option as all modern browsers supported them and only require a small change in the browser settings rather than a change in the network configuration.
- Ad-hoc networks combined with internet connection sharing are one method to gain access to traffic. If the network monitoring host is located between the mobile device and the internet, it will typically require two network interfaces, usually one wired and one wireless.
- Network hubs are one method to work around the problems with common switched network configurations.
Limitations for Monitoring
There are significant constraints for monitoring network connections. I’m specifically talking about WiFi-based traffic and not cellular traffic. Monitoring cellular traffic is substantially more complicated and requires specialized equipment. In nearly every case, all important web-related traffic will travel over WiFi if the cellular data connection is disabled on the device.
Limited software is one constraint. For example, there is currently no way to run Webkit Web Inspector, Firebug or LiveHTTPHeaders directly on a Smartphone. Limited networking options is adds another constraint as well as added complexity to the monitoring configuration. Typically, smartphones must communicate over wireless connections rather than wired connections, which eliminates some options for monitoring network traffic. Most modern network hardware is switched, which further limits the ability to access the traffic, even when an access point is plugged into a wired network. Additionally, wireless access points protected by WPA/WPA2 encryption employ per-user keys difficulties in sniffing are similar to switched networks.
Finally, monitoring connections encrypted with SSL/TLS also requires more complex configurations. The most straightforward option involves adding a new Certificate Authority to the trusted list in the browser. This effectively creates a man-in-the-middle attack for the browser that allows decryption of the HTTPS traffic. The browser will produce a series of warning messages, but it will be possible to view the encrypted traffic.