Detect Video Capture in Microsoft Sentinel
Adversaries may leverage a computer's peripheral devices (e.g., integrated cameras or webcams) or applications (e.g., video call services) to capture video recordings for the purpose of gathering information. Images may also be captured from devices or applications, potentially in specified intervals, in lieu of video files. Malware or scripts may interact with webcam devices through OS or application APIs such as the Windows Video Capture API (avicap32.dll), DirectShow, Windows Media Foundation, or platform-specific libraries on macOS and Linux. Captured video or image files may be written to disk and exfiltrated later. Threat actors including Transparent Tribe (Crimson RAT), Silence Group, and tools such as Empire, NanoCore, Agent Tesla, and PoetRAT have demonstrated active use of this technique.
MITRE ATT&CK
- Tactic
- Collection
- Technique
- T1125 Video Capture
- Canonical reference
- https://attack.mitre.org/techniques/T1125/
KQL Detection Query
let KnownMediaApps = dynamic([
"Teams.exe", "zoom.exe", "Skype.exe", "slack.exe", "webex.exe",
"chrome.exe", "msedge.exe", "firefox.exe", "obs64.exe", "obs32.exe",
"CameraApp.exe", "VideoCapture.exe", "vlc.exe", "ffmpeg.exe",
"WindowsCamera.exe", "SnippingTool.exe", "mspaint.exe"
]);
let SuspiciousVideoPaths = dynamic([
"\\AppData\\Local\\Temp\\", "\\AppData\\Roaming\\",
"\\ProgramData\\", "\\Users\\Public\\",
"\\Windows\\Temp\\", "\\Temp\\"
]);
let VideoExtensions = dynamic([".avi", ".mp4", ".wmv", ".mkv", ".mov", ".flv", ".m4v"]);
// Branch 1: Suspicious DLL image load of avicap32.dll by non-media processes
let AvicapLoads = DeviceImageLoadEvents
| where Timestamp > ago(24h)
| where FileName =~ "avicap32.dll" or FileName =~ "vfw32.dll"
| where not(InitiatingProcessFileName has_any (KnownMediaApps))
| project Timestamp, DeviceName, AccountName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessParentFileName, FileName,
DetectionSource = "AvicapDLLLoad";
// Branch 2: Video file creation in suspicious paths by non-media processes
let VideoFileCreation = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType == "FileCreated"
| where FileName has_any (VideoExtensions)
| where FolderPath has_any (SuspiciousVideoPaths)
| where not(InitiatingProcessFileName has_any (KnownMediaApps))
| project Timestamp, DeviceName, AccountName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessParentFileName,
FileName = strcat(FolderPath, "\\", FileName),
DetectionSource = "SuspiciousVideoFileCreation";
// Branch 3: Process accessing camera device objects (via registry device enumeration)
let CameraRegistryAccess = DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_any ("KSCATEGORY_VIDEO_CAMERA", "KSCATEGORY_CAPTURE",
"USB\\VID_", "Image\\Windows\\CurrentVersion\\Uninstall")
| where RegistryKey has "Camera" or RegistryKey has "Webcam" or RegistryKey has "VideoCapture"
| where not(InitiatingProcessFileName has_any (KnownMediaApps))
| where not(InitiatingProcessFileName has_any ("svchost.exe", "System", "WmiPrvSE.exe", "DeviceEnumerator.exe"))
| project Timestamp, DeviceName, AccountName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessParentFileName,
FileName = RegistryKey,
DetectionSource = "CameraRegistryAccess";
union AvicapLoads, VideoFileCreation, CameraRegistryAccess
| sort by Timestamp desc Detects webcam and video capture activity by non-media applications using three complementary approaches: (1) loading of avicap32.dll or vfw32.dll (legacy Windows Video Capture API) by processes not associated with legitimate media software; (2) creation of video files (AVI, MP4, WMV, etc.) in suspicious directories such as Temp, AppData, or ProgramData by non-media processes; (3) registry key access to camera device categories (KSCATEGORY_VIDEO_CAMERA, KSCATEGORY_CAPTURE) by unexpected processes. Known legitimate media applications (Teams, Zoom, Skype, OBS, browser processes) are excluded to reduce false positives.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate video conferencing applications (Zoom, Teams, Webex, Skype) that may not be in the exclusion list if installed to non-default paths
- Screen recording and productivity tools (OBS Studio, Camtasia, Loom, ShareX) used by developers or content creators
- IT asset management or device inventory tools that enumerate camera hardware through registry keys
- Security camera management software or driver update utilities that interact with webcam device APIs
- Development/testing environments where developers are building applications that interact with webcam APIs
Other platforms for T1125
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Webcam Access via avicap32.dll (Windows Legacy API)
Expected signal: Sysmon Event ID 7 (Image Load): Image=powershell.exe, ImageLoaded=C:\Windows\System32\avicap32.dll. Sysmon Event ID 1 (Process Create): CommandLine will contain 'avicap32.dll' and 'capCreateCaptureWindowA'. PowerShell Script Block Log Event ID 4104 with the full P/Invoke code.
- Test 2Video File Creation in Temp Directory Simulation
Expected signal: Sysmon Event ID 11 (File Create): Image=powershell.exe, TargetFilename=C:\Users\<user>\AppData\Local\Temp\capture_<timestamp>.avi. File will contain RIFF header bytes matching AVI format. Sysmon Event ID 1 (Process Create) for the PowerShell process.
- Test 3Webcam Capture via Python OpenCV (Cross-Platform)
Expected signal: Sysmon Event ID 1 (Process Create): Image=python3.exe (or python.exe), CommandLine contains 'cv2.VideoCapture' and 'imwrite'. Sysmon Event ID 7 (Image Load): opencv_videoio*.dll or _cv2.pyd loaded by python3.exe. Sysmon Event ID 11 (File Create): TargetFilename matching frame_<timestamp>.jpg in %TEMP%.
- Test 4Webcam Capture Using ffmpeg (Common RAT Dependency)
Expected signal: Sysmon Event ID 1 (Process Create): Image=ffmpeg.exe, CommandLine contains '-f dshow' and '-i video=' and the output .mp4 path in %TEMP%. Sysmon Event ID 11 (File Create): TargetFilename matching *.mp4 in %TEMP% with Image=ffmpeg.exe. DeviceNetworkEvents (KQL) should be clean for this test — ffmpeg does not make network connections in offline capture mode.
References (11)
- https://attack.mitre.org/techniques/T1125/
- https://objective-see.com/blog/blog_0x25.html
- https://learn.microsoft.com/en-us/windows/win32/multimedia/video-capture
- https://learn.microsoft.com/en-us/windows/win32/medfound/microsoft-media-foundation-sdk
- https://www.proofpoint.com/us/threat-insight/post/new-poison-ivy-rat-variant-targets-us-government-employees
- https://securelist.com/the-machete-apt/98121/
- https://blog.talosintelligence.com/2020/04/poetrat-targets-azerbaijan.html
- https://www.group-ib.com/resources/threat-research/silence_moving_into_the_darkside.pdf
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1125/T1125.md
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceimageloadevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
Unlock Pro Content
Get the full detection package for T1125 including response playbook, investigation guide, and atomic red team tests.