Write a 'c' program to fuzz a fuzz a function in binary ( a specific function in
Question:
Write a 'c' program to fuzz a fuzz a function in binary ( a specific function in binary) using libfuzzer?
The inputs to the program is binary and the function address .
void* handler = dlopen("./libcrackme.so", RTLD_LAZY); // libcrackme.so is the shared binary and using dynamic linking for linking the binary
0x11a9 - this is the function address in hexadecimal.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) // fuzzer function
//C code
#include
#include
#include
#define NOINLINE __attribute__ ((noinline))
NOINLINE int check_found(char* input) {
if (strcmp(input, "easy") == 0) {
return 1;
}
return 0;
}
int main(int argc, char** argv) {
if (argc != 2) {
printf("Usage: %s flag", argv[0]);
exit(-1);
}
if (check_found(argv[1])) {
printf("Well done!");
} else {
printf("Wrong!");
}
return 0;
}
The above is the target c program and check_found is the target function to fuzz
Thermodynamics An Engineering Approach
ISBN: 978-0073398174
8th edition
Authors: Yunus A. Cengel, Michael A. Boles