Detect Potential Cleartext Credentials in Command Line
KQL Queries
DeviceProcessEvents
| where Timestamp > ago(7d) // Adjust the time frame as needed
| where ProcessCommandLine has_any ("password", "pwd", "pass", "secret", "key", "credential", "login")
| extend SuspiciousWords = extract_all(@"(?i)(password\s*[:=]\s*\S+|pwd\s*[:=]\s*\S+|pass\s*[:=]\s*\S+|secret\s*[:=]\s*\S+|key\s*[:=]\s*\S+|credential\s*[:=]\s*\S+|login\s*[:=]\s*\S+)", ProcessCommandLine)
| where array_length(SuspiciousWords) > 0
| project Timestamp, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine, SuspiciousWords
| extend AccountDomain = tostring(split(AccountName, "\\", 0)), Username = tostring(split(AccountName, "\\", 1))
| summarize Count = count(), Commands = make_set(ProcessCommandLine) by Timestamp, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine
| order by Count descKey Features of the Query:
How It Works:
Use Case Scenarios:
PreviousIdentifying Split or Part Archive File TransfersNextDetecting Command Line Interpreters Launched via Scheduled Tasks
Last updated