Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Managed Detection & Response

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

Co-Managed SOC (SIEM)

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

Advisory & Diagnostics

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

Penetration Testing

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

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

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

Digital Forensics & Incident Response

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

Firewall & Technology Management

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

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
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

Trustwave SpiderLabs: Insights and Solutions to Defend Educational Institutions Against Cyber Threats

Security teams responsible for defending educational institutions at higher education and primary school levels often find themselves facing harsh lessons from threat actors who exploit the numerous...

Read More

Breakdown of Tycoon Phishing-as-a-Service System

Just weeks after Trustwave SpiderLabs reported on the Greatness phishing-as-a-service (PaaS) framework, SpiderLabs’ Email Security team is tracking another PaaS called Tycoon Group.

Read More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising

During an Advanced Continual Threat Hunt (ACTH) investigation that took place in early December 2023, Trustwave SpiderLabs discovered Ov3r_Stealer, an infostealer distributed using Facebook...

Read More