Title: Greybox fuzzer by DaniilStepanov · Pull Request #1344 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Greybox fuzzer by DaniilStepanov · Pull Request #1344 · UnitTestBot/UTBotJava
X Title: Greybox fuzzer by DaniilStepanov · Pull Request #1344 · UnitTestBot/UTBotJava
Description: Greybox fuzzer
This document describes principles and capabilities of the implemented fuzzing module.
For what?
Any symbolic execution engine has its drawbacks and limitations:
Generation of some complex non-trivial objects often is impossible
Computational costs for solving the system of restrictions
State space explosion problem
Based on these problems, a fuzzing module without symbolic execution is required for full-fledged testing of programs. Also, modern research shows that the most effective is the hybrid mode, when symbolic and concrete executions help each other. The most effective way of fuzzing without symbolic execution is greybox fuzzing, which is proposed in this PR.
How it works?
You can read about how greybox fuzzing works here.
Fuzzing process can be divided into 2 stages: exploration and exploitation. In the exploration phase, seeds are generated to test the target function, in the exploitation phase, mutations are applied to the best seeds. Why we need exploitation phase? Consider an example of a simple Java program:
public int test(int[] c) {
if (c[0] == 0) {
if (c[1] == 1) {
if (c[2] == 2) {
//Bug here
return 42;
}
}
}
return -1;
}
The probability that we initially generate an array that finds a bug is 0%. It is much more likely to generate an array whose first element is 0, and then through mutations to get data that will find a bug.
Exploration phase
To implement the exploration phase, junit-quickcheck was used, which contains built-in configurable generators for many java library types. Initially, the library generated objects that were converted to UtModel using UtModelConstructor. But this approach has shown its inoperability due to the impossibility of converting complex objects containing a large number of fields into UtModel (java.lang.Thread for example). Therefore, it was decided to rewrite the library (package org.utbot.quickcheck) to generate UtModels instead of objects. Also in the org.utbot.engine.greyboxfuzzer.generator.GeneratorConfigurator class it is possible to configure generators by limiting the range of generated values and the size of collections.
In addition to generators for many types from the standard library, a generator for user-defined classes has been implemented, which has the following capabilities:
Generation of an object using a constructor
Generation of an object using static methods
Producing of an object from a static field
Setting random values in the fields of the generated object
Generation of classes that implement the interface
The biggest difficulty in generating user classes is the processing of type parameters. For this, the libraries javaruntype (70 kB) and generics-resolver (77 kB) were used. In the implemented module, it is possible to replace type parameters with values suitable for bound, for example, in the function
public
Open Graph Description: Greybox fuzzer This document describes principles and capabilities of the implemented fuzzing module. For what? Any symbolic execution engine has its drawbacks and limitations: Generation of some ...
X Description: Greybox fuzzer This document describes principles and capabilities of the implemented fuzzing module. For what? Any symbolic execution engine has its drawbacks and limitations: Generation of some ...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/pull/1344
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:63f29060-ecb2-0395-cc49-67c71a553e12 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 8DEC:EC8E6:77099:9FF38:698EDA2F |
| html-safe-nonce | 4e8d7fe69182babde14075c54a98d6e6a761831d98ee4b8199158b60463a4483 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REVDOkVDOEU2Ojc3MDk5OjlGRjM4OjY5OEVEQTJGIiwidmlzaXRvcl9pZCI6Ijc1NDM4NTEyMDgxMDU5NzQzMTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3c9323a048f0ef4532e0e8b0f5235aa67cc0f7946425506b3e2c38070ac59d92 |
| hovercard-subject-tag | pull_request:1116428222 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/UnitTestBot/UTBotJava/pull/1344/checks |
| twitter:image | https://avatars.githubusercontent.com/u/14219946?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/14219946?s=400&v=4 |
| og:image:alt | Greybox fuzzer This document describes principles and capabilities of the implemented fuzzing module. For what? Any symbolic execution engine has its drawbacks and limitations: Generation of some ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/UnitTestBot/UTBotJava git https://github.com/UnitTestBot/UTBotJava.git |
| octolytics-dimension-user_id | 87413538 |
| octolytics-dimension-user_login | UnitTestBot |
| octolytics-dimension-repository_id | 480810501 |
| octolytics-dimension-repository_nwo | UnitTestBot/UTBotJava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480810501 |
| octolytics-dimension-repository_network_root_nwo | UnitTestBot/UTBotJava |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width