FortiSIEM Rules

Windows: Python Initiated Connection

Rule ID

PH_Rule_SIGMA_1774

Default Status

Enabled

Description

Adversaries may attempt to get a listing of services running on remote hosts, including those that may be vulnerable to remote software exploitation. This rule is adapted from https://github.com/SigmaHQ/sigma/blob/master/rules/windows/network_connection/net_connection_win_python.yml

Severity

5

Category

Security

MITRE ATT&CK® Tactics

Discovery

Discovery consists of techniques an adversary may use to gain knowledge about the system and internal network. These techniques help adversaries observe the environment and orient themselves before deciding how to act. They also allow adversaries to explore what they can control and what’s around their entry point in order to discover how it could benefit their current objective. Native operating system tools are often used toward this post-compromise information-gathering objective.

https://attack.mitre.org/tactics/TA0007

MITRE ATT&CK® Techniques


T1046

Network Service Scanning

Adversaries may attempt to get a listing of services running on remote hosts, including those that may be vulnerable to remote software exploitation. Methods to acquire this information include port scans and vulnerability scans using tools that are brought onto a system.

https://attack.mitre.org/techniques/T1046

Impacts

Server

Data Source

Windows Sysmon via FortiSIEM Agent

Detection

Correlation

Remediation Guidance

No remediation guidance specified

Time Window

If the following pattern or patterns match an ingested event within the given time window in seconds, trigger an incident.

300 seconds

Trigger Conditions

If the following defined pattern/s occur within a 300 second time window.

Filter

SubPattern Definitions

SubPattern Name: Filter

This is the named definition of the event query, this is important if multiple subpatterns are defined to distinguish them.

SubPattern Query

This is the query logic that matches incoming events

eventType REGEXP "Win-Sysmon-3-Network-Connect.*" AND (initiated="true" AND procName REGEXP ".*python.*") AND ((parentProcName!="C:\\ProgramData\\Anaconda3\\Scripts\\conda.exe" OR command NOT REGEXP ".*C:\\ProgramData\\Anaconda3\\Scripts\\conda-script\.py.*" OR command NOT REGEXP ".*update.*") AND (parentProcName!="C:\\ProgramData\\Anaconda3\\python.exe" OR command NOT REGEXP ".*C:\\ProgramData\\Anaconda3\\Scripts\\jupyter-notebook-script\.py.*") AND (destIpAddr!=127.0.0.1 OR srcIpAddr!=127.0.0.1))

Group by Attributes

This defines how matching events are aggregated, only events with the same matching attribute values are grouped into one unique incident ID

command,destIpAddr,hostName,initiated,parentProcName,procName,srcIpAddr

Aggregate Constraint

This is most typically a numerical constraint that defines when the rule should trigger an incident

COUNT(*) >= 1

Incident Attribute Mapping

This section defines which fields in matching raw events should be mapped to the incident attributes in the resulting incident.

The available raw event attributes to map are limited to the group by attributes and the aggregate event constraint fields for each subpattern

command = Filter.command,
destIpAddr = Filter.destIpAddr,
hostName = Filter.hostName,
initiated = Filter.initiated,
parentProcName = Filter.parentProcName,
procName = Filter.procName,
srcIpAddr = Filter.srcIpAddr