English follows Korean
- 동기
- Android의 CTS를 TC를 확인하면서, DRM항목 중 Clearkey TC에 관심이 생겼습니다. DRM은 디지털 콘텐츠의 무단 복제를 방지 하는 기술로, 저작권 보호에 핵심적인 역할을 합니다. 이 기술에 실제로 어떻게 작동하는지 궁금해서 다음과 같은 리소스도 참고 했습니다.
- tests/tests/media/src/android/media/cts/MediaDrmClearkeyTest.java – platform/cts – Git at Google (googlesource.com)
- DRM 이란 무엇인가?
- DRM은 ‘Digital Reights Management’의 약자로, 디지털 콘텐츠가 무단으로 복제 되거나, 배포되는 것을 방지 하는 기술입니다. 콘텐츠가 암호화 되어 있으며, 적법한 사용자만이 해당 콘텐츠를 볼수 있는 키를 받게 됩니다.
- https://source.android.com/docs/core/media/drm?hl=ko
- https://developers.google.com/widevine/drm/overview
- Clearkey와 Widevine
- Clearkey는 간단하고 비용 효율적인 DRM으로, 주로 보안 요구사항이 낮은 콘텐츠에 적용됩니다. 반면 Google에서 개발한 Widevine은 훨씬 높은 보안을 제공합니다. Widevine은 세가지 보안 수준(L1,L2,L3)를 가지며, 이는 HW와 SW사용 여부에 달라집니다. L1과 L2는 HW를 사용하여 보안을 강화하지만, L3는 소프트웨어만을 사용하고 보통 480p해상도 까지 지원 합니다.
- Coupang Play의DRM
- 현재 OTT는 Netflix, Disney, Tving, CoupangPlay, youtube 를 구독 중입니다. 최근 Coupang Play가 가격인상을 하였기에, 향후에도 계속 사용할지 모르겠습니다. 그래서 권한이 있을때 확인 해보고자 했습니다.
- Coupang Play 앱 간단 확인- 쿠팡플레이 – Google Play 앱
- 지난번 경험으로 앱의 리버싱은 지양 했습니다.
- Apache License 라이브러리가 사용 되었습니다. 다른 앱들처럼 아래와 같은 정보를 쉽게 찾아야 하는데, 이 앱에서는 못 찾았습니다.
- http://newrelic.com 과 http://braze.com 으로 뭔가를 보냅니다. 내가 하는 것도 모니터링 되려나.. 그래서 비디오를 다운로드 후에, Network를 다 끊고 PoC확인후에 Network 연결전에 다 삭제 했습니다.
- PoC환경 : 기존글 참고 – : AOSP11 이라 충분히 최신 버젼이고 arm도 지원가능해서 coupang play가 사용 가능합니다. – Building an AAOS emulator with GPS generator, GApps and built-in x86/ARM support
Coupang Play가 Widevine 방식인것을 알고 Widevine 에 대해서 좀 찾아 보았습니다.. L3는 과거에 한번 풀렸던거 같고, 현재는 보완이 된 것 같으나, 여전히 인터넷에서는 L3는 풀어 주는 앱이 있는것 같습니다. Reversing the old Widevine Content Decryption Module · tomer8007/widevine-l3-decryptor Wiki (github.com)
그냥 Clearykey 방식이나 실험 해보려고 한거고, Widevine은 할수 있는 영역은 아니라 중단하려다가 Video 덤프나 가능한지 확인 해보는 것으로 방향을 바꾸었습니다.
위 그림은 Widevine 구조도 이고, 우하단의 OEMCryto HAL이 widevine이 복호화후에 이것을 Media Out으로 보내줍니다.
MediaCodec | Android Developers
위그림은 코덱의 동작입니다. 복호화 데이터는 코덱 디코더로 가서 화면에 뿌려줍니다. 그래서 암호화는 내가 못 풀어도, 저 Input을 저장하면 복호화 데이터를 얻을수 있을것 같았습니다.
Codec 부분을 살펴 보고 나니 아래 부분을 동작하게 Define을 해주니깐..
이런 파일들을 얻을수 있습니다. 그리고 그냥 이 파일을 다운받아서 동작을 시키면…
Windows의 KMplayer 에서 그냥 영상이 나옵니다.
DRM 및 관련 자료를 찾는 사전 준비대비, 코덱 코드에 이미 DUMP 준비가 다 되어 있고, Define만 살렸더니 실험해보려던거가 한번에 되어서 좀 허망함이 있었습니다.
그러나 이번에 DRM의 구조 이해와 미디어쪽을 알게 되었습니다. 이론적으로는 FakeCodec과 같은 사용자 정의 코덱을 만들면 DRM 보호 데이터를 덤프 할수 있음을 확인 했습니다.
DRM으로 보호된 것을 사적 복사를 넘어선 제 3자에게 공유하는 것은 금지되어 있습니다. 그리고 다른 ID로 덤프해서 비교해보면 확실하겠지만, 아마 워터마크가 있을 것이고 이를 통한 추적도 가능 할것 입니다. 이러한 워터마크의 제거를 하려면 인코딩과 디코딩을 반복해서 해야 하고, 그러면 화질 저하가 발생하기 때문에 이것도 방법은 아닙니다..
English
- Motivation
- While stuying the Android CTS, I became interested in the ClearKey TC within DRM. DRM is a protective technology designed to prevent copying. I’ve reviewd below items.
- tests/tests/media/src/android/media/cts/MediaDrmClearkeyTest.java – platform/cts – Git at Google (googlesource.com)
- What is the DRM?
- DRM stands for ‘Digital Rights Management’ , a technology designed to prevent unauthrozied copying and distribution of digital content. And only authorized users recevied the key to access it.
- https://source.android.com/docs/core/media/drm?hl=ko
- https://developers.google.com/widevine/drm/overview
- Clearkey vs. Widevine
- Clearkey is a simple and cost efficient DRM solution, used for content with low security requirments. On the other hand, Widevine, developed by Google, offers much higher security. Widevine has three levels of security(L1,L2,L3) that depend on whether HW or SW is used. L1 and L2 enhances security by HW, L3 uses only SW and typically supports up to 480p resolution.
- Coupang Play with DRM
- With the recent price increase at Coupang Play, I’m unsure if I’ll continue my subscription. Therefore I hope to thoroughly invetigate the service while I sill have access.
- Coupang Play prelim check – 쿠팡플레이 – Google Play 앱
- Due to previous experience, I avoid using reverse engineering.
- Apache license is used. But unlike other apps, I can’t easily find information regarding it in this app.
- Some infomation is provied to http://newrelic.com and http://braze.com. Because of this, I proceeded with the network disconnected.
- PoC Environment: Refer previous article. – Building an AAOS emulator with GPS generator, GApps and built-in x86/ARM support
I’ve studied about Widevine because Coupang Play used it. L3 was cracked in the past, and there appears to still be an app available on the internet that can crack L3. Reversing the old Widevine Content Decryption Module · tomer8007/widevine-l3-decryptor Wiki (github.com)
Initially, I intened to experiment only with the ClearKey method. as studying Widevine seemd too challenging. However, rather than giving up, I decied to shift my focus to chekcing if video dumping was possible.
This is the Widevine architecture and lower-right HAL, known s OEMCrypto HAL, decrypts the data and tranfers it to Media Out.
MediaCodec | Android Developers
This is the codec architecture. The decrypted data is decoded by the codec and then displayed on screen. I may not be able to decrypt Widevine, I colud intercept and save the input to obtain the decrypted data.
After examing the codec section , I modified the following part to make it operational .
I can obtain these files. Then download and run them.
It plays on Windows KMPlayer.
I spend a long time studying DRM and gathering related materials. But simply enabling the ‘define’ was enough.
I’m not sure but there might be a WaterMark for tracking the content. So don’t share the content with others.