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

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

Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include FuzzerDataFlowTraceh include FuzzerCommandh include FuzzerIOh include FuzzerRandomh include FuzzerSHA1h include FuzzerSHA1h include FuzzerUtilh include include include include include include ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Engineering Questions!