Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use libFuzzer to test GUI applications #20

Open
NikParam42 opened this issue Nov 8, 2019 · 3 comments
Open

How to use libFuzzer to test GUI applications #20

NikParam42 opened this issue Nov 8, 2019 · 3 comments

Comments

@NikParam42
Copy link

NikParam42 commented Nov 8, 2019

How can I test QT GUI applications that do not accept data or files from the command line?

Will the libfuzzer work with processes running from the program we submit to the libfuzzer? (tracking coverage)

wrapper(manage UI and data transfer) start -> MyGUIapplication

and use like: ./wrapper

Really need advice or any suggestions.

@NikParam42 NikParam42 changed the title How to use lIBFUZZER to test GUI applications How to use libFuzzer to test GUI applications Nov 8, 2019
@kcc
Copy link
Contributor

kcc commented Nov 8, 2019

First, libFuzzer is an in-process fuzzing engine, it doesn't work across processes out of the box.
(it can be done, but we don't have ready-to-use examples).

You can try linking your GUI library with a libFuzzer-style fuzz target.
I.e. instead of your main() function you need to implement LLVMFuzzerTestOneInput()
and link it against the rest of your code.
Then, you need to treat the input bytes passes to LLVMFuzzerTestOneInput
as a sequence of GUI events that you want your application to receive.
This would be a flavor of structure-aware-fuzzing

@JulianVolodia
Copy link

Hi! I have some Qt-based project on my eyes, but interaction is quite difficult to implement and won't fuzz Qt functions at all.
So when said that, will it be ok to not fuzz GUI lib, nor main app but write fuzz target which uses library as backend and do same thing as user would do (read provided to fuzz target data and treat them as file, change it, save 'file' in-memory after allocation and try to reopen) using lib/backend primitives, as complete app?

@JulianVolodia
Copy link

Refering to https://github.com/google/fuzzing/blob/master/docs/good-fuzz-target.md#global-state

It may not be possible in every case (strictly speaking, even calling malloc() modifies a global state).

what is the pro-tip for some justAnotherSaveAs() to not touch global state?

I have only idea to use some fd mockup in-memory (which will dep on malloc() unfortunately) and calling each part of function decomposition in fuzz target.

That is heavily case-dependant but maybe you remember some example where it was problematic and I could learn from that sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants