Learning From The Old Exynos Trustlet Bug
The Widevine Trustlet on Samsung Exynos devices copied a hash error code into shared memory using a memcpy whose source, destination and length were all attacker-controlled, allowing arbitrary read and write of secure-world memory. An attacker with local privileges could leak sensitive data from Widevine shared memory and potentially corrupt memory in the trusted application.
Published on systemweakness.com
Today, we will be revisiting an old vulnerability that was disclosed back in 2020. This is just an Arbitrary Memory Read/Write Vulnerability found within a Widevine Trustlet (Trusted Application — TA) on Samsung Exynos-based phones running Android 8.0 through Android 10.
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
Likely the trustlet failed to validate the caller-supplied source pointer, destination pointer and length before calling memcpy, instead of copying a fixed 4-byte error code.
Impact
An attacker with local privileges on an affected Exynos device could read sensitive data from Widevine shared memory and write to trusted memory, though the author notes this alone is not enough to compromise the TEEGRIS kernel and must be chained with other bugs.
What the attacker needed
Local privileges (rooted device); ability to load a patched client library; affected Exynos device with old Widevine TA
The fix
The vendor fixed it by adding a proper range check on the accessible memory and limiting the copy to a fixed 4-byte hash error code.
How it was found
- Identify the vulnerable memcpy in the Android 10 Widevine TA by comparing it with the patched Android 12 TA.
- Trace the GetHashErrorCode function back to its command ID 0x1108 entry point.
- Patch libteecl.so so it loads the older TA image from a writable directory instead of the system tee folder.
- Push the old TA image and the patched library to the device and run the PoC executable.
- Invoke command 0x1108 with a chosen source pointer and length, then dump the shared memory buffer to see the copied data.
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.
A phone has a normal Android side and a separate, more protected chip area called the trusted execution environment, which handles things like DRM keys and fingerprint checks. A small program inside that protected area, the Widevine Trustlet, copied a value into a shared buffer but let the caller choose where to read from, where to write, and how many bytes. That means a malicious app on the normal side could ask it to copy memory it should never see, or overwrite memory it should not touch.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.