2016
12.14

As a part of the KNOX extensions available on Samsung devices, Samsung provides a TrustZone trustlet which allows the generation of OTP tokens. The tokens themselves are generated in a TrustZone application within the TEE (UID: fffffffff0000000000000000000001e), which can be communicated with using the “OTP” service, published by “otp_server”. Many of the internal commands supported by the trustlet must either unwrap or wrap a token. They do so by calling the functions “otp_unwrap” and “otp_wrap”, correspondingly. Both functions copy the internal token data to a local stack based buffer before attempting to wrap or unwrap it. However, this copy operation is performed using a length field supplied in the user’s buffer (the length field’s offset changes according to the calling code-path), which is not validated at all. This means an attacker can supply a length field larger than the stack based buffer, causing the user-controlled token data to overflow the stack buffer. There is no stack cookie mitigation in MobiCore trustlets. On the device I’m working on (SM-G925V), the “OTP” service can be accessed from any user, including from the SELinux context “untrusted_app”. Successfully exploiting this vulnerability should allow a user to elevate privileges to the TrustZone TEE.

No Comment.

Add Your Comment

You must be logged in to post a comment.