Remote Code Execution as System User on Samsung Phones
The Samsung keyboard app downloaded language pack updates over plain HTTP and validated them against a manifest that was also fetched insecurely, allowing a network attacker to supply a malicious zip. The zip could contain a path traversal to write files as the system user, and by overwriting a dalvik cache file for an auto-starting component, the attacker could execute code as the system user.
nowsecure.com
Published on nowsecure.com
NowSecure researchers, who specialize in mobile app security testing, discovered a remote attacker capable of controlling a user’s network traffic can manipulate the keyboard update mechanism on Samsung phones and execute code as a privileged (system) user on the target’s phone. This can be exploited in a manner that…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The update mechanism used plain HTTP for both the language pack zip and the manifest containing its SHA1 hash, so an attacker could replace both and bypass integrity checks; the zip extraction also allowed path traversal.
Impact
A remote attacker who can modify network traffic could execute code as the system user on affected Samsung phones without user interaction, but the exploit requires a device-specific odex payload and the attacker must be able to intercept traffic.
What the attacker needed
Attacker can modify network traffic; target uses Samsung device with vulnerable keyboard; device reboots or keyboard updates
The fix
The vulnerability was fixed according to the editor's note, but the text does not describe the fix; it should be fixed by using HTTPS for updates and validating the integrity of the manifest and zip files.
How it was found
- Set up a man-in-the-middle proxy to intercept the keyboard's HTTP traffic.
- Intercept the request for the language pack manifest and replace it with a crafted manifest containing the SHA1 of a malicious zip.
- Intercept the request for the language pack zip and serve the malicious zip containing a path traversal payload.
- The keyboard extracts the zip, writing the payload file to /data/payload as the system user.
- Compile a malicious odex file for a BroadcastReceiver that runs on boot, patch its CRC32 and modification time to match the original, and include it in the zip.
- After the zip is extracted and the device reboots, the malicious odex is loaded and executes the payload as the system user.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The keyboard app on some Samsung phones fetched updates over an unencrypted connection, so anyone who could tamper with the network could replace the update with their own file. Because the app ran with high privileges, the attacker could write files anywhere and then get their code to run automatically when the phone started.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.