MD-102 Giai đoạn 2 – Defender Module 17
17

Microsoft Defender Antivirus

Scan Types • Cloud-delivered Protection • Exclusions • Tamper Protection • Update Signatures • Intune AV Policy

Defender AV Microsoft Intune MD-102 GĐ2

01 · Lý thuyết

Defender Antivirus – Kiến trúc bảo vệ đa lớp

Microsoft Defender Antivirus (MDAV) là AV tích hợp sẵn trong Windows 10/11, không cần cài thêm. Trong môi trường doanh nghiệp, quản lý qua Intune Endpoint Security → Antivirus.

Lớp bảo vệCơ chếBảo vệ khỏi
Real-time protectionMonitor file I/O, process creation liên tụcMalware chạy ngay lập tức
Cloud-delivered protectionGửi hash/sample lên Microsoft cloud để phân tíchZero-day, new malware chưa có signature
Automatic sample submissionGửi suspicious files lên MicrosoftTăng độ chính xác cloud detection
Scheduled scanQuét toàn bộ hoặc quick scan theo lịchMalware đang nằm im không chạy
Tamper protectionNgăn registry/service MDAV bị modifyMalware tự tắt AV
PUA protectionPhát hiện Potentially Unwanted ApplicationsAdware, browser hijackers, miners

Scan Types – Các loại quét

Loại scanPhạm viThời gianKhi nào dùng
Quick ScanRegistry, startup locations, running processes, memory1–5 phútHàng ngày, scheduled mặc định
Full ScanToàn bộ ổ đĩa, tất cả file30 phút – vài giờHàng tuần, sau incident
Custom ScanThư mục/file cụ thểPhụ thuộc scopeKiểm tra thư mục đáng ngờ cụ thể
Offline ScanBoot vào WinPE, quét trước OS load15–30 phútRootkit/bootkit đã bypass normal scan

Exclusions – Loại trừ để tránh false positive

Exclusions cần thiết cho các ứng dụng doanh nghiệp bị AV quét chậm, nhưng phải cẩn thận vì exclusion sai có thể tạo lỗ hổng bảo mật:

Loại exclusionVí dụLưu ý
File pathC:\SAP\sapjvm\bin\sapjvm.exeChỉ exclude file cụ thể, không exclude toàn folder
File extension.pst, .ost (Outlook data files)Cẩn thận — malware có thể giả extension
Folder pathC:\Program Files\SQL Server\Chỉ dùng cho database/dev environments
Processsqlservr.exe, javaw.exeRisky — malware có thể mạo danh process

Tamper Protection – Ngăn malware tắt AV

Tamper Protection ngăn kẻ tấn công (hoặc malware) vô hiệu hóa MDAV bằng cách:

  • Block thay đổi registry keys của MDAV (HKLM\SOFTWARE\Microsoft\Windows Defender)
  • Block stop/disable service MsSense, WdNisSvc, WinDefend
  • Block PowerShell commands tắt real-time protection
  • Khi Tamper Protection bật: chỉ Intune/MDE portal mới có thể thay đổi MDAV settings
Signature updates: MDAV tự update signature mỗi 24 giờ mặc định qua Windows Update/Microsoft Update. Trong môi trường không có internet, cần WSUS hoặc download signature thủ công từ Microsoft Security Intelligence.

02 · Thực hành

Lab A: Tạo Antivirus Policy qua Intune

Thực hành tại: intune.microsoft.com → Endpoint security → Antivirus

  1. Vào Endpoint securityAntivirusCreate Policy
  2. Platform: Windows 10, Windows 11, and Windows Server
    Profile: Microsoft Defender Antivirus
  3. Name: AV-Corp-Standard-Policy
  4. Cấu hình:
    • Cloud-delivered protection: Enabled
    • Cloud-delivered protection level: High
    • Automatic sample submission: Send all samples automatically
    • Real-time protection: Enabled
    • Potentially unwanted app protection: Block
    • Tamper protection: Enabled
  5. Scheduled scan:
    • Scan type: Quick scan
    • Day of week: Everyday
    • Scheduled scan start time: 120 (2:00 AM)
  6. Exclusions: (chỉ thêm nếu thực sự cần)
    • Excluded paths: C:\Program Files\SAP\
    • Excluded extensions: .pst .ost
  7. Assign to All Devices → Create

Lab B: Kiểm tra và quản lý MDAV bằng PowerShell

