💼 Management Samenvatting
Het blokkeren van aangepaste scripts op SharePoint sites voorkomt Cross-Site Scripting (XSS) aanvallen, malicious Code injectie aanvallen en data exfiltratie door te voorkomen dat gebruikers of site owners client-side scripts kunnen embedden in pages, web parts of aangepaste solutions.
✓ M365
aangepaste script capabilities in SharePoint maken het mogelijk om JavaScript code te embedden in pages, web parts en master pages. Dit introduceert ernstige security risks: Cross-Site Scripting (XSS) attacks waarbij malicious JavaScript credentials steelt, keylogging Implementeereert of phishing overlays toont; Data exfiltration door scripts die document content naar externe servers sturen; sessie hijacking via cookie theft; Persistent backdoors in site collections die moeilijk te detecteren zijn; Bypassing van DLP beleidsregels door client-side versleuteling; Malicious iframes die externe malware hosten. Real-world scenario: Een gecompromitteerde site beheerdersaccount voegt malicious script toe aan SharePoint homepage → Script executes voor alle site visitors → credentials worden gestolen → Lateral movement door organization. aangepaste scripts zijn ook zeer moeilijk te auditen - er zijn honderden plekken waar scripts embedded kunnen zijn (web parts, page layouts, master pages, site columns, content types). Het blokkeren van aangepaste scripts via DenyAddAndCustomizePages elimineert deze Aanvalsoppervlak volledig. Site functionality blijft volledig behouden - moderne SharePoint features zoals web parts, document libraries, lists werken normaal. Alleen legacy aangepaste script injection wordt geblokkeerd.
Connection:
Connect-SPOServiceRequired Modules: Microsoft.Online.SharePoint.PowerShell
Implementatie
Deze control verifieert dat de DenyAddAndCustomizePages property is gezet op True voor alle SharePoint site collections. Deze setting voorkomt: Uploaden van aangepaste master pages en page layouts, Gebruik van SharePoint Designer voor site aanpassingen, Embedden van JavaScript in content editor web parts, aangepaste script injection via site columns/content types, User aangepaste actions met embedded scripts, en iFrames met external sources. De setting dwingt af dat alleen Microsoft-approved, security-reviewed SharePoint features kunnen worden gebruikt. Exception: Communication sites en moderne team sites hebben stricter regelt en aangepaste scripts zijn standaard al blocked. Legacy classic sites vereisen expliciete DenyAddAndCustomizePages is True. Implementeeratie: Per site via Set-SPOSite -DenyAddAndCustomizePages $true of tenant-wide Standaard beleid.
- FASE 1 - INVENTORY (Week 1): List alle site collections: Get-SPOSite -Limit All, Controleer aangepaste script status: Get-SPOSite | Select Url,DenyAddAndCustomizePages, Identify sites met DenyAddAndCustomizePages is False (aangepaste scripts allowed), Document business justification voor aangepaste scripts
- FASE 2 - beoordeling (Week 2-3): Voor sites met aangepaste scripts Schakel ind: Audit wat exact gebruikt wordt (SharePoint Designer customizations? Content Editor Web Parts? aangepaste master pages?), Evaluate alternatieven: Modern web parts, SPFx solutions (security-reviewed), Power Apps, Review impact op site functionality
- FASE 3 - MIGRATION (Week 4-6): Migreer aangepaste solutions naar moderne alternatieven, Test functionality op development sites, Obtain site owner sign-off, Document migration voor audittrail
- FASE 4 - ENFORCEMENT (Week 7+): Schakel in DenyAddAndCustomizePages voor alle sites via Set-SPOSite -Identity
-DenyAddAndCustomizePages $true, Set tenant Standaard voor nieuwe sites, monitoren voor ondersteunen tickets, Review exceptions quarterly - Stap 1: Verbind met SharePoint Online: Connect-SPOService -Url https://TENANT-admin.sharepoint.com
- Stap 2: List non-compliant sites: Get-SPOSite -Limit alle | Where-Object {$_.DenyAddAndCustomizePages -eq $false} | Select Url
- Stap 3: Schakel in voor specifieke site: Set-SPOSite -Identity
-DenyAddAndCustomizePages $true - Stap 4: Bulk Schakel in voor alle sites: Get-SPOSite -Limit alle | Set-SPOSite -DenyAddAndCustomizePages $true
- Stap 5: Verifieer: Get-SPOSite -Limit alle | Where-Object {$_.DenyAddAndCustomizePages -eq $false} (should return nul results)
Vereisten
Voor het Implementeereren van deze control zijn de volgende vereisten van toepassing:
- SharePoint Online subscription (deel van M365)
- SharePoint Administrator of Globale beheerder rechtenistrator rol
- PowerShell met Microsoft.Online.SharePoint.PowerShell module
- Inventarisatie van legacy aangepaste solutions (kunnen worden impacted)
- Migration plan voor sites die aangepaste scripts gebruiken (migreer naar moderne alternatieven)
- Testing environment voor verification
- Communication naar site owners over aangepaste script restrictions
Implementeeratie
GEFASEERDE ImplementeerATIE (AANBEVOLEN):
- FASE 1 - INVENTORY (Week 1): List alle site collections: Get-SPOSite -Limit All, Controleer aangepaste script status: Get-SPOSite | Select Url,DenyAddAndCustomizePages, Identify sites met DenyAddAndCustomizePages is False (aangepaste scripts allowed), Document business justification voor aangepaste scripts
- FASE 2 - beoordeling (Week 2-3): Voor sites met aangepaste scripts Schakel ind: Audit wat exact gebruikt wordt (SharePoint Designer customizations? Content Editor Web Parts? aangepaste master pages?), Evaluate alternatieven: Modern web parts, SPFx solutions (security-reviewed), Power Apps, Review impact op site functionality
- FASE 3 - MIGRATION (Week 4-6): Migreer aangepaste solutions naar moderne alternatieven, Test functionality op development sites, Obtain site owner sign-off, Document migration voor audittrail
- FASE 4 - ENFORCEMENT (Week 7+): Schakel in DenyAddAndCustomizePages voor alle sites via Set-SPOSite -Identity
-DenyAddAndCustomizePages $true, Set tenant Standaard voor nieuwe sites, monitoren voor ondersteunen tickets, Review exceptions quarterly
Gebruik PowerShell-script custom-script-sites-restricted.ps1 (functie Invoke-Monitoring) – PowerShell script voor auditing van aangepaste script settings over site collections.
PowerShell Implementeeratie:
- Stap 1: Verbind met SharePoint Online: Connect-SPOService -Url https://TENANT-admin.sharepoint.com
- Stap 2: List non-compliant sites: Get-SPOSite -Limit alle | Where-Object {$_.DenyAddAndCustomizePages -eq $false} | Select Url
- Stap 3: Schakel in voor specifieke site: Set-SPOSite -Identity
-DenyAddAndCustomizePages $true - Stap 4: Bulk Schakel in voor alle sites: Get-SPOSite -Limit alle | Set-SPOSite -DenyAddAndCustomizePages $true
- Stap 5: Verifieer: Get-SPOSite -Limit alle | Where-Object {$_.DenyAddAndCustomizePages -eq $false} (should return nul results)
KRITIEK: Test eerst op development/Test sites voordat je tenant-wide Implementeer! aangepaste script blocking kan legacy solutions broken.
monitoring
Gebruik PowerShell-script custom-script-sites-restricted.ps1 (functie Invoke-Monitoring) – Controleert DenyAddAndCustomizePages status voor alle site collections.
Continue monitoring via:
- Weekly: Get-SPOSite audit voor DenyAddAndCustomizePages is False (non-compliant sites)
- Alert op nieuwe sites met aangepaste scripts Schakel ind
- Review SharePoint audit logs: aangepaste script usage attempts (blocked actions)
- Site owner requests voor aangepaste script exceptions (evaluate carefully)
- Quarterly review: Are exceptions nog steeds justified? Can ze worden gemigreerd?
- Security monitoring: XSS attack attempts in audit logs
- User feedback: Broken functionality reports (may indicate dependency op aangepaste scripts)
Remediatie
Gebruik PowerShell-script custom-script-sites-restricted.ps1 (functie Invoke-Remediation) – Herstellen.
Voor sites waar aangepaste scripts nog Schakel ind zijn:
- Immediate: Set-SPOSite -Identity
-DenyAddAndCustomizePages $true - Investigate: Waarom was aangepaste script nodig? Business justification?
- Alternative solutions: Modern web parts, SPFx, Power Apps, SharePoint Framework
- Voor legitimate aangepaste functionality: Develop SPFx solution (security-reviewed, sandboxed)
- Document exception: If aangepaste scripts moet remain (zeer zeldzaam), document risk acceptance, compensating controls, review date
Voor broken functionality na aangepaste script blocking:
- Identify exact functionality die broke (specific web part? Page layout?)
- Option 1: Rebuild met moderne SharePoint features (preferred)
- Option 2: Migrate naar SPFx solution (security-reviewed)
- Option 3: Temporary exception MET approval EN scheduled remediation date
- Option 4: Alternative tools (Power Apps, Power Automate, Azure Functions)
- DO NOT permanent Sta toe aangepaste scripts - find veilige alternative
Compliance en Auditing
Deze control draagt bij aan compliance met meerdere frameworks:
- CIS Microsoft 365 Foundations Benchmark - control 3.1.1 (Zorg ervoor dat SharePoint Online aangepaste script execution is Schakel uitd)
- BIO 14.02.05 - veilige application development - Script injection preventie
- ISO 27001:2022 A.8.23 - Web filtering - Malicious code prevention
- ISO 27001:2022 A.14.2.1 - veilige development beleid
- NIS2 Artikel 21 - Cybersecurity measures - Preventing malicious Code-uitvoering
- OWASP Top 10 A03:2021 - Injection (inclusief XSS attacks)
- PCI-DSS Requirement 6.5.7 - Cross-site scripting (XSS) prevention
- NIST CSF PR.IP-1 - Baseline configurations - Schakel uit unsafe features
Compliance & Frameworks
- CIS M365: Control 3.1.1 (L1) - Zorg ervoor dat SharePoint Online aangepaste script execution is Schakelt uit de op alle sites
- BIO: 14.02.05 - veilige application development - Script injection preventie
- ISO 27001:2022: A.8.23, A.14.2.1 - Web filtering en veilige development beleid
- NIS2: Artikel - Cybersecurity measures - Prevention van malicious Code-uitvoering
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).
Risico zonder implementatie
Management Samenvatting
Blokkeer aangepaste scripts op alle SharePoint sites via DenyAddAndCustomizePages is True. Voorkomt XSS attacks, script injection en data exfiltration. Moderne SharePoint features blijven volledig werken. Voldoet aan CIS 3.1.1 L1, OWASP A03:2021, PCI-DSS 6.5.7. Implementeeratie: 8-16 uur inclusief inventory en migration planning. Voor legacy aangepaste solutions: migreer naar SPFx (security-reviewed) of moderne alternatieven.
- Implementatietijd: 16 uur
- FTE required: 0.2 FTE