Excel Bestandsvalidatie Failures In Beveiligde Weergave Zonder Edit

πŸ’Ό Management Samenvatting

Excel bestanden die Bestandsvalidatie falen moeten worden geopend in Beveiligde weergave ZONDER edit mogelijkheid om exploit attempts via malformed files te voorkomen.

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

Bestandsvalidatie is MALWARE detectie: Excel valideert file structure tegen specificatie. MALFORMED FILES is EXPLOIT ATTEMPTS: Attackers manipuleren file structure om parser bugs te exploiten (buffer overflows, heap corruption). Bestandsvalidatie FAILURES indicate: Possible exploit attempt, Corrupted file, Malware obfuscation. Beveiligde weergave DEFENSE: Opens file in sandbox (read-only), kan niet execute macros, kan niet exploit vulnerabilities (sandboxed). NO EDIT MODE: If gebruiker kan Schakel in editing β†’ exploits mogelijk, No edit is volledige bescherming.

PowerShell Modules Vereist
Primary API: Intune / Group Policy
Connection: Registry
Required Modules:

Implementatie

Beveiligde weergave no edit: Registry policy. EFFECT: Failed validatie files β†’ Beveiligde weergave zonder Edit button.

Vereisten

  1. Excel
  2. Bestandsvalidatie ingeschakeld (separate control)

Implementatie

Gebruik PowerShell-script file-validatie-protected-view-no-edit.ps1 (functie Invoke-Remediation) – Configureer Beveiligde weergave no edit.

monitoring

Gebruik PowerShell-script file-validation-protected-view-no-edit.ps1 (functie Invoke-Monitoring) – Controleren.

Compliance en Auditing

  1. DISA STIG O365-EX-000033
  2. BIO 12.02

Remediatie

Gebruik PowerShell-script file-validation-protected-view-no-edit.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 Dwingt bestanden die niet voldoen aan bestandsvalidatie te openen in Protected View zonder bewerkingsmogelijkheid .DESCRIPTION Dit script implementeert CIS control O365-EX-000033 voor het openen van bestanden die niet voldoen aan bestandsvalidatie in Protected View zonder bewerkingsmogelijkheid in Microsoft Excel. Dit voorkomt dat potentieel schadelijke bestanden kunnen worden bewerkt. .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 .\file-validation-protected-view-no-edit.ps1 -Monitoring Controleert of bestanden in Protected View zonder bewerking worden geopend .EXAMPLE .\file-validation-protected-view-no-edit.ps1 -Remediation Dwingt Protected View zonder bewerking voor niet-gevalideerde bestanden .NOTES Registry pad: HKCU:\Software\Policies\Microsoft\Office\16.0\Excel\Security\FileValidation Waarden: OpenInProtectedView = 1, DisallowEdit = 1 CIS Control: O365-EX-000033 #> #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\FileValidation" $ValueName1 = "OpenInProtectedView" $ValueName2 = "DisallowEdit" $ExpectedValue = 1 $ControlID = "O365-EX-000033" function Test-Compliance { try { if (-not (Test-Path $RegistryPath)) { return $false } $v1 = Get-ItemProperty -Path $RegistryPath -Name $ValueName1 -ErrorAction SilentlyContinue $v2 = Get-ItemProperty -Path $RegistryPath -Name $ValueName2 -ErrorAction SilentlyContinue return (($v1 -and $v1.$ValueName1 -eq $ExpectedValue) -and ($v2 -and $v2.$ValueName2 -eq $ExpectedValue)) } catch { return $false } } function Invoke-Monitoring { Write-Host "Monitoring ${ControlID}: Protected View zonder bewerking voor niet-gevalideerde bestanden" -ForegroundColor Green try { if (-not (Test-Path $RegistryPath)) { Write-Host "βœ— Registry pad bestaat niet: $RegistryPath" -ForegroundColor Red return $false } $v1 = Get-ItemProperty -Path $RegistryPath -Name $ValueName1 -ErrorAction SilentlyContinue $v2 = Get-ItemProperty -Path $RegistryPath -Name $ValueName2 -ErrorAction SilentlyContinue $compliant = (($v1 -and $v1.$ValueName1 -eq $ExpectedValue) -and ($v2 -and $v2.$ValueName2 -eq $ExpectedValue)) if ($compliant) { Write-Host "βœ“ Control compliant: ${ValueName1} = $ExpectedValue, ${ValueName2} = $ExpectedValue" -ForegroundColor Green return $true } else { $actualValue1 = if ($v1) { $v1.$ValueName1 } else { "Not Set" } $actualValue2 = if ($v2) { $v2.$ValueName2 } else { "Not Set" } Write-Host "βœ— Control non-compliant: ${ValueName1} = $actualValue1, ${ValueName2} = $actualValue2 (Expected: both = $ExpectedValue)" -ForegroundColor Red return $false } } catch { Write-Host "βœ— Fout bij controleren registry instellingen: $($_.Exception.Message)" -ForegroundColor Red return $false } } function Invoke-Remediation { Write-Host "Remediating ${ControlID}: Protected View zonder bewerking voor niet-gevalideerde bestanden" -ForegroundColor Yellow try { if ($WhatIf) { Write-Host "WhatIf: Zou registry waarden instellen: ${ValueName1} = $ExpectedValue, ${ValueName2} = $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 $ValueName1 -Value $ExpectedValue -Type DWord -Force Set-ItemProperty -Path $RegistryPath -Name $ValueName2 -Value $ExpectedValue -Type DWord -Force Write-Host "βœ“ Registry waarden succesvol ingesteld" -ForegroundColor Green Start-Sleep -Seconds 1 return Invoke-Monitoring } catch { Write-Host "βœ— Fout bij configureren registry instellingen: $($_.Exception.Message)" -ForegroundColor Red return $false } } function Invoke-Revert { Write-Host "Reverting ${ControlID}: Protected View instellingen herstellen" -ForegroundColor Yellow try { if ($WhatIf) { Write-Host "WhatIf: Zou registry waarden verwijderen: ${ValueName1}, ${ValueName2}" -ForegroundColor Cyan return $true } if (Test-Path $RegistryPath) { Remove-ItemProperty -Path $RegistryPath -Name $ValueName1 -ErrorAction SilentlyContinue Remove-ItemProperty -Path $RegistryPath -Name $ValueName2 -ErrorAction SilentlyContinue Write-Host "βœ“ Registry waarden verwijderd" -ForegroundColor Green } return $true } catch { Write-Host "βœ— Fout bij herstellen registry instellingen: $($_.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: .\file-validation-protected-view-no-edit.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 exploit risico via malformed Excel files.

Management Samenvatting

Failed Bestandsvalidatie β†’ Beveiligde weergave no edit. Exploit prevention. DISA STIG. Implementatie: 30-60 min.