diff --git a/data_sources/windows_event_log_microsoft_windows_terminalservices_rdpclient_1024.yml b/data_sources/windows_event_log_microsoft_windows_terminalservices_rdpclient_1024.yml new file mode 100644 index 0000000000..d17981dc1f --- /dev/null +++ b/data_sources/windows_event_log_microsoft_windows_terminalservices_rdpclient_1024.yml @@ -0,0 +1,61 @@ +name: Windows Event Log Microsoft Windows TerminalServices RDPClient 1024 +id: 2490537e-5e0c-46f7-9209-f56f852aa217 +version: 1 +date: '2024-11-21' +author: Michael Haag, Splunk +description: Data source object for Windows Event Microsoft Windows TerminalServices RDPClient 1024 +source: WinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational +sourcetype: WinEventLog +separator: EventCode +supported_TA: [] +fields: +- _time +- Channel +- Computer +- EventCode +- EventData +- EventID +- EventRecordID +- EventType +- Keywords +- Level +- Message +- Opcode +- ProcessID +- RecordNumber +- Security_ID +- Src +- Src_Host +- Src_NT_Domain +- Src_User +- System_TimeCreated +- Task +- ThreadID +- Type +- User +- UserID +- Version +- dest +- dvc +- event_id +- host +- source +- sourcetype +- tag +- user +example_log: + 11/21/2024 06:09:16 PM + LogName=Microsoft-Windows-TerminalServices-RDPClient/Operational + EventCode=1024 + EventType=4 + ComputerName=ar-win-5.attackrange.local + User=NOT_TRANSLATED + Sid=S-1-5-21-1731938146-2314223186-1848411941-500 + SidType=0 + SourceName=Microsoft-Windows-TerminalServices-ClientActiveXCore + Type=Information + RecordNumber=95 + Keywords=None + TaskCategory=Connection Sequence + OpCode=This event is raised during the connection process + Message=RDP ClientActiveX is trying to connect to the server (34.221.50.57) \ No newline at end of file diff --git a/detections/endpoint/windows_rdp_file_execution.yml b/detections/endpoint/windows_rdp_file_execution.yml new file mode 100644 index 0000000000..7bb3814b57 --- /dev/null +++ b/detections/endpoint/windows_rdp_file_execution.yml @@ -0,0 +1,100 @@ +name: Windows RDP File Execution +id: 0b6b12b9-8ba9-48fe-b3b8-b4e3e1cd22b4 +version: 1 +date: '2024-11-21' +author: Michael Haag, Splunk +type: TTP +status: production +description: The following analytic detects when a Windows RDP client attempts to execute an RDP file from a temporary directory, downloads directory, or Outlook directories. This detection is significant as it can indicate an attempt for an adversary to deliver a .rdp file, which may be leveraged by attackers to control or exfiltrate data. If confirmed malicious, this activity could lead to unauthorized access, data theft, or further lateral movement within the network. +data_source: + - Sysmon EventID 1 + - Windows Event Log Security 4688 + - CrowdStrike ProcessRollup2 +search: '| tstats count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes + where Processes.process IN ("*\\AppData\\Local\\Temp\\*", "*\\Olk\\Attachments\\*", "*\\AppData\\Local\\Microsoft\\Outlook\\*", "*\\Content.Outlook\\*", "*\\Downloads\\*") + AND Processes.process="*.rdp*" + by Processes.process Processes.process_name Processes.user Processes.dest Processes.parent_process_name Processes.parent_process + | `drop_dm_object_name(Processes)` + | `security_content_ctime(firstTime)` + | `security_content_ctime(lastTime)` + | eval + execution_type=case( + match(process, "\\\\Temp\\\\.*\\.(zip|7z|rar|cab|tgz|gz|tar|iso|img|vhd|vhdx).*\\.*\\.rdp"), "temp_archive_execution", + match(process, "\\\\Downloads\\\\"), "downloads_execution", + match(process, "\\\\Temp\\\\"), "temp_execution", + match(process, "\\\\Microsoft\\\\Outlook\\\\"), "outlook_execution", + match(process, "\\\\Olk\\\\Attachments\\\\"), "outlook_execution", + match(process, "\\\\Content.Outlook\\\\"), "outlook_execution", + true(), "other" + ), + risk_score=case( + execution_type="temp_archive_execution", "Critical", + execution_type IN ("temp_execution", "outlook_execution"), "High", + execution_type="downloads_execution", "Medium", + true(), "Low" + ), + risk_reason=case( + execution_type="temp_archive_execution", "RDP file executed directly from archive/disk image in Temp directory", + execution_type="downloads_execution", "RDP file executed from Downloads directory (Could be legitimate admin activity)", + execution_type="temp_execution", "RDP file executed from Temp directory", + execution_type="outlook_execution", "RDP file executed from Outlook directories", + true(), "Standard RDP file execution" + ) + | sort - risk_score + | rename + process_name as "RDP Process", + parent_process_name as "Parent Process", + process as "Command Line", + user as "User", + execution_type as "Execution Context", + risk_score as "Risk Level", + risk_reason as "Risk Details" + | fields - parent_process | `windows_rdp_file_execution_filter`' +how_to_implement: The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain the process GUID, process name, and parent process. Additionally, you must ingest complete command-line executions. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the `Processes` node of the `Endpoint` data model. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process. +known_false_positives: False positives may be present based on administrators using RDP files for legitimate purposes. Filter as needed. +references: +- https://www.microsoft.com/en-us/security/blog/2024/10/29/midnight-blizzard-conducts-large-scale-spear-phishing-campaign-using-rdp-files/ +drilldown_searches: +- name: View the detection results for - "$dest$" + search: '%original_detection_search% | search dest = "$dest$"' + earliest_offset: $info_min_time$ + latest_offset: $info_max_time$ +- name: View risk events for the last 7 days for - "$dest$" + search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`' + earliest_offset: $info_min_time$ + latest_offset: $info_max_time$ +tags: + analytic_story: + - Spearphishing Attachments + asset_type: Endpoint + confidence: 70 + impact: 60 + message: A Windows RDP client attempted to execute an RDP file from a temporary directory, downloads directory, or Outlook directories on the endpoint $dest$. + mitre_attack_id: + - T1598.002 + - T1021.001 + observable: + - name: dest + type: Endpoint + role: + - Victim + product: + - Splunk Enterprise + - Splunk Enterprise Security + - Splunk Cloud + required_fields: + - process_guid + - process_name + - process + - parent_process_name + - parent_process + - user + risk_score: 42 + security_domain: endpoint + cve: [] +tests: +- name: True Positive Test + attack_data: + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1598.002/rdp/mstsc_rdpfile-windows-sysmon.log + sourcetype: XmlWinEventLog + source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational diff --git a/detections/endpoint/windows_rdpclient_connection_sequence_events.yml b/detections/endpoint/windows_rdpclient_connection_sequence_events.yml new file mode 100644 index 0000000000..df60b1340f --- /dev/null +++ b/detections/endpoint/windows_rdpclient_connection_sequence_events.yml @@ -0,0 +1,61 @@ +name: Windows RDPClient Connection Sequence Events +id: 67340df1-3f1d-4470-93c8-9ac7249d11b0 +version: 1 +date: '2024-11-21' +author: Michael Haag, Splunk +type: Anomaly +status: production +description: This analytic monitors Windows RDP client connection sequence events (EventCode 1024) from the Microsoft-Windows-TerminalServices-RDPClient/Operational log. These events track when RDP ClientActiveX initiates connection attempts to remote servers. The connection sequence is a critical phase of RDP where the client and server exchange settings and establish common parameters for the session. Monitoring these events can help identify unusual RDP connection patterns, potential lateral movement attempts, unauthorized remote access activity, and RDP connection chains that may indicate compromised systems. NOTE the analytic was written for Multi-Line as XML was not properly parsed out. +data_source: +- Windows Event Log Microsoft Windows TerminalServices RDPClient 1024 +search: '`wineventlog_rdp` EventCode=1024 + | rename host as dest + | stats count as "Event Count", min(_time) as firstTime, max(_time) as lastTime, values(Message) as messages by dest, source, LogName, EventCode, category + | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)` | `windows_rdpclient_connection_sequence_events_filter`' +how_to_implement: To successfully implement this detection, ensure Windows RDP Client Operational logs are being collected and forwarded to Splunk. Enable logging for "Microsoft-Windows-TerminalServices-RDPClient/Operational", via a new inputs.conf input. See references for more details. +known_false_positives: Legitimate RDP connections from authorized administrators and users will generate these events. To reduce false positives, you should baseline normal RDP connection patterns in your environment, whitelist expected RDP connection chains between known administrative workstations and servers, and track authorized remote support sessions. +references: +- https://gist.github.com/MHaggis/acd5dcbf1d4fb705b77f0a48e772eefc +- https://www.microsoft.com/en-us/security/blog/2024/10/29/midnight-blizzard-conducts-large-scale-spear-phishing-campaign-using-rdp-files/ +drilldown_searches: +- name: View the detection results for - "$dest$" + search: '%original_detection_search% | search dest = "$dest$"' + earliest_offset: $info_min_time$ + latest_offset: $info_max_time$ +- name: View risk events for the last 7 days for - "$dest$" + search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`' + earliest_offset: $info_min_time$ + latest_offset: $info_max_time$ +tags: + analytic_story: + - Spearphishing Attachments + asset_type: Endpoint + confidence: 70 + impact: 10 + message: A Windows RDP client initiated a connection sequence event (EventCode 1024) on host $dest$. + mitre_attack_id: + - T1133 + observable: + - name: dest + type: Endpoint + role: + - Victim + product: + - Splunk Enterprise + - Splunk Enterprise Security + - Splunk Cloud + required_fields: + - host + - source + - LogName + - EventCode + - category + risk_score: 7 + security_domain: endpoint + cve: [] +tests: +- name: True Positive Test + attack_data: + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1133/rdp/terminalservices-rdpclient.log + sourcetype: WinEventLog + source: WinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational diff --git a/macros/wineventlog_rdp.yml b/macros/wineventlog_rdp.yml new file mode 100644 index 0000000000..63194303de --- /dev/null +++ b/macros/wineventlog_rdp.yml @@ -0,0 +1,4 @@ +definition: source="WinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational" +description: customer specific splunk configurations(eg- index, source, sourcetype). + Replace the macro definition with configurations for your Splunk Environmnent. +name: wineventlog_rdp