-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fuzz: add a new fuzzer to test TLS certificates (ntop#1901)
- Loading branch information
Showing
21 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions
1
fuzz/corpus/fuzz_tls_certificate/25bb24bf6b2dbe8357e10cd3a38f157c5b154115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�H� |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions
1
fuzz/corpus/fuzz_tls_certificate/69cbc51f584260bfa23cba82f5fec7ce81237e26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
��0���0 |
Binary file not shown.
1 change: 1 addition & 0 deletions
1
fuzz/corpus/fuzz_tls_certificate/7cf184f4c67ad58283ecb19349720b0cae756829
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
H |
Binary file not shown.
1 change: 1 addition & 0 deletions
1
fuzz/corpus/fuzz_tls_certificate/85f065f6c019d131ffe4e2bef840af10af47a097
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�H�, |
Binary file not shown.
Binary file added
BIN
+34 Bytes
fuzz/corpus/fuzz_tls_certificate/e276406b98ab53e543fe58b5c2aa124f3bda868c
Binary file not shown.
1 change: 1 addition & 0 deletions
1
fuzz/corpus/fuzz_tls_certificate/e414032ad5cb3ae242e73b6f218bc481dcc97a59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0��0���00� |
1 change: 1 addition & 0 deletions
1
fuzz/corpus/fuzz_tls_certificate/fb77b8f6d4ed7940dc0e2a5af6ec28c7ac81c84c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
H� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"\x55\x04\x03" | ||
"\x55\x04\x06" | ||
"\x55\x04\x07" | ||
"\x55\x04\x08" | ||
"\x55\x04\x0A" | ||
"\x55\x04\x0B" | ||
"\x30\x1E\x17" | ||
"\x55\x1D\x11" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#define NDPI_LIB_COMPILATION | ||
|
||
#include "ndpi_api.h" | ||
#include "fuzz_common_code.h" | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
extern void processCertificateElements(struct ndpi_detection_module_struct *ndpi_struct, | ||
struct ndpi_flow_struct *flow, | ||
u_int16_t p_offset, u_int16_t certificate_len); | ||
struct ndpi_tcphdr tcph; | ||
struct ndpi_iphdr iph; | ||
struct ndpi_ipv6hdr iphv6; | ||
|
||
struct ndpi_detection_module_struct *ndpi_struct = NULL; | ||
struct ndpi_flow_struct *ndpi_flow = NULL; | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||
struct ndpi_packet_struct *packet; | ||
int is_ipv6; | ||
|
||
if (ndpi_struct == NULL) { | ||
fuzz_init_detection_module(&ndpi_struct); | ||
ndpi_flow = ndpi_calloc(1, sizeof(struct ndpi_flow_struct)); | ||
} | ||
|
||
if(size == 0) | ||
return -1; | ||
|
||
packet = &ndpi_struct->packet; | ||
packet->payload = data; | ||
packet->payload_packet_len = size; | ||
is_ipv6 = data[size - 1] % 5 ? 1 : 0; /* "Random" ipv4 vs ipv6 */ | ||
packet->iphv6 = is_ipv6 ? &iphv6 : NULL; | ||
packet->iph = is_ipv6 ? NULL : &iph; | ||
packet->tcp = &tcph; | ||
|
||
memset(ndpi_flow, 0, sizeof(struct ndpi_flow_struct)); | ||
strcpy(ndpi_flow->host_server_name, "doh.opendns.com"); | ||
ndpi_flow->detected_protocol_stack[0] = NDPI_PROTOCOL_TLS; | ||
|
||
processCertificateElements(ndpi_struct, ndpi_flow, 0, size); | ||
ndpi_free_flow_data(ndpi_flow); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters