Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow cmplog with unicorn mode #2419

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Evian-Zhang
Copy link
Contributor

If AFLplusplus/unicornafl#37 is merged, then we shall use cmplog with unicorn-mode. Removed certain check preventing this.

Moreover, I found that although qemu_mode, frida_mode, cs_mode are defined as fields in forkserver struct, unicorn_mode is defined directly in afl struct. This is strange and makes it hard to check unicorn_mode in forkserver logic. This PR also moves unicorn_mode to be field of forkserver struct, making it more consistent.

@domenukk
Copy link
Member

domenukk commented May 9, 2025

Do we really need a specialized unicorn mode? IIRC it changes basically nothing but set one or two env variables, specifically AFL_SKIP_BIN_CHECK (right?)

@domenukk
Copy link
Member

domenukk commented May 9, 2025

Ah this PR adds a bunch of other things, I see...
Other option: can we merge some flags for binary-only instrumentation into one? Does qemu_mode or unicorn mode (or frida mode?) really make a difference for the forkserver? Ideally it should not

@Evian-Zhang
Copy link
Contributor Author

This question is really out of my knowledge. Hope someone could answer this.

@wtdcode
Copy link
Member

wtdcode commented May 9, 2025

I can take a look but allow me a few days since still on travelling

@wtdcode
Copy link
Member

wtdcode commented May 9, 2025

Ideally, we do not need any special handling for unicornafl as said previously. It will act like any forkserver targets, like those compiled by afl-cc.

@Evian-Zhang
Copy link
Contributor Author

AFL++ internally has many checks to avoid users from composing unsupported features. For example, when using afl-forkserver, only qemu-mode would use cmplog, where other mode would fail the check (afl-cc use another code so not checked at that location). As a result, it may not be "special handling", it's just some misuse checks that require explicit unicorn mode set.

@wtdcode
Copy link
Member

wtdcode commented May 9, 2025

AFL++ internally has many checks to avoid users from composing unsupported features. For example, when using afl-forkserver, only qemu-mode would use cmplog, where other mode would fail the check (afl-cc use another code so not checked at that location). As a result, it may not be "special handling", it's just some misuse checks that require explicit unicorn mode set.

I mean, AFL++ can remove unicorn mode, i.e. “-U”, totally.

@domenukk
Copy link
Member

domenukk commented May 9, 2025

For example, I would prefer a "forkserver->force_cmplog" flag that both qemu and unicorn mode set, rather than a bunch of obscure feature flags sprinkled around the codebase. It gets very spaghetti otherwise

@domenukk
Copy link
Member

domenukk commented May 9, 2025

unicorn mode likely still needs SKIP_BINCHECK in comparison to afl-cc binaries

@wtdcode
Copy link
Member

wtdcode commented May 9, 2025

I mean -U likely still needs SKIP_BINCHECK

No, current uncornafl v3 pass that seamlessly thanks to libafl fsrv implementation

@Evian-Zhang
Copy link
Contributor Author

There may be some confusions here. I totally agree that force_cmplog flag is better, but without inferring unicorn mode by -U cmdline option, how can we set that flag accordingly? At least for now, we do not have a mechanism of guessing target instrumentation by user-provided binaries.

@wtdcode
Copy link
Member

wtdcode commented May 9, 2025

The idea is that uncornafl spins up fsrv like a normal afl-cc or libafl_cc instrumented binary so that it is very transparent to afl++. Unicornafl only needs to notify afl++ a crash is found by aborting intentioanlly.

@wtdcode
Copy link
Member

wtdcode commented May 9, 2025

There may be some confusions here. I totally agree that force_cmplog flag is better, but without inferring unicorn mode by -U cmdline option, how can we set that flag accordingly? At least for now, we do not have a mechanism of guessing target instrumentation by user-provided binaries.

The point is that “unicorn mode” is not necessary. Unicornafl can mock as a pretty normal fsrv targets.

@Evian-Zhang
Copy link
Contributor Author

OK, that makes sense.

@Evian-Zhang
Copy link
Contributor Author

I mean -U likely still needs SKIP_BINCHECK

No, current uncornafl v3 pass that seamlessly thanks to libafl fsrv implementation

It suddenly occurred to me that, if we provide python binding of new unicornafl, then the bin check should be skipped, otherwise the python executable will be checked? 🤔

@wtdcode
Copy link
Member

wtdcode commented May 10, 2025 via email

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

Successfully merging this pull request may close these issues.

3 participants