Stored Data Manipulation
Adversaries may insert, delete, or manipulate data at rest in order to influence external outcomes or hide activity, thus threatening the integrity of the data. By manipulating stored data, adversaries may attempt to affect a business process, organizational understanding, and decision making. Stored data could include a variety of file formats, such as Office files, databases, stored emails, and custom file formats. Real-world examples include APT38's DYEPACK tool creating, deleting, and altering records in SWIFT banking transaction databases to obscure fraudulent transfers; the SUNSPOT implant (used in the SolarWinds supply chain compromise) that backed up original Orion source files with a .bk extension and wrote trojanized replacements under the original filename; and the MultiLayer Wiper used by Agrius that altered path metadata of deleted files to obstruct forensic recovery.
let CriticalFileExtensions = dynamic([".sql", ".db", ".sqlite", ".mdb", ".accdb", ".dbf", ".csv", ".xlsx", ".xls", ".docx", ".xml", ".json", ".config", ".conf", ".ini", ".cs", ".py", ".js"]);
let BackupExtensions = dynamic([".bk", ".bak", ".orig", ".backup", ".old", ".tmp"]);
let TrustedDBProcesses = dynamic(["sqlservr.exe", "mysqld.exe", "postgres.exe", "mongod.exe", "oracle.exe", "sqlite3.exe", "MsMpEng.exe", "OneDrive.exe", "OUTLOOK.EXE", "EXCEL.EXE", "WINWORD.EXE"]);
// Detect bulk modification of critical data files OR SUNSPOT-style backup-and-replace pattern
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified", "FileRenamed")
| where FileName has_any (CriticalFileExtensions) or FileName has_any (BackupExtensions)
| where not(InitiatingProcessFileName has_any (TrustedDBProcesses))
| extend IsCriticalFile = FileName has_any (CriticalFileExtensions)
| extend IsBackupFile = FileName has_any (BackupExtensions)
| summarize
TotalUniqueFiles = dcount(FileName),
CriticalFileCount = countif(IsCriticalFile),
BackupFileCount = countif(IsBackupFile),
ModifiedFiles = make_set(FileName, 30),
UniqueFolders = dcount(FolderPath),
FirstSeen = min(Timestamp),
LastSeen = max(Timestamp)
by DeviceName, InitiatingProcessFileName, InitiatingProcessAccountName,
InitiatingProcessCommandLine, InitiatingProcessId, bin(Timestamp, 5m)
| where TotalUniqueFiles >= 5
or (BackupFileCount >= 1 and CriticalFileCount >= 1)
| extend DetectionReason = case(
BackupFileCount >= 1 and CriticalFileCount >= 1, "BackupReplacePattern_SUNSPOT_Analog",
TotalUniqueFiles >= 20, "BulkModification_High",
TotalUniqueFiles >= 10, "BulkModification_Medium",
"BulkModification_Low"
)
| extend RiskScore = case(
DetectionReason == "BackupReplacePattern_SUNSPOT_Analog", 90,
DetectionReason == "BulkModification_High", 80,
DetectionReason == "BulkModification_Medium", 60,
40
)
| project FirstSeen, LastSeen, DeviceName, InitiatingProcessAccountName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
TotalUniqueFiles, CriticalFileCount, BackupFileCount,
UniqueFolders, ModifiedFiles, DetectionReason, RiskScore
| sort by RiskScore desc, TotalUniqueFiles desc Data Sources
Required Tables
False Positives
- Software deployment or configuration management tools (Ansible, Chef, Puppet, SCCM) that atomically replace configuration files by writing to a temp file and renaming — creates backup-like patterns with high file counts
- Backup agents (Veeam, Veritas, Acronis, Windows Server Backup) that create .bak copies of databases or config files before snapshotting — triggers both the backup-replace and bulk modification patterns
- Development CI/CD pipelines (GitHub Actions, Jenkins, GitLab CI) that generate, compile, and write multiple source code or config files in rapid succession during build steps
- Antivirus or DLP quarantine operations that move or rename files with modified extensions during remediation workflows
- Database maintenance scripts (index rebuilds, VACUUM, CHECKPOINT operations run by scripts) that write temporary files alongside primary database files
- Document management systems (SharePoint sync, Dropbox, OneDrive) that batch-sync large numbers of Office documents during initial sync or conflict resolution
References (10)
- https://attack.mitre.org/techniques/T1565/001/
- https://www.mandiant.com/sites/default/files/2021-09/rpt-apt38-2018-web_v5-1.pdf
- https://www.justice.gov/opa/press-release/file/1092091/download
- https://unit42.paloaltonetworks.com/agrius-targeting-israel/
- https://www.crowdstrike.com/blog/sunspot-malware-technical-analysis/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1565.001/T1565.001.md
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
- https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon
- https://www.swift.com/your-needs/financial-crime-cyber-security/cyber-security/swift-customer-security-programme-csp
- https://www.cisa.gov/sites/default/files/publications/AA21-048A_Joint-CSA_SolarWinds-Supply-Chain.pdf
Unlock Pro Content
Get the full detection package for T1565.001 including response playbook, investigation guide, and atomic red team tests.