Pentest Tools

Published on April 13th, 2016 📆 | 5909 Views ⚑


MFFA — Android Media Fuzzing Framework

The main idea behind this project is to create corrupt but structurally valid media files, direct them to the appropriate software components in Android to be decoded and/or played and monitor the system for potential issues (i.e system crashes) that may lead to exploitable vulnerabilities. Custom developed Python scripts are used to send the malformed data across a distributed infrastructure of Android devices, log the findings and monitor for possible issues, in an automated manner. The actual decoding of the media files on the Android devices is done using the Stagefright command line interface. The results are sorted out, in an attempt to find only the unique issues, using a custom built triage mechanism.


System and device configuration

The tool has been developed to be used inside a Linux environment.

For the device(s) under test the main problem is including the stagefright command line tool in the Android image that will be flashed on the device(s) or simply building the stagefright module and pushing it to the device.

There are three alternatives for achieving this goal:

  1. if you are building an Android engineering image, you can directly modify the file corresponding to the stagefright module. For that you need to go to frameworks/av/cmds/stagefright/ and edit the file by looking for the LOCAL_MODULE:=stagefright entry and modifying its corresponding LOCAL_MODULE_TAGS entry from optional to eng. Note that this will NOT work if you are trying to build an user or userdebug Android image.
    #LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= stagefright
  1. the second alternative is to go to device// and modify the file by adding the stagefright module to the PRODUCT_PACKAGES entry
  1. Another alternative, and the most straight-forward that doesn’t require building the entire image would be to go to the stagefright directory inside the Android tree (frameworks/av/cmds/stagefright) and build only the stagefright module using:
    mma (or alternatively)
    mma -B


Tool configuration

Before starting the actual fuzzing campaign there are several configuration files that need to be taken care of:

  1. Firstly, you need to manually run adb devices > devices.txt to populate the devices.txt config file with the ids of the Android devices that will be used during testing
  2. Secondly, you need to write the batches.txt so that it contains the list of the directories containing the fuzzed input media files


Running a fuzzing campaign

Having configured these two files you can start the fuzzing campaign by issuing the following command:

 python stagefright <video|audio> <play|noplay> <index>
    <video|audio> the media batches tested are audio or video files
    <play|noplay> in case of audio testing, try to also test the playback functionality of the framework or not
    <index>       in case you stop the fuzzing campaign at a certain index, you can restart from that certain point (for new campaigns use 0)

During the fuzzing process, a separate log will be created for each device in the testing infrastructure. The logs are updated real-time so you can check out partial results during the actual testing.

[adsense size='1']

Running a bug triage campaign

The triage mechanism will take the generated logs from the actual fuzzing phase, identify the crashing test cases, resend them to the devices, check if the issues have been encountered before and store the unique bugs. Before starting the actual triage process, you need to copy the generated logs to the root directory of the triage scripts. Also you need to populate the logs.txt config file with the file names of the logs, one per each line.

To start the triage process you need to issue the following command:

python <SIGSEGV|SIGILL|SIGFPE|all> <video|audio>
    <SIGSEGV|SIGILL|SIGFPE|all> - type of signal to look out for
    <video|audio>               - the media batches that were tested are audio or video files


Android Media Fuzzing Framework

Android Media Fuzzing Framework: MFFA presentation


Source && Download

Leave a Reply

Your email address will not be published.