Skip to content

Commit

Permalink
Return code updates to scan_blocked, uefivar_fuzz and vmm.hypercallfuzz
Browse files Browse the repository at this point in the history
Signed-off-by: Sae86 <[email protected]>
  • Loading branch information
Sae86 authored and npmitche committed Feb 13, 2024
1 parent cabe83d commit 5f1b1d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
9 changes: 6 additions & 3 deletions chipsec/modules/tools/uefi/scan_blocked.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class scan_blocked(BaseModule):

def __init__(self):
BaseModule.__init__(self)
self.rc_res = ModuleResult(0x5df9386, 'https://chipsec.github.io/modules/chipsec.modules.tools.uefi.scan_blocked.html')
self.uefi = UEFI(self.cs)
self.cfg_name = 'blockedlist.json'
self.image = None
Expand Down Expand Up @@ -97,6 +98,7 @@ def check_blockedlist(self):
self.logger.log('')
if found:
res = ModuleResult.WARNING
self.rc_res.setStatusBit(self.rc_res.status.VERIFY)
self.logger.log_warning("Blocked EFI binary found in the UEFI firmware image")
else:
self.logger.log_passed("Didn't find any blocked EFI binary")
Expand Down Expand Up @@ -136,8 +138,8 @@ def run(self, module_argv):
if len(module_argv) == 0:
self.logger.log_important('Unable to read SPI and generate FW image. Access may be blocked.')
self.logger.log_error('No FW image file to read. Exiting!')
self.res = ModuleResult.ERROR
return self.res
self.rc_res.setStatusBit(self.rc_res.status.UNSUPPORTED_FEATURE)
return self.rc_res.getReturnCode(ModuleResult.ERROR)

# Load JSON config with blocked EFI modules
if len(module_argv) > 1:
Expand All @@ -147,4 +149,5 @@ def run(self, module_argv):
self.efi_blockedlist = json.load(blockedlist_json)

self.res = self.check_blockedlist()
return self.res
return self.rc_res.getReturnCode(self.res)

8 changes: 5 additions & 3 deletions chipsec/modules/tools/uefi/uefivar_fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ class uefivar_fuzz(BaseModule):

def __init__(self):
BaseModule.__init__(self)
self.rc_res = ModuleResult(0x430f248, 'https://chipsec.github.io/modules/chipsec.modules.tools.uefi.uefivar_fuzz.html')
self._uefi = UEFI(self.cs)

def is_supported(self):
supported = self.cs.helper.EFI_supported()
if not supported:
self.logger.log_important("OS does not support UEFI Runtime API. Skipping module.")
self.res = ModuleResult.NOTAPPLICABLE
self.rc_res.setStatusBit(self.rc_res.status.NOT_APPLICABLE)
self.res = self.rc_res.getReturnCode(ModuleResult.NOTAPPLICABLE)
return supported

def rnd(self, n=1):
Expand Down Expand Up @@ -227,5 +229,5 @@ def run(self, module_argv):
self.logger.log_important('Evaluate the platform for expected behavior to determine PASS/FAIL')
self.logger.log_important('Behavior can include platform stability and retaining protections.')

self.res = ModuleResult.WARNING
return self.res
self.rc_res.setStatusBit(self.rc_res.status.VERIFY)
return self.rc_res.getReturnCode(ModuleResult.WARNING)
6 changes: 3 additions & 3 deletions chipsec/modules/tools/vmm/hypercallfuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class hypercallfuzz(BaseModule):

def __init__(self):
BaseModule.__init__(self)
self.rc_res = ModuleResult(0xf918ec4, 'https://chipsec.github.io/modules/chipsec.modules.tools.vmm.hv.hypercallfuzz.html')
self.vmm = VMM(self.cs)

self.random_order = True
Expand Down Expand Up @@ -147,7 +148,6 @@ def fuzz_generic_hypercalls(self):
pass

self.logger.log(f'[*] Finished fuzzing: time elapsed {time.time() - t:.3f}')
return ModuleResult.WARNING

def run(self, module_argv):
self.logger.start_test("Dumb VMM hypercall fuzzer")
Expand Down Expand Up @@ -177,5 +177,5 @@ def run(self, module_argv):

self.logger.log_information('Module completed')
self.logger.log_warning('System may be in an unknown state, further evaluation may be needed.')
self.res = ModuleResult.WARNING
return self.res
self.rc_res.setStatusBit(self.rc_res.status.VERIFY)
return self.rc_res.getReturnCode(ModuleResult.WARNING)

0 comments on commit 5f1b1d9

Please sign in to comment.