• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

Android.bpD15-Dec-20244.8 KiB173166

README.mdD14-Jan-20247.7 KiB9380

libbt_audio_hal_a2dp_encoding_fuzzer.cppD15-Dec-20244.1 KiB12385

libbt_audio_hal_client_interface_fuzzer.cppD15-Dec-202418.3 KiB471378

libbt_audio_hal_hearing_aid_software_encoding_fuzzer.cppD15-Dec-20242.7 KiB8450

libbt_audio_hal_le_audio_software_fuzzer.cppD15-Dec-20243.7 KiB10973

README.md

1# Fuzzers for libbt-audio-hal-interface
2
3## Plugin Design Considerations
4The fuzzer plugins for `libbt-audio-hal-interface` are designed based on the understanding of the
5source code and tries to achieve the following:
6
7##### Maximize code coverage
8The configuration parameters are not hard-coded, but instead selected based on
9incoming data. This ensures more code paths are reached by the fuzzers.
10
11Fuzzers assigns values to the following parameters to pass on to libbt-audio-hal-interface:
121. A2DP Control Ack Status (parameter name: `status`)
132. A2DP supported codecs (parameter name: `index`)
143. Session Type  (parameter name: `sessionType`)
154. Session Type V2_1 (parameter name: `sessionType_2_1`)
165. Sample Rates (parameter name: `param.sampleRate`)
176. Sample Rates V2_1 (parameter name: `param.sampleRate`)
187. BTAV Sample Rates (parameter name: `a2dpCodecConfig.sample_rate`)
198. Bits per Sample (parameter name: `param.bitsPerSample`)
209. BTAV A2DP Codec Bits per Sample (parameter name: `a2dpCodecConfig.bits_per_sample`)
2110. Channel Mode (parameter name: `param.channelMode`)
2211. A2DP Codec Channel Mode (parameter name: `a2dpCodecConfig.channel_mode`)
2312. Sbc Subbands (parameter name: `sbc.numSubbands`)
2413. Sbc alloc methods (parameter name: `sbc.allocMethod `)
2514. Sbc Channel mode (parameter name: `sbc.channelMode `)
2615. Sbc Block Length (parameter name: `sbc.blockLength `)
2716. Aac Object Type  (parameter name: `aac.objectType`)
2817. Aac Variable Bit Rate (parameter name: `aac.variableBitRateEnabled`)
2918. Ldac Quality Index (parameter name: `ldac.qualityIndex`)
3019. Ldac Channel Mode (parameter name: `ldac.channelMode`)
3120. Codec Type (parameter name: `codecConfig.codecType`)
32
33| Parameter| Valid Values| Configured Value|
34|------------- |-------------| ----- |
35| `status` | 0.`A2DP_CTRL_ACK_SUCCESS` 1.`A2DP_CTRL_ACK_FAILURE` 2.`A2DP_CTRL_ACK_INCALL_FAILURE` 3.`A2DP_CTRL_ACK_UNSUPPORTED` 4.`A2DP_CTRL_ACK_PENDING` 5.`A2DP_CTRL_ACK_DISCONNECT_IN_PROGRESS` | Value obtained from FuzzedDataProvider |
36| `index` | 0.`BTAV_A2DP_CODEC_INDEX_SOURCE_SBC` 1.`BTAV_A2DP_CODEC_INDEX_SOURCE_AAC` 2.`BTAV_A2DP_CODEC_INDEX_SOURCE_APTX` 3.`BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD` 4.`BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC` 5.`BTAV_A2DP_CODEC_INDEX_SINK_SBC` 6.`BTAV_A2DP_CODEC_INDEX_SINK_AAC` 7.`BTAV_A2DP_CODEC_INDEX_SINK_LDAC` | Value obtained from FuzzedDataProvider |
37| `sessionType` | 0.`SessionType::UNKNOWN` 1.`SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH` 2.`SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH` 3.`SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH` | Value obtained from FuzzedDataProvider |
38| `sessionType_2_1` | 0.`SessionType_2_1::UNKNOWN` 1.`SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH` 2.`SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH` 3.`SessionType_2_1::HEARING_AID_SOFTWARE_ENCODING_DATAPATH` 4.`SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH` 5.`SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH` 6.`SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH` 7.`SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH` | Value obtained from FuzzedDataProvider |
39| `param.sampleRate` | 0.`SampleRate::RATE_UNKNOWN` 1.`SampleRate::RATE_8000` 2.`SampleRate::RATE_16000` 3.`SampleRate::RATE_24000` 4.`SampleRate::RATE_32000` 5.`SampleRate::RATE_44100` 6.`SampleRate::RATE_48000` | Value obtained from FuzzedDataProvider |
40| `param.sampleRate (V2_1)` | 0.`SampleRate_2_1::RATE_UNKNOWN` 1.`SampleRate_2_1::RATE_8000` 2.`SampleRate_2_1::RATE_16000` 3.`SampleRate_2_1::RATE_24000` 4.`SampleRate_2_1::RATE_32000` 5.`SampleRate_2_1::RATE_44100` 6.`SampleRate_2_1::RATE_48000` | Value obtained from FuzzedDataProvider |
41| `a2dpCodecConfig.sample_rate` | 0.`BTAV_A2DP_CODEC_SAMPLE_RATE_NONE` 1.`BTAV_A2DP_CODEC_SAMPLE_RATE_44100` 2.`BTAV_A2DP_CODEC_SAMPLE_RATE_48000` 3.`BTAV_A2DP_CODEC_SAMPLE_RATE_88200` 4.`BTAV_A2DP_CODEC_SAMPLE_RATE_96000` 5.`BTAV_A2DP_CODEC_SAMPLE_RATE_176400` 6.`BTAV_A2DP_CODEC_SAMPLE_RATE_192000` 7.`BTAV_A2DP_CODEC_SAMPLE_RATE_16000` 8.`BTAV_A2DP_CODEC_SAMPLE_RATE_24000` | Value obtained from FuzzedDataProvider |
42| `param.bitsPerSample` | 0.`BitsPerSample::BITS_UNKNOWN` 1.`BitsPerSample::BITS_16` 2.`BitsPerSample::BITS_24` 3.`BitsPerSample::BITS_32` | Value obtained from FuzzedDataProvider |
43| `a2dpCodecConfig.bits_per_sample` | 0.`BTAV_A2DP_CODEC_BITS_PER_SAMPLE_NONE` 1.`BTAV_A2DP_CODEC_BITS_PER_SAMPLE_16` 2.`BTAV_A2DP_CODEC_BITS_PER_SAMPLE_24` 3.`BTAV_A2DP_CODEC_BITS_PER_SAMPLE_32` | Value obtained from FuzzedDataProvider |
44| `param.channelMode` | 0.`ChannelMode::UNKNOWN` 1.`ChannelMode::MONO` 2.`ChannelMode::STEREO`  | Value obtained from FuzzedDataProvider |
45| `a2dpCodecConfig.channel_mode` | 0.`BTAV_A2DP_CODEC_CHANNEL_MODE_NONE` 1.`BTAV_A2DP_CODEC_CHANNEL_MODE_MONO` 2.`BTAV_A2DP_CODEC_CHANNEL_MODE_STEREO`  | Value obtained from FuzzedDataProvider |
46| `param.peerMtu` | 0.`660` 1.`663` 2.`883` 3.`1005` 4.`1500`  | Value obtained from FuzzedDataProvider |
47| `sbc.numSubbands` | 0.`SbcNumSubbands::SUBBAND_4` 1.`SbcNumSubbands::SUBBAND_8` | Value obtained from FuzzedDataProvider |
48| `sbc.allocMethod` | 0.`SbcAllocMethod::ALLOC_MD_S` 1.`SbcAllocMethod::ALLOC_MD_L` | Value obtained from FuzzedDataProvider |
49| `sbc.channelMode ` | 0.`SbcChannelMode::UNKNOWN` 1.`SbcChannelMode::JOINT_STEREO` 2.`SbcChannelMode::STEREO` 3.`SbcChannelMode::DUAL` 4.`SbcChannelMode::MONO`  | Value obtained from FuzzedDataProvider |
50| `sbc.blockLength ` | 0.`SbcBlockLength::BLOCKS_4` 1.`SbcBlockLength::BLOCKS_8` 2.`SbcBlockLength::BLOCKS_12` 3.`SbcBlockLength::BLOCKS_16` | Value obtained from FuzzedDataProvider |
51| `aac.objectType` | 0.`AacObjectType::MPEG2_LC` 1.`AacObjectType::MPEG4_LC` 2.`AacObjectType::MPEG4_LTP` 3.`AacObjectType::MPEG4_SCALABLE` | Value obtained from FuzzedDataProvider |
52| `aac.variableBitRateEnabled` | 0.`AacVariableBitRate::DISABLED` 1.`AacVariableBitRate::ENABLED` | Value obtained from FuzzedDataProvider |
53| `ldac.qualityIndex` | 0.`LdacQualityIndex::QUALITY_HIGH` 1.`LdacQualityIndex::QUALITY_MID` 2.`LdacQualityIndex::QUALITY_LOW` 3.`LdacQualityIndex::QUALITY_ABR` | Value obtained from FuzzedDataProvider |
54| `ldac.channelMode ` | 0.`LdacChannelMode::UNKNOWN` 1.`LdacChannelMode::STEREO` 2.`LdacChannelMode::DUAL` 3.`LdacChannelMode::MONO` | Value obtained from FuzzedDataProvider |
55| `codecConfig.codecType` | 0.`CodecType::APTX` 1.`CodecType::APTX_HD` | Value obtained from FuzzedDataProvider |
56
57This also ensures that the plugins are always deterministic for any given input.
58
59##### Maximize utilization of input data
60The plugins feed the entire input data to the module.
61This ensures that the plugins tolerates any kind of input (empty, huge,
62malformed, etc) and doesn't `exit()` on any input and thereby increasing the
63chance of identifying vulnerabilities.
64
65## Build
66
67This describes steps to build libbt_audio_hal_a2dp_encoding_fuzzer, libbt_audio_hal_le_audio_software_fuzzer, libbt_audio_hal_hearing_aid_software_encoding_fuzzer and libbt_audio_hal_client_interface_fuzzer binaries.
68
69### Android
70
71#### Steps to build
72Build the fuzzer
73```
74  $ mm -j$(nproc) libbt_audio_hal_a2dp_encoding_fuzzer
75  $ mm -j$(nproc) libbt_audio_hal_le_audio_software_fuzzer
76  $ mm -j$(nproc) libbt_audio_hal_hearing_aid_software_encoding_fuzzer
77  $ mm -j$(nproc) libbt_audio_hal_client_interface_fuzzer
78```
79### Steps to run
80
81To run on device
82```
83  $ adb sync data
84  $ adb shell /data/fuzz/arm64/libbt_audio_hal_a2dp_encoding_fuzzer/libbt_audio_hal_a2dp_encoding_fuzzer
85  $ adb shell /data/fuzz/arm64/libbt_audio_hal_le_audio_software_fuzzer/libbt_audio_hal_le_audio_software_fuzzer
86  $ adb shell /data/fuzz/arm64/libbt_audio_hal_hearing_aid_software_encoding_fuzzer/libbt_audio_hal_hearing_aid_software_encoding_fuzzer
87  $ adb shell /data/fuzz/arm64/libbt_audio_hal_client_interface_fuzzer/libbt_audio_hal_client_interface_fuzzer
88```
89
90## References:
91 * http://llvm.org/docs/LibFuzzer.html
92 * https://github.com/google/oss-fuzz
93