FortiSIEM Rules

Linux: Setuid Bit Set via chmod

Rule ID

PH_Rule_TH_Linux_30

Default Status

Enabled

Description

Detects setuid bit to a file or directory - this allows adversary to do operations on the file with the privileges of the owning user. An adversary can take advantage of this to either do a shell escape or exploit a vulnerability in an application with the setuid bit to get code running in a different user context. Additionally, adversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future. This requires process monitoring via FortiSIEM Linux agent.

Severity

7

Category

Security

MITRE ATT&CK® Tactics

Privilege Escalation

Privilege Escalation consists of techniques that adversaries use to gain higher-level permissions on a system or network. Adversaries can often enter and explore a network with unprivileged access but require elevated permissions to follow through on their objectives. Common approaches are to take advantage of system weaknesses, misconfigurations, and vulnerabilities.

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

MITRE ATT&CK® Techniques


T1548.001

Abuse Elevation Control Mechanism: Setuid and Setgid

An adversary may perform shell escapes or exploit vulnerabilities in an application with the setsuid or setgid bits to get code running in a different user's context. On Linux or macOS, when the setuid or setgid bits are set for an application, the application will run with the privileges of the owning user or group respectively. When programs need to be executed in an elevated context to function properly, the user can specify the setuid or setgid flag to be set for their own applications. Adversaries can use this mechanism on their own malware to make sure they're able to execute in elevated contexts in the future.

https://attack.mitre.org/techniques/T1548/001

Impacts

Server

Data Source

Linux Process Monitoring 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 = "LINUX_PROCESS_EXEC" AND procName ="chmod" AND user != "root" AND (swParam CONTAIN "u+s" OR swParam REGEXP (".*4[0-9]{3}.*"))

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

hostName, user, procName

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

 hostName = Filter.hostName,
 user = Filter.user,
 procName = Filter.procName