Microsoft Office
TMA-OFFICE-2.2.4.7.4
Ensure 'Scan encrypted macros in Excel Open XML workbooks' is set to 'Enabled: Scan encrypted macros (default)'
Description
This policy setting controls whether encrypted macros in Open XML documents are required to be scanned with anti-virus software before being opened. The recommended state for this setting is: Enabled: Scan encrypted macros (default). Rationale: When an Office Open XML document is rights-managed or password protected, macros that are embedded in the document are encrypted along with the rest of the workbook's contents. User setting: the audit checks HKEY_USERS\<SID>\SOFTWARE\Policies\Microsoft\office\16.0\excel\security:excelbypassencryptedmacroscan (REG_DWORD) in every loaded user hive (S-1-5-21-*) and is compliant when each holds 0. It prints 'no-user-hive-loaded' (FAIL) when no user profile is loaded, so scan while users are logged on.
How it is checked
Audit method: Windows registry
$sids = @(Get-ChildItem -Path 'Registry::HKEY_USERS' -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -match '^S-1-5-21-\d+-\d+-\d+-\d+$' } | ForEach-Object { $_.PSChildName }); if ($sids.Count -eq 0) { 'no-user-hive-loaded' } else { $bad = @(); foreach ($s in $sids) { $v = (Get-ItemProperty -Path ('Registry::HKEY_USERS\' + $s + '\SOFTWARE\Policies\Microsoft\office\16.0\excel\security') -Name 'excelbypassencryptedmacroscan' -ErrorAction SilentlyContinue).'excelbypassencryptedmacroscan'; if (-not ($null -ne $v -and @(0) -contains [int64]$v)) { $bad += $s + ':excelbypassencryptedmacroscan=' + $v } }; if ($bad.Count -eq 0) { 'compliant' } else { 'non-compliant: ' + ($bad -join ', ') } }- Expected output
compliant
How it is fixed
Fix method: Guidance or infrastructure patch
Configure through Group Policy (User Configuration): User Configuration\Administrative Templates\Microsoft Excel 2016\Excel Options\Security\Scan Encrypted Macros in Excel Open XML Workbooks = Enabled: Scan encrypted macros (default)
Properties
- Operating systems
- Any
- Tags
- officeproductivitycis-l1
- Reference
- CIS Microsoft Office Enterprise Benchmark v2.0.0 - 2.2.4.7.4 Ensure 'Scan encrypted macros in Excel Open XML workbooks' is set to 'Enabled: Scan encrypted macros (default)'
Check this host
Run this on a machine you are allowed to audit. The scan is read-only.
tmaegis scan --target office