Detection: Cisco Secure Endpoint - SQL Backup And Rclone Transfer

Description

This analytic detects a SQL backup command followed by an rclone copy command naming the same backup file, by correlating Cisco Secure Endpoint Behavioral Protection alerts. The exact artifact relationship may indicate staged database exfiltration. Neither alert proves a successful backup or transfer; distinguish this from authorized backup operations using destination, account, and network evidence.

 1`cisco_secure_endpoint`
 2event_type="Threat Detection"
 3
 4
 5| `cisco_secure_endpoint_extract_bp_fields`
 6
 7
 8| where sig_id IN ("20220128130842","20240715190623")
 9
10
11| spath path=bp_data.details.matched_activity.events{0}.process:start.cmd_line output=process_command
12
13
14| spath path=bp_data.details.matched_activity.events{0}.process:start.args{} output=process_args
15
16| eval rclone_index=mvfind(process_args,"(?i)^(copy
17|sync)$"),
18       rclone_source=mvindex(process_args,rclone_index+1),
19       rclone_target=mvindex(process_args,rclone_index+2)
20
21
22| eval stage=if(sig_id="20220128130842","backup","transfer"),
23       sql_query=if(stage="backup",mvindex(process_args,mvfind(process_args,"(?i)^-Q$")+1),null()),
24       transfer_source=if(stage="transfer",rclone_source,null()),
25       remote_target=if(stage="transfer",rclone_target,null())
26
27
28| rex field=sql_query "(?i)BACKUP\s+DATABASE\s+(?<database_name>\S+)\s+TO\s+DISK\s*=\s*'(?<backup_path>[^']+)'"
29
30
31| eval backup_file=lower(coalesce(backup_path,transfer_source)),
32       event_time=tonumber(timestamp)+tonumber(timestamp_nanoseconds)/1000000000
33
34
35| where isnotnull(endpoint_guid)
36        AND isnotnull(backup_file)
37        AND isnotnull(event_time)
38        AND (stage="backup" OR isnotnull(remote_target))
39
40
41| sort 0 endpoint_guid backup_file event_time
42
43| streamstats last(eval(if(stage="backup",event_time,null()))) as backup_time
44              last(eval(if(stage="backup",database_name,null()))) as prior_database_name
45              last(eval(if(stage="backup",process_command,null()))) as backup_command
46  by endpoint_guid backup_file
47
48| where stage="transfer" AND isnotnull(backup_time)
49        AND event_time>=backup_time AND event_time-backup_time<=900
50
51| eval database_name=prior_database_name, transfer_command=process_command,
52       firstTime=backup_time, lastTime=event_time,
53       user=coalesce(user,"unknown")
54
55| dedup endpoint_guid backup_file backup_time
56
57
58| table dest user endpoint_guid database_name backup_file remote_target
59        backup_command transfer_command firstTime lastTime
60
61| `security_content_ctime(firstTime)`
62
63| `security_content_ctime(lastTime)`
64
65| `cisco_secure_endpoint___sql_backup_and_rclone_transfer_filter`

Data Source

Name Platform Sourcetype Source
Cisco Secure Endpoint Behavioral Protection Threat Detection Other 'cisco:se' 'not_applicable'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
search bp_engine=apde
spath path=bp_data.details.sig_id output=sig_id
spath path=computer.connector_guid output=endpoint_guid
spath path=computer.hostname output=dest
spath path=bp_data.details.matched_activity.events{0}.process:start.user.name output=user
spath path=bp_data.details.matched_activity.events{0}.registry:set.user.name output=registry_user
spath path=bp_data.details.matched_activity.events{0}.file:create.user.name output=file_user
eval user=coalesce(user,registry_user,file_user)
spath path=bp_data.audit output=bp_audit
spath path=bp_data.details.actions{}.action output=bp_action
spath path=bp_data.details.actions{}.status output=bp_action_status
eval bp_response=case(bp_audit="true","audit mode",isnotnull(bp_action_status),mvjoin(bp_action,", "),true(),"no action reported")`
cisco_secure_endpoint___sql_backup_and_rclone_transfer_filter search *
cisco_secure_endpoint___sql_backup_and_rclone_transfer_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1005 Data from Local System Collection
T1048 Exfiltration Over Alternative Protocol Exfiltration
Exploitation
Actions on Objectives
DE.CM
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Finding (Notable) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) No
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.

Implementation

This search requires Cisco Secure Endpoint Behavioral Protection Threat Detection alerts, which include event_type="Threat Detection". This search uses an input macro named cisco_secure_endpoint. We strongly recommend that you specify your environment-specific configurations (index, source, sourcetype, etc.) for Cisco Secure Endpoint Behavioral Protection Threat Detection alerts. Replace the macro definition with configurations for your Splunk environment. The cisco_secure_endpoint_extract_bp_fields macro extracts the common signature, endpoint, actor, and prevention-response fields used by this search. The search also uses a post-filter macro designed to filter out known false positives. The logs are to be ingested using the Cisco Security Cloud App for Splunk (https://splunkbase.splunk.com/app/7404). In Protect mode, a Behavioral Protection response can kill or quarantine an earlier stage, so this search requires each later alert to have actually appeared. Review bp_data.audit and bp_data.details.actions in the source events before concluding that a task registered, a process completed, or a transfer succeeded. The included audit-mode fixtures verify alert correlation, not survival of an enforced prevention action.

Known False Positives

Approved database backup or migration workflows may use sqlcmd and rclone together. Verify the database, destination, transfer outcome, operator, and change record. Process-start alerts alone do not prove backup or copy completion.

Associated Analytic Story

Finding

Title Entity Field Entity Type Risk Score
SQL backup and rclone copy command sharing backup file $backup_file$ on $dest$ dest system 50

Threat Objects

Field Type
transfer_command command
backup_command command
backup_file file_path

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset not_applicable cisco:se
Integration ✅ Passing Dataset not_applicable cisco:se

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub |

Version: 1