Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Touchlogging Part 1 - iOS

Although there have been numerous articles posted, I thought I would write about my recent presentation at the RSA Conference on the subject of touchlogging.

Since many people have asked, I got the term touchlogging from this paper. I do not know if it has been used before, but I decided it was a good name for my presentation.

The idea for the project came from a penetration testing engagement for which we compared financial malware on the Windows platform with (potential) malware on mobile platforms. The goal was to find the various components that allowed the malware to capture financial data and see whether it could be moved to the mobile platforms. It was quickly realized that the key component was the keylogging mechanism.

A lot of apps on mobile platforms already avoid using the built-in keyboard so a keylogger for mobile cannot simply hook the keyboard. Instead, all touch events need to be recorded. It should be noted that hooking the keyboard on jailbroken iOS is not very difficult. Well, I guess nothing is difficult when you know what to do, have the skills to do it and have root access to the device!

The difference for me between keylogging and touchlogging is that when you are touchlogging, you record the X and Y coordinates of where the touch occured on the screen. If you are keylogging, you get the actual key that was pressed. This means that when touchlogging there is an additional step required to figure out what was pressed since the coordinates themselves cannot give you that information. This can be done either by combining the coordinates with screenshots or using some other logic. A simple example is that if the device has not been used for some time, one can make the assumption that the first thing entered is the pin code to unlock the device.

There is a great benefit on mobile platforms to perform touchlogging instead of keylogging. It is not possible to bypass touchlogging by using custom keyboards or using gestures. The user must input the information through the touchscreen which means the touchlogger will capture the information (I know there are other ways, but the vast majority of people input all information through the touchscreen).

So, how do we actually accomplish this on iOS? How do we get the X and Y coordinate of the touch event?

For jailbroken iOS, Method Swizzling is a good way. A semi-accurate explanation of method swizzling is that it is like a man-in-the-middle attack but for methods rather then network traffic. Swizzling just three methods from the UIResponder class provides the X and Y coordinates for most touch events on the device. These can either be logged or sent to a remote server. They can of course also be combined with screenshots. I actually wrote a server that takes screenshots on one port, collects coordinates on another and then overlays the screenshots with the coordinates.

I actually never really tried doing the same on non-jailbroken devices, thinking it would be close to impossible to get it through appstore review. However, FireEye proved me wrong.

In the end, I think there are more ways of recording touch events than what I have shown here. FireEye of course found a way that I had missed, and I would not be surprised if new ways are found in the future. It should be noted that the purpose of my work was to show this attack vector, so that people/companies with high security requirements are aware of it. I did not try to weaponize the attack or make it stealthy.

If you are an app developer and want to defend against this type of attack, it is possible to detect swizzled methods. I believe this is something all apps with high security requirements should do. Detecting swizzled methods will not only protect against this touchlogging attack but also other attacks which are possible through method swizzling.

This is a video that was recorded with SC Magazine, where I demonstrate the attack (on Android, but same applies to iOS).

Latest SpiderLabs Blogs

Clockwork Blue: Automating Security Defenses with SOAR and AI

It’s impractical to operate security operations alone, using manual human processes. Finding opportunities to automate SecOps is an underlying foundation of Zero Trust and an essential architecture...

Read More

Professional Services Sector Under Attack - Trustwave SpiderLabs Report 2024

Recent research by Trustwave SpiderLabs, detailed in their newly published report "2024 Professional Services Threat Landscape: Trustwave Threat Intelligence Briefing and Mitigation Strategies,"...

Read More

Atlas Oil: The Consequences of a Ransomware Attack

Overview Atlas Oil, a major player in the oil and fuel distribution industry, fell victim to a ransomware attack orchestrated by the Black Basta group. This attack not only compromised sensitive...

Read More