Excel: Blokkeer Legacy XLM Macros (Excel 4.0 Macros)

πŸ’Ό Management Samenvatting

XLM Macros (Excel 4.0 Macros - legacy 1992 macro format) blokkeren voorkomt moderne malware campaigns die XLM misbruiken omdat: XLM bypasses VBA Macro beveiliging (separate code path), antivirus detectie rates laag zijn (obfuscation easy), en XLM NOOIT gebruikt wordt voor legitimate business purposes (30+ jaar oud).

Aanbeveling
IMPLEMENT
Risico zonder
High
Risk Score
8/10
Implementatie
2u (tech: 1u)
Van toepassing op:
βœ“ Microsoft Excel

XLM Macros is hoog risico legacy feature: Created 1992 (before VBA), deprecated since Excel 5.0 (1993), NO legitimate business gebruiken today (VBA replaced XLM 30 years ago). Waarom attackers XLM gebruiken: Bypasses VBA security (separate execution engine), Low AV detectie (obfuscation via hidden cells, auto_open formulas), User awareness laag (users don't recognize XLM as macros). XLM malware capabilities: Download payloads (URLMON.DLL calls), Registry modifications, Process injection, File system access. Recent campaigns: Dridex (banking trojan), Qakbot (ransomware loader), IcedID (malware).

Implementatie

Microsoft policy (2021): XLM macros BLOCKED door Standaard Excel 2021+, Earlier versions: Schakel in Blokkeer via registry/Intune. Registry: HKLM\Software\Microsoft\Office\16.0\Excel\Security β†’ BlockXLLFromInternet is 1 (Blokkeer XLM van internet), DisableXLMMacros is 1 (Blokkeer alle XLM). Effect: XLM macros blocked completely (no 'schakel in' button), VBA macros unaffected (separate setting), Legacy .xls files met XLM β†’ blocked.

Vereisten

  1. Office 2016+ (XLM Blokkeer capability)
  2. Intune configuration profile of GPO
  3. User communication (XLM legacy format blocked)

Implementatie

Office 2021+: XLM blocked standaard. Office 2016-2019: Intune Settings Catalog β†’ Excel\Security β†’ Blokkeer XLM macros: ingeschakeld. Registry: DisableXLLFromInternet=1, DisableXLMMacros=1.

monitoring

Gebruik PowerShell-script prevent-xlm-macros.ps1 (functie Invoke-Monitoring) – Controleren.

monitor XLM Blokkeer events (Office telemetry), investigate enige legitimate XLM usage (zou moeten zijn ZERO).

Compliance en Auditing

XLM blocking voldoet aan: CIS Office Benchmark (Blokkeer legacy macros), BIO 12.02 (Bescherming tegen malware - Blokkeer legacy aanvalsvectors), ISO 27001 A.14.2.9 (Remove legacy/unsafe features).

Remediatie

Gebruik PowerShell-script prevent-xlm-macros.ps1 (functie Invoke-Remediation) – Herstellen.

Compliance & Frameworks

Automation

Gebruik het onderstaande PowerShell script om deze security control te monitoren en te implementeren. Het script bevat functies voor zowel monitoring (-Monitoring) als remediation (-Remediation).

PowerShell
<# .SYNOPSIS Voorkomt uitvoering van XLM macros in Excel .DESCRIPTION Dit script implementeert CIS control O365-EX-000008 voor het voorkomen van het uitvoeren van XLM macros in Microsoft Excel. XLM macros zijn een legacy technologie die vaak wordt misbruikt voor aanvallen en moeten worden geblokkeerd. .REQUIREMENTS - PowerShell 5.1 of hoger - Lokale administrator rechten voor registry wijzigingen - Microsoft Excel geΓ―nstalleerd .PARAMETER Monitoring Controleert de huidige compliance status .PARAMETER Remediation Past de aanbevolen configuratie toe .PARAMETER Revert Herstelt de originele configuratie .PARAMETER WhatIf Toont wat er zou gebeuren zonder wijzigingen door te voeren .EXAMPLE .\prevent-xlm-macros.ps1 -Monitoring Controleert of XLM macros zijn geblokkeerd .EXAMPLE .\prevent-xlm-macros.ps1 -Remediation Blokkeert XLM macros .NOTES Registry pad: HKCU:\Software\Policies\Microsoft\Office\16.0\Excel\Security Waarde: PreventXlmMacroExecution = 1 CIS Control: O365-EX-000008 DISA STIG: Microsoft Office 365 ProPlus v3r3 #> #Requires -Version 5.1 param( [switch]$Monitoring, [switch]$Remediation, [switch]$Revert, [switch]$WhatIf ) # Globale variabelen $RegistryPath = "HKCU:\Software\Policies\Microsoft\Office\16.0\Excel\Security" $ValueName = "PreventXlmMacroExecution" $ExpectedValue = 1 $ControlID = "O365-EX-000008" function Test-Compliance { try { if (-not (Test-Path $RegistryPath)) { return $false } $currentValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue return ($currentValue -and $currentValue.$ValueName -eq $ExpectedValue) } catch { return $false } } function Invoke-Monitoring { Write-Host "Monitoring ${ControlID}: XLM macro uitvoering voorkomen" -ForegroundColor Green try { if (-not (Test-Path $RegistryPath)) { Write-Host "βœ— Registry pad bestaat niet: $RegistryPath" -ForegroundColor Red return $false } $currentValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue if ($currentValue -and $currentValue.$ValueName -eq $ExpectedValue) { Write-Host "βœ“ Control compliant: ${ValueName} = $ExpectedValue (XLM macros geblokkeerd)" -ForegroundColor Green return $true } else { $actualValue = if ($currentValue) { $currentValue.$ValueName } else { "Not Set" } Write-Host "βœ— Control non-compliant: ${ValueName} = $actualValue (Expected: $ExpectedValue)" -ForegroundColor Red return $false } } catch { Write-Host "βœ— Fout bij controleren registry instelling: $($_.Exception.Message)" -ForegroundColor Red return $false } } function Invoke-Remediation { Write-Host "Remediating ${ControlID}: XLM macro uitvoering voorkomen" -ForegroundColor Yellow try { if ($WhatIf) { Write-Host "WhatIf: Zou registry waarde instellen: ${ValueName} = $ExpectedValue" -ForegroundColor Cyan return $true } if (-not (Test-Path $RegistryPath)) { Write-Host "Registry pad aanmaken: $RegistryPath" -ForegroundColor Yellow New-Item -Path $RegistryPath -Force | Out-Null } Set-ItemProperty -Path $RegistryPath -Name $ValueName -Value $ExpectedValue -Type DWord -Force Write-Host "βœ“ Registry waarde succesvol ingesteld: ${ValueName} = $ExpectedValue" -ForegroundColor Green Start-Sleep -Seconds 1 return Invoke-Monitoring } catch { Write-Host "βœ— Fout bij configureren registry instelling: $($_.Exception.Message)" -ForegroundColor Red return $false } } function Invoke-Revert { Write-Host "Reverting ${ControlID}: XLM macro blokkering herstellen" -ForegroundColor Yellow try { if ($WhatIf) { Write-Host "WhatIf: Zou registry waarde verwijderen: ${ValueName}" -ForegroundColor Cyan return $true } if (Test-Path $RegistryPath) { Remove-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue Write-Host "βœ“ Registry waarde verwijderd: ${ValueName}" -ForegroundColor Green } return $true } catch { Write-Host "βœ— Fout bij herstellen registry instelling: $($_.Exception.Message)" -ForegroundColor Red return $false } } # Hoofd uitvoering try { if ($Monitoring) { $result = Invoke-Monitoring exit $(if ($result) { 0 } else { 1 }) } elseif ($Remediation) { $result = Invoke-Remediation exit $(if ($result) { 0 } else { 1 }) } elseif ($Revert) { $result = Invoke-Revert exit $(if ($result) { 0 } else { 1 }) } else { Write-Host "Gebruik: .\prevent-xlm-macros.ps1 [-Monitoring] [-Remediation] [-Revert] [-WhatIf]" -ForegroundColor Yellow Write-Host " -Monitoring: Controleer huidige compliance status" -ForegroundColor White Write-Host " -Remediation: Pas aanbevolen configuratie toe" -ForegroundColor White Write-Host " -Revert: Herstel originele configuratie" -ForegroundColor White Write-Host " -WhatIf: Toon wat er zou gebeuren" -ForegroundColor White Write-Host "" Write-Host "Handmatige configuratie:" -ForegroundColor Cyan Write-Host "Group Policy: User Configuration > Administrative Templates > Microsoft Excel 2016" -ForegroundColor White Write-Host "> Excel Options > Security > Trust Center" -ForegroundColor White Write-Host "> Prevent Excel from running XLM macros: Enabled" -ForegroundColor White } } catch { Write-Host "βœ— Onverwachte fout: $($_.Exception.Message)" -ForegroundColor Red exit 1 }

Risico zonder implementatie

Risico zonder implementatie
High: Hoog: XLM macros is modern malware delivery (Dridex, Qakbot) bypassing VBA security. NO legitimate business use.

Management Samenvatting

Blokkeer XLM Macros (Excel 4.0 - 30 jaar oud legacy format). Standaard blocked Office 2021+. Schakel in Blokkeer voor oudere versies. Implementatie: 1-2 uur. nul business impact.