VM-Packages icon indicating copy to clipboard operation
VM-Packages copied to clipboard

exception catch in vm.common.psm1 may not be working

Open Ana06 opened this issue 2 years ago • 2 comments

Details

At the beginning of packages/common.vm/tools/vm.common/vm.common.psm1, we set $ErrorActionPreference = 'Stop' and we do the same at the beginning of many packages. Isn't this causing that the catch when an exception occurs is not executed as the program immediately exits? @MalwareMechanic you introduced some of this exception handling to render errors better in the logs. Do you have more insight here?

Ana06 avatar Nov 24 '23 10:11 Ana06

Related: When a registry-item in the configuration fails to be added, the rest of registry items are also not added. It seems the exception is catched in VM-Apply-Configurations instead of in VM-Update-Registry-Value, which is where we would like it to be catched.

I think we need to give the error action a thought.

@mandiant/commando-vm this affects Commando-VM as well.

Ana06 avatar Nov 24 '23 11:11 Ana06

Yeah I have definitely noticed some inconsistencies with what would effectively be VM-Write-Log not actually writing anything to the log, so this is probably the cause. I agree we should look into this since the purpose of maintaining our own logs outside of choco was to have good and actionable info

day1player avatar Jan 02 '24 16:01 day1player