tree: ae02afd2b01b73ebbecbde1c654f869bbdb62655 [path history] [tgz]
  1. Android.bp
  2. mediadrm_fuzzer.cpp

Fuzzer for libmediadrm

Plugin Design Considerations

The fuzzer plugin for libmediadrm is designed based on the understanding of the library and tries to achieve the following:

Maximize code coverage

The configuration parameters are not hardcoded, but instead selected based on incoming data. This ensures more code paths are reached by the fuzzer.

libmediadrm supports the following parameters:

  1. Security Level (parameter name: securityLevel)
  2. Mime Type (parameter name: mimeType)
  3. Key Type (parameter name: keyType)
  4. Crypto Mode (parameter name: cryptoMode)
ParameterValid ValuesConfigured Value
securityLevel0.DrmPlugin::kSecurityLevelUnknown 1.DrmPlugin::kSecurityLevelMax 2.DrmPlugin::kSecurityLevelSwSecureCrypto 3.DrmPlugin::kSecurityLevelSwSecureDecode 4.DrmPlugin::kSecurityLevelHwSecureCrypto 5.DrmPlugin::kSecurityLevelHwSecureDecode 6.DrmPlugin::kSecurityLevelHwSecureAllValue obtained from FuzzedDataProvider in the range 0 to 6 obtained from FuzzedDataProvider in the range 0 to 13
keyType0.DrmPlugin::kKeyType_Offline 1.DrmPlugin::kKeyType_Streaming 2.DrmPlugin::kKeyType_ReleaseValue obtained from FuzzedDataProvider in the range 0 to 2
cryptoMode0.CryptoPlugin::kMode_Unencrypted 1.CryptoPlugin::kMode_AES_CTR 2.CryptoPlugin::kMode_AES_WV 3.CryptoPlugin::kMode_AES_CBCValue obtained from FuzzedDataProvider in the range 0 to 3

This also ensures that the plugin is always deterministic for any given input.

Maximize utilization of input data

The plugin feeds the entire input data to the drm module. This ensures that the plugin tolerates any kind of input (empty, huge, malformed, etc) and doesnt exit() on any input and thereby increasing the chance of identifying vulnerabilities.


This describes steps to build mediadrm_fuzzer binary.


Steps to build

Build the fuzzer

  $ mm -j$(nproc) mediadrm_fuzzer

Steps to run

Create a directory CORPUS_DIR

  $ adb shell mkdir CORPUS_DIR

To run on device

  $ adb sync data
  $ adb shell /data/fuzz/${TARGET_ARCH}/mediadrm_fuzzer/mediadrm_fuzzer CORPUS_DIR