# Kiểm tra trạng thái MDAV Get-MpComputerStatus | Select-Object AMRunningMode, RealTimeProtectionEnabled, AntivirusEnabled, AntispywareEnabled, TamperProtectionSource, AntivirusSignatureLastUpdated, AntivirusSignatureVersion, NISSignatureVersion # Kiểm tra threats đã phát hiện Get-MpThreatDetection | Select-Object ThreatID, ProcessName, Resources, DetectionSourceTypeID, ActionSuccess, InitialDetectionTime | Sort-Object InitialDetectionTime -Descending | Select-Object -First 10 # Chạy Quick Scan ngay lập tức Start-MpScan -ScanType QuickScan # Update signature ngay lập tức Update-MpSignature # Kiểm tra quarantined items Get-MpThreat | Where-Object { $_.IsActive -eq $false } | Select-Object ThreatName, SeverityID, Resources
AMRunningMode : Normal RealTimeProtectionEnabled : True AntivirusEnabled : True TamperProtectionSource : Intune AntivirusSignatureLastUpdated: 2024-03-15T06:00:00Z AntivirusSignatureVersion : 1.407.34.0 # Get-MpThreatDetection: ThreatID ProcessName DetectionSourceTypeID ActionSuccess -------- ----------- --------------------- ------------- 196570 EICAR_Test_File 1 (User) True # (EICAR là test virus vô hại để verify AV đang hoạt động) # Sau Update-MpSignature: Definitions already up to date. Version: 1.407.34.0

Lab C: Test AV với EICAR file

# EICAR = European Institute for Computer Antivirus Research # File test vô hại 68 bytes, mọi AV đều phải phát hiện # Đây là cách chuẩn để verify AV đang hoạt động # Tạo EICAR test file (sẽ bị AV delete ngay) $eicarContent = 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' Set-Content -Path "C:\Temp\eicar-test.txt" -Value $eicarContent -NoNewline # Nếu AV hoạt động đúng: file bị delete trong vài giây Start-Sleep -Seconds 3 if (-not (Test-Path "C:\Temp\eicar-test.txt")) { Write-Host "SUCCESS: MDAV detected and removed EICAR test file" -ForegroundColor Green } else { Write-Host "WARNING: EICAR file not removed - check AV status!" -ForegroundColor Red }
SUCCESS: MDAV detected and removed EICAR test file # Windows Security notification hiện lên: # "Threat found: Virus:DOS/EICAR_Test_File" # Action taken: Removed # Alert visible in: security.microsoft.com → Incidents & Alerts

Lab D: Thêm Exclusion qua Graph PowerShell

Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All" # Lấy AV policy ID hiện có $avPolicies = Invoke-MgGraphRequest -Method GET ` -Uri "https://graph.microsoft.com/beta/deviceManagement/configurationPolicies?`$filter=templateReference/templateDisplayName eq 'Microsoft Defender Antivirus'" $policyId = $avPolicies.value[0].id # Update policy thêm exclusion cho SAP $updateBody = @{ settings = @( @{ settingInstance = @{ "@odata.type" = "#microsoft.graph.deviceManagementConfigurationSimpleSettingCollectionInstance" settingDefinitionId = "device_vendor_msft_defender_exclusions_paths" simpleSettingCollectionValue = @( @{ "@odata.type" = "#microsoft.graph.deviceManagementConfigurationStringSettingValue" value = "C:\\Program Files\\SAP\\" } ) } } ) } | ConvertTo-Json -Depth 10 Invoke-MgGraphRequest -Method PATCH ` -Uri "https://graph.microsoft.com/beta/deviceManagement/configurationPolicies/$policyId" ` -Body $updateBody -ContentType "application/json" Write-Host "Exclusion added for SAP folder"

03 · Tình huống thực tế

Tập đoàn Dệt May Vinatex – Ransomware outbreak và giải pháp phòng ngừa

Vinatex bị tấn công ransomware WannaCry-variant vào năm 2023, lây lan qua 200 máy trong 2 giờ trước khi phát hiện. Nguyên nhân: Windows 7 chưa patch, AV signature cũ 45 ngày, real-time protection bị disable bởi một số user.

Giải pháp sau incident:

  • Tamper Protection bật toàn bộ: User không còn có thể tắt AV từ Windows Security UI
  • Cloud protection = High: Block zero-day ngay khi gặp, không chờ signature update
  • Signature update SLA: Compliance policy check signature age ≤ 7 ngày → non-compliant nếu quá hạn
  • Scheduled Full Scan: Mỗi Chủ Nhật 2:00 AM (ngoài giờ làm việc)
  • MDE onboarding: Kết hợp AV với EDR → phát hiện lateral movement sớm hơn nhiều

Kết quả sau 6 tháng:

  • • 0 ransomware incident — cloud protection block 14 suspicious files trước khi execute
  • • 100% máy Tamper Protection enabled — không còn user tắt AV
  • • Signature compliance: 99.1% máy có signature ≤ 24 giờ