Microsoft Publisher: VBA-macro's Van Internet Blokkeren
📅 2025-10-30
•
⏱️ 3 minuten lezen
•
🔴 Must-Have
💼 Management Samenvatting
Het blokkeren van VBA-macro's van internet in Microsoft Publisher-bestanden voorkomt macro-gebaseerde malware in gedownloade .pub desktop publishing-bestanden. Deze defense-in-depth maatregel past hetzelfde macro-blocking principe toe als Excel en Word, maar is specifiek voor Publisher waar macro-gebruik zeldzaam is.
Aanbeveling
IMPLEMENT
Risico zonder
High
Risk Score
8/10
Implementatie
2u (tech: 1u)
Van toepassing op:
✓ Microsoft Publisher
Microsoft Publisher-bestanden (.pub) worden gebruikt voor desktop publishing zoals nieuwsbrieven, brochures en marketing materialen. Hoewel VBA-macros technisch mogelijk zijn in Publisher voor automation, is hun gebruik zeer zeldzaam vergeleken met Excel of Word waar macros common zijn. Desondanks kunnen aanvallers Publisher-files exploiteren als malware-delivery vector precies omdat gebruikers niet verwachten dat Publisher-files gevaarlijk kunnen zijn. De attack vector is identiek aan andere Office applications: een malicious .pub-file met embedded VBA macro malware wordt verstuurd als email attachment vermomd als marketing materiaal of brochure, de gebruiker opent het bestand waarbij Publisher de macro automatisch kan uitvoeren afhankelijk van security settings, en malware-payload wordt geïnstalleerd. Windows Mark-of-the-Web (MOTW) feature markeert automatisch files gedownload van internet of ontvangen via email met de Internet security zone, wat Office-applicaties gebruikt om untrusted files te identificeren. Het blokkeren van internet macros zorgt dat MOTW-tagged Publisher-bestanden geen macros kunnen uitvoeren, terwijl internal Publisher-files vanaf SharePoint of file shares normally kunnen functioneren. Dit volgt dezelfde defense-in-depth strategie als Excel/Word macro blocking maar is Publisher-specific vanwege different file formats en application context.
Deze maatregel implementeert de policy 'Block macros from running in Office files from the Internet' voor Microsoft Publisher. Configuratie gebeurt via Intune Settings Catalog onder Publisher Security Trust Center settings of via Group Policy met Publisher Administrative Templates. Na activering worden .pub-bestanden afkomstig van internet of email geblokkeerd van macro-execution - gebruikers zien een notification bar 'Macros have been disabled for security reasons'. Internal Publisher-files zonder MOTW-marking blijven normally functioneren met macros als algemene macro security settings dit toestaan. Windows Mark-of-the-Web Zone.Identifier alternate data stream marking gebeurt automatisch bij download. De implementatie is eenvoudig, kost 1-2 uur, en heeft minimale business impact omdat macro-gebruik in Publisher zeer ongebruikelijk is. Dit is een must-have defense-in-depth control voor CIS Office Benchmark Level 1 en BIO 12.02.01.
Vereisten
Publisher 2016+
Intune of GPO
Mark-of-the-Web: Windows feature (automatic)
Implementatie
Intune Settings Catalog: Publisher\Security\Trust Center → Block macros from running in Office files from the Internet: Enabled. MOTW = automatic (Windows).
Compliance
CIS Office Benchmark L1, BIO 12.02 (Macro blocking), DISA STIG, Microsoft Security Baseline.
Monitoring
Gebruik PowerShell-script block-macros-from-internet.ps1 (functie Invoke-Monitoring) – Controleren.
Remediatie
Gebruik PowerShell-script block-macros-from-internet.ps1 (functie Invoke-Remediation) – Herstellen.
Compliance & Frameworks
CIS M365: Control Office - Macro blocking (L1) -
BIO: 12.02.01 -
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 macros van internet bestanden in Publisher
.DESCRIPTION
Dit script implementeert CIS control O365-PU-000003 voor het blokkeren van macros in
Publisher bestanden van het internet in Microsoft Publisher. Dit voorkomt uitvoering van
potentieel schadelijke macros uit niet-vertrouwde bronnen.
.REQUIREMENTS
- PowerShell 5.1 of hoger
- Lokale administrator rechten voor registry wijzigingen
- Microsoft Publisher 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
.\block-macros-from-internet.ps1 -Monitoring
Controleert of macros van internet zijn geblokkeerd
.EXAMPLE
.\block-macros-from-internet.ps1 -Remediation
Blokkeert macros van internet bestanden
.NOTES
Registry pad: HKCU:\Software\Policies\Microsoft\Office\16.0\Publisher\Security\TrustCenter
Waarde: BlockContentExecutionFromInternet = 1
CIS Control: O365-PU-000003
DISA STIG: Microsoft Office 365 ProPlus v3r3
#>#Requires -Version 5.1param(
[switch]$Monitoring,
[switch]$Remediation,
[switch]$Revert,
[switch]$WhatIf
)
# Globale variabelen$RegistryPath = "HKCU:\Software\Policies\Microsoft\Office\16.0\Publisher\Security\TrustCenter"
$ValueName = "BlockContentExecutionFromInternet"
$ExpectedValue = 1$ControlID = "O365-PU-000003"
functionTest-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}: Macros van internet blokkeren" -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 (Macros van internet 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}: Macros van internet blokkeren" -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 1return Invoke-Monitoring
}
catch {
Write-Host "✗ Fout bij configureren registry instelling: $($_.Exception.Message)" -ForegroundColor Red
return$false
}
}
function Invoke-Revert {
Write-Host "Reverting ${ControlID}: Macros van internet 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 uitvoeringtry {
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: .\block-macros-from-internet.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 Publisher 2016" -ForegroundColor White
Write-Host "> Publisher Options > Security > Trust Center" -ForegroundColor White
Write-Host "> Block macros from running in Office files from the internet: Enabled" -ForegroundColor White
}
}
catch {
Write-Host "✗ Onverwachte fout: $($_.Exception.Message)" -ForegroundColor Red
exit 1
}
Risico zonder implementatie
Risico zonder implementatie
High: Hoog: Publisher macro malware via email/downloads.
Management Samenvatting
Block Publisher VBA macros from internet (MOTW). Malware prevention. Internal macros: OK. Implementatie: 1-2 uur.