The fuzzer plugin for GSM is designed based on the understanding of the codec and tries to achieve the following:
The configuration parameters are not hardcoded, but instead selected based on incoming data. This ensures more code paths are reached by the fuzzer.
GSM supports the following options:
GSM_VERBOSE
)GSM_OPT_FAST
)GSM_OPT_WAV49
)GSM_OPT_LTP_CUT
)Parameter | Valid Values | Configured Value |
---|---|---|
GSM_VERBOSE | 0. Verbosity disabled 1. Verbosity enabled | Bit 0 (LSB) of 1st byte of data. |
GSM_OPT_FAST | 0. Regular algorithm will be used 1. Faster version of the algorithm will be used | Bit 1 (LSB) of 1st byte of data. |
GSM_OPT_LTP_CUT | 0. Disable LTP cut-off optimization 1. Enable LTP cut-off optimization | Bit 2 (LSB) of 1st byte of data. |
GSM_OPT_WAV49 | 0. Disable WAV49 output in the encoder. 1. Enable WAV49 format in the encoder. | Bit 3 (LSB) of 1st byte of data. |
This also ensures that the plugin is always deterministic for any given input.
The plugin feeds the entire input data to the codec using a loop.
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 gsm_dec_fuzzer and gsm_enc_fuzzer binaries.
Build the fuzzer
$ mm -j$(nproc) gsm_dec_fuzzer $ mm -j$(nproc) gsm_enc_fuzzer
Create a directory CORPUS_DIR and copy some gsm files (decoder)/raw files (encoder) to that folder Push this directory to device.
To run on device
$ adb sync data $ adb shell /data/fuzz/arm64/gsm_dec_fuzzer/gsm_dec_fuzzer CORPUS_DIR $ adb shell /data/fuzz/arm64/gsm_enc_fuzzer/gsm_enc_fuzzer CORPUS_DIR
To run on host
$ $ANDROID_HOST_OUT/fuzz/x86_64/gsm_dec_fuzzer/gsm_dec_fuzzer CORPUS_DIR $ $ANDROID_HOST_OUT/fuzz/x86_64/gsm_enc_fuzzer/gsm_enc_fuzzer CORPUS_DIR