quic / AFLTriage

Other
111 stars 12 forks source link

AFL_PRELOAD #1

Open WorksButNotTested opened 2 years ago

WorksButNotTested commented 2 years ago

AFLTriage is great, super easy to use. I've run into a small issue though. I would like to LD_PRELOAD a library into my target when it is run. However, I cannot seem to see a way to pass an environment variable to the target without it also being passed to afl-triage itself. Whilst in the most part, environment variables can just be allowed to propagate from parent to the child, in the case of LD_PRELOAD this causes an issue.

Obviously, you can't simply replace your target with a script, since the target then won't be the direct child of afl-triage, so for now, I've managed to workaround by making a small loader application which calls setenv and execve, but it would be awesome if you could just pass environment variables direct to afl-triage.

Maybe something like...

afl-triage -e LD_PRELOAD=mylib.so ...

vanhauser-thc commented 2 years ago

why not AFL_PRELOAD=… instead so it is compatible to afl?

WorksButNotTested commented 2 years ago

That should work fine for me. Just wondered if any other environment variables caused issues and something more generic was required? If not then similarity to AFL++ is probably more desirable.

quic-ghernand commented 2 years ago

Hey there, thanks for the issue. This has been on my mental TODO for a bit. I like the idea of -e or -D to pass arbitrary environment variables. I'll work on getting this for you