Microsoft Security Baseline, BIO 12.02 (Block legacy tech), DISA STIG.
Monitoring
Gebruik PowerShell-script restrict-legacy-jscript.ps1 (functie Invoke-Monitoring) – Controleren.
Remediatie
Gebruik PowerShell-script restrict-legacy-jscript.ps1 (functie Invoke-Remediation) – Herstellen.
Compliance & Frameworks
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
Beperkt legacy JScript uitvoering voor Office
.DESCRIPTION
Dit script implementeert Microsoft Security Guide control voor het beperken van legacy
JScript uitvoering in Office applicaties. Legacy JScript kan een beveiligingsrisico vormen
en moet worden beperkt tot veilige contexten.
Deze control vereist handmatige configuratie via Group Policy omdat de exacte registry
implementatie nog niet volledig is gedocumenteerd door Microsoft.
.REQUIREMENTS
- PowerShell 5.1 of hoger
- Lokale administrator rechten voor Group Policy wijzigingen
- Microsoft Office geïnstalleerd
.PARAMETER Monitoring
Controleert de huidige compliance status
.PARAMETER Remediation
Toont handmatige configuratie instructies
.PARAMETER Revert
Toont instructies voor herstellen
.PARAMETER WhatIf
Toont wat er zou gebeuren zonder wijzigingen door te voeren
.EXAMPLE
.\restrict-legacy-jscript.ps1 -Monitoring
Controleert of legacy JScript is beperkt
.EXAMPLE
.\restrict-legacy-jscript.ps1 -Remediation
Toont instructies voor het beperken van legacy JScript
.NOTES
Microsoft Security Guide Control: Restrict legacy JScript execution for Office
Handmatige configuratie vereist via Group Policy
#>#Requires -Version 5.1param(
[switch]$Monitoring,
[switch]$Remediation,
[switch]$Revert,
[switch]$WhatIf
)
# Globale variabelen$ControlID = "MSG-OFFICE-JSCRIPT"
functionTest-Compliance {
# Deze control vereist handmatige verificatiereturn$false
}
function Invoke-Monitoring {
Write-Host "Monitoring ${ControlID}: Legacy JScript uitvoering beperken voor Office" -ForegroundColor Green
Write-Host "`nDeze control vereist HANDMATIGE VERIFICATIE:" -ForegroundColor Yellow
Write-Host ""
Write-Host "CONTROLE STAPPEN:" -ForegroundColor Cyan
Write-Host "1. Open Group Policy Management Console (gpedit.msc)" -ForegroundColor White
Write-Host "2. Navigeer naar: User Configuration > Administrative Templates > Microsoft Office 2016" -ForegroundColor White
Write-Host "3. Zoek naar: 'Restrict legacy JScript execution for Office'" -ForegroundColor White
Write-Host "4. Verifieer dat de policy is ingesteld op: Enabled" -ForegroundColor White
Write-Host ""
Write-Host "ALTERNATIEF via Registry:" -ForegroundColor Cyan
Write-Host "Path: HKCU:\Software\Policies\Microsoft\Office\16.0\Common\Security" -ForegroundColor White
Write-Host "Value: DisableVBScript = 1 (indien beschikbaar)" -ForegroundColor White
return$false
}
function Invoke-Remediation {
Write-Host "Remediating ${ControlID}: Legacy JScript uitvoering beperken voor Office" -ForegroundColor Yellow
Write-Host "`nDeze control vereist HANDMATIGE CONFIGURATIE:" -ForegroundColor Yellow
Write-Host ""
Write-Host "REMEDIATION STAPPEN:" -ForegroundColor Cyan
Write-Host "1. Open Group Policy Management Console (gpedit.msc)" -ForegroundColor White
Write-Host "2. Navigeer naar: User Configuration > Administrative Templates > Microsoft Office 2016" -ForegroundColor White
Write-Host "3. Zoek naar: 'Restrict legacy JScript execution for Office'" -ForegroundColor White
Write-Host "4. Dubbelklik op de policy" -ForegroundColor White
Write-Host "5. Selecteer: Enabled" -ForegroundColor White
Write-Host "6. Klik op: OK" -ForegroundColor White
Write-Host "7. Run 'gpupdate /force' om policy toe te passen" -ForegroundColor White
Write-Host ""
Write-Host "RATIONALE:" -ForegroundColor Cyan
Write-Host "Legacy JScript en VBScript in Office kunnen worden misbruikt voor code execution." -ForegroundColor White
Write-Host "Deze moeten worden beperkt tot veilige, gecontroleerde contexten." -ForegroundColor White
return$false
}
function Invoke-Revert {
Write-Host "Reverting ${ControlID}: Legacy JScript beperking herstellen" -ForegroundColor Yellow
Write-Host "`nHERSTEL STAPPEN:" -ForegroundColor Cyan
Write-Host "1. Open Group Policy Management Console (gpedit.msc)" -ForegroundColor White
Write-Host "2. Navigeer naar: User Configuration > Administrative Templates > Microsoft Office 2016" -ForegroundColor White
Write-Host "3. Zoek naar: 'Restrict legacy JScript execution for Office'" -ForegroundColor White
Write-Host "4. Dubbelklik op de policy" -ForegroundColor White
Write-Host "5. Selecteer: Not Configured (of Disabled)" -ForegroundColor White
Write-Host "6. Klik op: OK" -ForegroundColor White
Write-Host "7. Run 'gpupdate /force' om policy toe te passen" -ForegroundColor White
return$false
}
# Hoofd uitvoeringtry {
if ($Monitoring) {
$result = Invoke-Monitoring
exit 1
}
elseif ($Remediation) {
$result = Invoke-Remediation
exit 1
}
elseif ($Revert) {
$result = Invoke-Revert
exit 0
}
else {
Write-Host "Gebruik: .\restrict-legacy-jscript.ps1 [-Monitoring] [-Remediation] [-Revert] [-WhatIf]" -ForegroundColor Yellow
Write-Host " -Monitoring: Controleer huidige compliance status" -ForegroundColor White
Write-Host " -Remediation: Toon handmatige configuratie instructies" -ForegroundColor White
Write-Host " -Revert: Toon instructies voor herstellen" -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: Legacy JScript = malware delivery (WSH .js files - no user interaction).