Android Camera Bug Under the Microscope
Critical Android vulnerability CVE-2019-2234 could enable attackers to take control of a victim's camera and take photos, record videos, and learn location.
Before it was patched last year, critical Android vulnerability CVE-2020-2234 could have given attackers the means to access the camera app in some smartphones from vendors including Google and Samsung. A criminal could exploit this to take photos, record videos and audio, or learn the victim's location without their knowledge or consent.
This vulnerability could be exploited even if the phone was locked, its screen was turned off, or if the person was on a call, explained Erez Yalon, director of security research at Checkmarx, where a team of researchers discovered the flaw last summer. Yalon offered a hacker's perspective of discovering and reporting the flaw in a talk at this year's virtual Black Hat Asia.
He began his discussion of the permission bypass vulnerability with a simple command to the Google personal assistant (PA): "Take a selfie," he said.
These commands have two kinds of intent: "explicit intent" calls for a specific action by a specific application. This command had "implicit intent," meaning when a user voices the command, an app will interpret and act on it. In this case, the PA set an intent for a selfie; the camera app caught it and opened the camera.
Because this involves communication between applications, some permissions must be in place for that to unfold. "The purpose of permissions is to protect the privacy of an Android user, and Android apps must request permission to access certain system features such as camera and Internet," he said.
There are several steps a developer has to take to ensure permissions are implemented: they must declare the need for permissions, then check whether the permission is granted. If it's not, they must request access to camera, contacts, or whatever the app needs. To discover this bug, researchers had to dig to learn where permissions should have been enabled but were not.
Finding the Flaw
The first step to finding a hole in any system is typically rooting through a lot of code, Yalon explained. In this case, they began by analyzing exported activities, which are activities that can be called and matched to an intent. Each activity has several attributes; however, the export "true" or "false" will indicate whether a particular activity will be exported or not, he said.
Google's camera app provided many exported activities, which makes sense because it interacts with several different apps, he continued. Yalon and his team of researchers investigated further and noticed these activities mapped into different classes.
"When we dug inside this code, we managed to find different actions inside these classes, but not all of them are protected," Yalon explained. "We were looking for the classes and actions that did not have permission checks, and we actually found some."
The camera did care who took a photo, they learned, but didn't check for the same permissions when starting the video camera, which immediately began recording – no questions asked; no permissions needed. They also found they didn't need permissions to switch between the front-facing and back-facing cameras.
While taking a photo was tricker sans permissions, it wasn't impossible. Researchers found by using the photo timer, they could bypass the permissions requirement and snap a picture.
With these findings, they decided to build a rogue application that could exploit these flaws while hiding inside another benign application. This rogue app, dubbed Spyxel, was purely for research purposes and never appeared on Google Play. Spyxel did not require any special permissions or access but could still take picture or videos at will, Yalon said. The researchers built in a background process to ensure the app would remain persistent at all times.
How Spyxel Remained Stealth
There were a few issues with keeping this malicious app under wraps. The camera app usually appears onscreen, it makes a shutter sound when taking a photo, and it stores media on the user's device – a clear sign that something could be wrong.
To bypass the first hurdle, researchers requested the rogue app to only record images or video when the user's screen was covered. The smartphone's proximity sensor can tell when something is close to the screen and detects when it's turned upside down or slipped into a pocket. With this step, Spyxel would only record when the user isn't paying attention.
The shutter proved a challenge. "The phone cannot be muted without the right permission, and that makes sense," said Yalon. "You don't want any application to shut up your phone."
While the researchers weren't able to mute the shutter sound entirely, they found that without any permissions they could lower the volume until it reached complete silence. This was a clear issue, given muting wasn't possible without permission, and Google issued another CVE for the problem.
Most applications on Google Play use storage permissions; the camera app uses these to store media files. This was the only permission the team felt good about using in their rogue app, since most people grant storage permissions to smartphone applications.
This also provided a segue into learning victims' location. Most pictures and videos have a location geotag embedded in the metadata, Yalon explained. It's turned on by default in most phones and in this case, gave the researchers a lot of information. They found they could use the metadata inside the pictures to keep tabs on a target phone.
"We actually evolved the targeted phone into a tracking device," Yalon says. With a list of photos and videos, and their specific geolocation data, researchers could plot the phone's movements over time. All they would need is a victim to download the rogue app and run it once, so it could stay persistent in the background.
Checkmarx reported the vulnerability to Google in July 2019. It was first rated as moderate by Google but later updated to severe following a demonstration and feedback from the Checkmarx team. In August, Google issued CVE-2019-2234 and contacted other Android phone vendors who may have been exposed. Samsung was the only vendor to confirm it was affected.
Read more about:
Black Hat NewsAbout the Author
You May Also Like
A Cyber Pros' Guide to Navigating Emerging Privacy Regulation
Dec 10, 2024Identifying the Cybersecurity Metrics that Actually Matter
Dec 11, 2024The Current State of AI Adoption in Cybersecurity, Including its Opportunities
Dec 12, 2024Cybersecurity Day: How to Automate Security Analytics with AI and ML
Dec 17, 2024The Dirt on ROT Data
Dec 18, 2024