Microsoft Visio: VBA-macro's Van Internet Blokkeren

💼 Management Samenvatting

Het blokkeren van VBA-macro's van internet in Microsoft Visio-bestanden voorkomt macro-gebaseerde malware in gedownloade .vsdm diagram-bestanden. Deze defense-in-depth maatregel is vergelijkbaar met macro-blocking in Excel en Word maar specifiek voor Visio, waar macros common zijn voor diagram-automatisering.

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

Microsoft Visio-bestanden (.vsd, .vsdx, .vsdm) worden gebruikt voor technische diagrammen, flowcharts en netwerkschema's waarbij VBA-macros frequent worden toegepast voor automation zoals shape manipulation, automated data links naar externe databronnen, en diagram-generatie uit templates. Omdat macros legitimate functionality bieden in Visio, zijn gebruikers minder suspicious van macro-enabled Visio files vergeleken met Excel of Word. Aanvallers exploiteren dit door malicious .vsdm-bestanden met macro malware te versturen via email attachments als ogenschijnlijk legitieme technical diagrams of flowcharts. De attack flow is: een kwaadaardig .vsdm-bestand met embedded VBA macro-code wordt verstuurd als email attachment vermomd als technical documentation, de gebruiker opent het bestand waarbij Visio de macro automatisch uitvoert (afhankelijk van macro security settings), en de malware-payload wordt geïnstalleerd die credentials kan stelen, ransomware kan deployen, of backdoor-toegang kan creëren. Windows Mark-of-the-Web (MOTW) feature markeert automatisch files afkomstig van internet of email met een Zone.Identifier alternate data stream die de Internet security zone aangeeft. Het blokkeren van internet macros gebruikt MOTW-detectie om alleen MOTW-tagged Visio-files te blokkeren van macro-execution, waardoor interne Visio-files vanaf SharePoint of network shares normally kunnen blijven functioneren met macros voor legitimate automation. Deze defense is identiek aan de widely-deployed Excel/Word macro blocking maar Visio-specific vanwege Visio's eigen file formats en security context.

PowerShell Modules Vereist
Primary API: Intune / GPO
Connection: Registry-based
Required Modules:

Implementatie

Deze maatregel implementeert de policy 'Block macros from running in Office files from the Internet' specifiek voor Microsoft Visio. De configuratie gebeurt via Intune Settings Catalog onder Visio Security Trust Center settings of via Group Policy met Visio Administrative Templates. Na activering worden .vsdm-bestanden (macro-enabled Visio files) afkomstig van internet of email automatisch geblokkeerd van macro-execution - gebruikers zien een notification bar met het bericht 'Macros have been disabled for security reasons' en macros kunnen niet worden geactiveerd. Internal Visio-files zonder MOTW-marking blijven normally functioneren met macros als de algemene macro security settings dit toestaan. De Mark-of-the-Web detection gebeurt automatisch door Windows waarbij elke file gedownload via browser of email een Zone.Identifier alternate data stream krijgt. De implementatie is eenvoudig, kost 1-2 uur inclusief testing, heeft geen impact op internal Visio-workflows, en blokkeert effectief de Visio macro malware attack vector. Dit is een must-have voor alle organisaties met Visio-gebruik en voldoet aan CIS Office Benchmark Level 1, BIO 12.02.01 macro blocking requirements, en Microsoft Security Baseline. Zero business impact bij correct configured internal Visio-sharing via SharePoint.

Vereisten

  1. Visio 2016+
  2. Intune of GPO
  3. Mark-of-the-Web: Windows feature (automatic)

Implementatie

Intune Settings Catalog: Visio\Security\Trust Center → Block macros from running in Office files from the Internet: Enabled. MOTW = automatic (Windows).

Monitoring

Gebruik PowerShell-script vba-macros-blocked.ps1 (functie Invoke-Monitoring) – Controleren.

Remediatie

Gebruik PowerShell-script vba-macros-blocked.ps1 (functie Invoke-Remediation) – Herstellen.

Compliance

CIS Office Benchmark L1, BIO 12.02 (Macro blocking), DISA STIG, Microsoft Security Baseline.

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 Blokkeert VBA macros behalve digitaal ondertekende in Visio .DESCRIPTION Dit script implementeert CIS control O365-VI-000001 voor het blokkeren van VBA macros behalve digitaal ondertekende macros in Microsoft Visio. Dit voorkomt uitvoering van potentieel schadelijke niet-ondertekende macros. .REQUIREMENTS - PowerShell 5.1 of hoger - Lokale administrator rechten voor registry wijzigingen - Microsoft Visio 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 .\vba-macros-blocked.ps1 -Monitoring Controleert of alleen ondertekende macros zijn toegestaan .EXAMPLE .\vba-macros-blocked.ps1 -Remediation Blokkeert niet-ondertekende VBA macros .NOTES Registry pad: HKCU:\Software\Policies\Microsoft\Office\16.0\Visio\Security Waarde: VBAWarnings = 2 CIS Control: O365-VI-000001 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\Visio\Security" $ValueName = "VBAWarnings" $ExpectedValue = 2 $ControlID = "O365-VI-000001" 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}: VBA macros blokkeren behalve digitaal ondertekende" -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" -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}: VBA macros blokkeren behalve digitaal ondertekende" -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}: VBA macro instellingen 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: .\vba-macros-blocked.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 } } catch { Write-Host "✗ Onverwachte fout: $($_.Exception.Message)" -ForegroundColor Red exit 1 }

Risico zonder implementatie

Risico zonder implementatie
High: Hoog: Visio macro malware via email/downloads (Visio macros = common in automation).

Management Samenvatting

Block Visio VBA macros from internet (MOTW). Malware prevention. Internal macros: OK. Implementatie: 1-2 uur.