trailofbits / sienna-locomotive

A user-friendly fuzzing and crash triage tool for Windows
https://blog.trailofbits.com/user-friendly-fuzzing-with-sienna-locomotive
GNU Affero General Public License v3.0
131 stars 24 forks source link

Test against real world applications #37

Open TACIXAT opened 6 years ago

TACIXAT commented 6 years ago

This will fill uncover bugs in Sienna and fill in functionality gaps. Hopefully find some cool bugs in the targeted software too.

ehennenfent commented 6 years ago

We should run SL2 overnight on low-hanging-fruit software projects that will provide new insight into things that can go wrong or enhancements we can make. Additionally, this will give us something to point to in the upcoming quarterly reports (and final report) to indicate that SL2 produces useful results on things other than just Blender. We should start doing this ASAP, but since it's an ongoing process, we'll move it to the Polish milestone after we deliver the beta version.

Some potential targets:

Taken out of consideration:

woodruffw commented 6 years ago

https://github.com/trailofbits/pe-parse might also be a good candidate.

I'll give LibreOffice a shot (it takes a lot of ancient document formats, so there's lots of interesting space to explore there).

woodruffw commented 6 years ago

Testing LibreOffice helped discover and resolve #171 and #172.

I'm testing SumatraPDF right now (with a DjVu input, since that's probably less tested).

woodruffw commented 6 years ago

Testing KeePassXC revealed #180, which is relatively low priority (since users can re-run the harness as admin to obtain the permissions needed).

Neither SumatraPDF nor KeePassXC yielded any interesting crashes, which makes some sense: SumatraPDF is built on the relatively solid muPDF library, and KeePassXC performs substantial integrity checks.

ehennenfent commented 6 years ago

Issues with NitroPDF have been fixed in https://github.com/trailofbits/sienna-locomotive/commit/78ad3716228bae982411ae70d704f13203ce85fe. However, I'm still not sure why the wrap context pointer is null in some cases.

haxmeadroom commented 6 years ago

The wizard with Inkscape 0.92.3 isn't finding any functions

woodruffw commented 6 years ago

The wizard with Inkscape 0.92.3 isn't finding any functions

Is it possible that Inkscape is 32-bit? I haven't fixed #184 yet, so 32-bit wizard runs currently just fail silently.

haxmeadroom commented 6 years ago

It's 64bit.

woodruffw commented 6 years ago

Hm. Any interesting output from running the wizard directly?

haxmeadroom commented 6 years ago

@woodruffw I put some more info in #188

haxmeadroom commented 6 years ago

peazip spawns 7z.exe, then the PeaZip gui hangs with PeaZip (Not Responding)

haxmeadroom commented 6 years ago

Fuzzing c:/prorgram files/PeaZip/res/7z/7z.exe directly works, but not inside the gui. No crashes on 7z.exe after running for a night on a zip.

woodruffw commented 6 years ago

Honeyview runs like a charm under SL2, except for a strange case where handle_coverage_info will fail after a timeout. I made it slightly more resilient by changing the hard server failure into a warning in https://github.com/trailofbits/sienna-locomotive/commit/edec8af4ad9410fc0dc930be01a82879f1d3484f, but there's probably an underlying issue there that needs to be fixed.

ehennenfent commented 6 years ago

@woodruffw Can you make a separate issue for that? It's high priority, so I don't want to lose track of it.

woodruffw commented 6 years ago

Yep, I'll do so in a moment.

woodruffw commented 6 years ago

Opened as #355.

woodruffw commented 6 years ago

Going to try some NirSoft tools, since it looks like there are some 64-bit builds available and they deal with all sorts of weird Microsoft formats internally.

woodruffw commented 6 years ago

Looks like most of the NirSort tools don't take an input file on the command line, which means that we don't have an easy way to feed them our initial seed input 😞

ehennenfent commented 6 years ago

Hmm, that's not good. I take it they do file selection in the GUI, then? Perhaps if the client asks for it, we'll have to find a quick way to attach an AutoIt script to each fuzzing run. Hopefully it doesn't come to that.

woodruffw commented 6 years ago

Yep, in the GUI. I think NirSoft is an exception to the rule -- most Windows applications expect to be fed their input as the first argument for interoperability with the shell/explorer (since file registrations require that, IIRC). Most of his tools do things behind the scenes and as such don't need file registrations, so it makes some sense.

AutoIt or AutoHK would probably be a good fit for these edge cases, but yeah, it'd be great if it doesn't come to that.

woodruffw commented 6 years ago

Going to try this, since it specifies a CLI: https://www.nirsoft.net/utils/resources_extract.html

woodruffw commented 6 years ago

ResourcesExtract.exe appears to be statically linked to the CRT, so the wizard can't pick up any of its I/O.

woodruffw commented 6 years ago

ResourceHacker.exe would have been a great candidate, but it's 32-bit only.

woodruffw commented 6 years ago

depends.exe caused an interesting condition in the fuzzer:

    // NOTE(ww): The wizard should weed these failures out for us; if it happens
    // here, there's not much we can do.
    if (!GetMappedFileName(GetCurrentProcess(), info->lpBuffer, hash_ctx.fileName, MAX_PATH)) {
        SL2_DR_DEBUG("Fatal: Couldn't get filename for memory map (GLE=%d)! Aborting.\n", GetLastError());
        crashed = false;
        dr_exit_process(1);
    }
woodruffw commented 6 years ago

GLE reports error 1006, or ERROR_FILE_INVALID:

The volume for a file has been externally altered so that the opened file is no longer valid.

CreateFileMapping will return ERROR_FILE_INVALID when told to map an empty file, but this error occurs after GetMappedFileName and notepad.exe is definitely not empty 😕

woodruffw commented 6 years ago

366 will fix the bugs uncovered by depends.exe. So far, I've found one access violation while fuzzing it.

woodruffw commented 6 years ago

"DB Browser for SQLite" doesn't produce any wizard results, much less output: not even module loads get registered. It's definitely 64-bit, though.

woodruffw commented 6 years ago

Fuzzing FreeCAD now, via FreeCADCmd.exe.

ehennenfent commented 6 years ago

Moving to Polish since this will never fully be done.