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

AFL -f Option Parsing Bug #24

Open
zachbthomas opened this issue Aug 14, 2018 · 1 comment
Open

AFL -f Option Parsing Bug #24

zachbthomas opened this issue Aug 14, 2018 · 1 comment

Comments

@zachbthomas
Copy link

Overview

If the -f option is used in AFL to output a specific filename and extension and the -afl flag is used with cwtriage, crashwalk.go will throw a fatal error if a filename is given without a path.

Example AFL command: $ afl-fuzz -i ../afl-in -o ../afl-out -f testFile.pdf -- fuzzedProg @@
cwtriage bug: 2018/08/13 23:17:33 bad directory for tempfile: mkdir : no such file or directory

Bug Information

Lies in crashwalk.go lines 273-280:
Line 273: base, _ := path.Split(job.OutFile)
path.Split returns an empty string if no "/" character exists in argument, so base == "" if job.Outfile == testFile.pdf which will cause os.MkdirAll(base, 0700) to return an error.

Proposed Fix

if base == "" {
    base = "./"
}

Or some other way of accepting a filename to the -f option that includes those written to the current directory.

@bnagy
Copy link
Owner

bnagy commented Sep 3, 2018

Thanks for the bug! Off the top of my head, I can't see a problem with your fix, but I'm not coding this year. If you test it and shoot me a PR it should be OK to merge.

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

2 participants