New issue
Advanced search Search tips
Starred by 4 users
Status: Fixed
Owner:
Closed: Jan 2017
Cc:



Sign in to add a comment
Samsung: Heap overflow in "OTP" service on Samsung devices
Project Member Reported by laginimaineb@google.com, Sep 12 2016 Back to list
As a part of the KNOX extensions available on Samsung devices, Samsung provides a new service which allows the generation of OTP tokens.

The tokens themselves are generated in a TrustZone application within the TEE (UID: fffffffff0000000000000000000001e). However, in order to allow easy communication between the Non-secure World (NWD) and the Secure-World (SW) trustlet, a new server has been created. This server, called "otp_server", publishes a binder service called "OTP". 

The service provides a single command via binder (command code 2), which allows a client to provide a buffer from the NWD to be sent to the SW. The requests are serialized to the parcel as a 32-bit length field, followed by the actual request data.

However, "otp_server" does not validate the request length field at all, allowing an attacker to specify any value. This length field is then used in a "memcpy" call in order to copy the data from the parcel to an internal heap-allocated buffer.

On the device I'm working on (SM-G925V), the "OTP" service can be accessed from any user, and the "otp_server" process runs with UID system and context "u:r:otp_server:s0".

I've attached a small PoC which can be used to trigger the overflow. Running it should crash "otp_server".

This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.

 
MainActivity.java
1.3 KB View Download
Project Member Comment 1 by laginimaineb@google.com, Dec 12 2016
Labels: -Restrict-View-Commit Deadline-Exceeded
Status: Started
Samsung has started rolling out the fix this month. Deadline exceeded -- automatically derestricting.
Project Member Comment 2 by laginimaineb@google.com, Dec 31 2016
Labels: SVE-2016-7114
Project Member Comment 3 by laginimaineb@google.com, Jan 3 2017
Status: New
Newest version (G925VVRU4CPK2_G925VVZW4CPK2_VZW) remains unpatched.
Project Member Comment 4 by laginimaineb@google.com, Jan 4 2017
Status: Fixed
G925VVRU4CPK2_G925VVZW4CPK2_VZW was on the November SMR -- verified fix on G930FXXU1BPLB_G930FUUB1BPL4_UPO.
Comment 5 Deleted
Project Member Comment 6 by laginimaineb@google.com, Feb 3 2017
Summary: Samsung: Heap overflow in "OTP" service on Samsung devices (was: Heap overflow in "OTP" service on Samsung devices)
Sign in to add a comment