WithSecureLabs / chainsaw

Rapidly Search and Hunt through Windows Forensic Artefacts
GNU General Public License v3.0
2.85k stars 260 forks source link

--skip-errors fails on File System errors #90

Closed dsplice closed 2 years ago

dsplice commented 2 years ago

It appears that issue #49 https://github.com/countercept/chainsaw/issues/49#issue-1072543106 has returned. This is with V2.0.0-beta.2

alexkornitzer commented 2 years ago

-I can't seem to replicate this, are you able to show the output you got and the command you ran so I can hopefully use that to work out what is going on?-

Screenshot 2022-07-22 at 14 59 11

Scrap that I think I found it, just prepping a new build now.

alexkornitzer commented 2 years ago

This should be fixed in 2.0.0-beta.3 assuming I have caught the right bug, please could you check if this build fixes it?

dsplice commented 2 years ago

image

alexkornitzer commented 2 years ago

Ah damn, thanks for the above though, can see exactly where that has fallen into. Right lets see if I managed to fix the above with beta 4! Apologies for the build spam.

dsplice commented 2 years ago

All good! Happy to help in any little way I can.

alexkornitzer commented 2 years ago

Did that work? Happy for me to close this issue out?

dsplice commented 2 years ago

I just downloaded to try it. Seems Windows Defender detects it as malware.

image

alexkornitzer commented 2 years ago

Weird it should only potentially think its malware if it the zip containing the attack samples too. Which it doesn't look like you downloaded in the above.

dsplice commented 2 years ago

Latest update of the malware definitions fixed the false positive. However the error is still there.

alexkornitzer commented 2 years ago

Good you got that sorted, but ah damn, okay still the same error message as you posted above?

alexkornitzer commented 2 years ago

Okay I am a tad stumped with this one as I just booted my windows VM and pointed Chainsaw at the C:\ drive and it ran through to the end when --skip-errors was enabled. Just to double check based on the (1) in your screenshot above, you definitely ran beta 4 and not 3 right?

Screenshot 2022-07-24 at 11 13 04
dsplice commented 2 years ago

I verified the version, beta 4. This was run against a vhdx, so that could be an issue too. If it works everywhere else (and seems to), I would just chalk it up to a weird edge case.

alexkornitzer commented 2 years ago

What error message are you getting now, because if its a different one, then it will be a different code path we have not caught. If it is the same error message then I am very confused because I am about 90% sure that I have caught that one. But yep worst case we can close this out until it happens again, but I would prefer to get it squashed.

dsplice commented 2 years ago

Same exact error. I can provide screenshot tomorrow.

alexkornitzer commented 2 years ago

Okay lets have a look tomorrow, you might have to just let me know what you are running on and I will try and replicate that as close as possible but that error message is definitely guarded away now.

https://github.com/countercept/chainsaw/blob/master/src/file/mod.rs#L299-L302

    } else if skip_errors {
        cs_eyellowln!("[!] Specified path does not exist - {}", path.display());
    } else {
        anyhow::bail!("Specified event log path is invalid - {}", path.display());
    }
dsplice commented 2 years ago

I am running it on a KAPE triage image (VHDX) taken from a full disk image (E01). Here is a screenshot of the root directory.

image

FranticTyping commented 2 years ago

Hey @dsplice

Thanks for sending over the screenshot, that helps.

Just to make sure we’re all on the same page, could you send across a screenshot showing the full command you’re using and the error you see, and also a screenshot of the output of chainsaw.exe —version please?

Can you also check that you’re running chainsaw with elevated privileges?

Thanks!

dsplice commented 2 years ago

image

If I run it with the target of D:/D (subdirectory without System Volume Info) it runs fine. Just on the SVI directory.

FranticTyping commented 2 years ago

@dsplice that's great, thanks!

Can you try running that command again with the --skip-errors flag, e.g:

chainsaw hunt D: -s sigma/ -m mappings/sigma-event-logs-all.yml -r rules/ --skip-errors

That should allow Chainsaw to continue past that error, which I think is what you want?

dsplice commented 2 years ago

Darn, I must have missed that in the last testing. Ignore me. It works fine now 😊

FranticTyping commented 2 years ago

Glad to hear it's all working well, thanks for helping us troubleshoot!