SFTP File transfer folder count above threshold
| Id | 7355434e-09d5-4401-b56d-e03e9379dfb1 |
| Rulename | SFTP File transfer folder count above threshold |
| Description | Identifies SFTP File Transfers with distinct folder count above certain threshold in a 15min time period. It requires SFTP VERBOSE loglevel to be enabled. Please note that entity mapping for arrays is not supported, so when there is a single value in an array, we will pull that value from the array as a single string to populate the entity to support entity mapping features within Sentinel. Additionally, if the array is multivalued, we will input a string to indicate this with a unique hash so that matching will not occur. |
| Severity | Medium |
| Tactics | Exfiltration |
| Techniques | T1020 |
| Required data connectors | Syslog SyslogAma |
| Kind | Scheduled |
| Query frequency | 15m |
| Query period | 15m |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Syslog/Analytic Rules/sftp_file_transfer_folders_above_threshold.yaml |
| Version | 1.0.2 |
| Arm template | 7355434e-09d5-4401-b56d-e03e9379dfb1.json |
let threshold = 10;
Syslog
| where ProcessName has "sftp"
and SyslogMessage has "close "
and SyslogMessage has " bytes read "
| parse SyslogMessage with "close \"" filepath "\" bytes read " readbytes: int " written " writtenbytes: int
| parse kind=regex filepath with dirpath:string "/" filename:string
| join kind=leftouter (
Syslog
| where ProcessName has "sftp" and SyslogMessage has "session opened for"
| parse SyslogMessage with "session opened for local user " username: string " from [" src_ip "]"
| project username, src_ip, ProcessID
)
on ProcessID
| project-away ProcessID1
| summarize count_distinct_dirpath=dcount(dirpath), dirlist=make_set(dirpath) by Computer, username, src_ip, bin(TimeGenerated, 15m)
| where count_distinct_dirpath >= threshold
| extend DirSample = iff(array_length(dirlist) == 1, tostring(dirlist[0]), strcat("SeeDirListField","_", tostring(hash(tostring(dirlist)))))
queryPeriod: 15m
query: |
let threshold = 10;
Syslog
| where ProcessName has "sftp"
and SyslogMessage has "close "
and SyslogMessage has " bytes read "
| parse SyslogMessage with "close \"" filepath "\" bytes read " readbytes: int " written " writtenbytes: int
| parse kind=regex filepath with dirpath:string "/" filename:string
| join kind=leftouter (
Syslog
| where ProcessName has "sftp" and SyslogMessage has "session opened for"
| parse SyslogMessage with "session opened for local user " username: string " from [" src_ip "]"
| project username, src_ip, ProcessID
)
on ProcessID
| project-away ProcessID1
| summarize count_distinct_dirpath=dcount(dirpath), dirlist=make_set(dirpath) by Computer, username, src_ip, bin(TimeGenerated, 15m)
| where count_distinct_dirpath >= threshold
| extend DirSample = iff(array_length(dirlist) == 1, tostring(dirlist[0]), strcat("SeeDirListField","_", tostring(hash(tostring(dirlist)))))
name: SFTP File transfer folder count above threshold
entityMappings:
- fieldMappings:
- columnName: username
identifier: Name
entityType: Account
- fieldMappings:
- columnName: src_ip
identifier: Address
entityType: IP
- fieldMappings:
- columnName: Computer
identifier: HostName
entityType: Host
- fieldMappings:
- columnName: DirSample
identifier: Name
entityType: File
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Syslog/Analytic Rules/sftp_file_transfer_folders_above_threshold.yaml
requiredDataConnectors:
- connectorId: Syslog
dataTypes:
- Syslog
- connectorId: SyslogAma
dataTypes:
- Syslog
description: |
'Identifies SFTP File Transfers with distinct folder count above certain threshold in a 15min time period.
It requires SFTP VERBOSE loglevel to be enabled.
Please note that entity mapping for arrays is not supported, so when there is a single value in an array, we will pull that value from the array as a single string to populate the entity to support entity mapping features within Sentinel. Additionally, if the array is multivalued, we will input a string to indicate this with a unique hash so that matching will not occur.'
kind: Scheduled
incidentConfiguration:
groupingConfiguration:
matchingMethod: Selected
reopenClosedIncident: false
groupByEntities:
- Account
- Host
groupByAlertDetails: []
lookbackDuration: 5h
groupByCustomDetails: []
enabled: true
createIncident: true
version: 1.0.2
queryFrequency: 15m
severity: Medium
relevantTechniques:
- T1020
triggerOperator: gt
triggerThreshold: 0
customDetails:
TransferCount: count_distinct_dirpath
FilesList: dirlist
tactics:
- Exfiltration
id: 7355434e-09d5-4401-b56d-e03e9379dfb1