PH_Rule_TH_Linux_relative_dir_10
Enabled
Identifies file permission modifications in common writable directories by a non-root user. Adversaries often drop files or payloads into a writable directory and change permissions prior to execution. This requires process monitoring via FortiSIEM Linux agent. Note that auditd CWD events will only trigger this rule, as operations such as chmod, when executed within target directory such as /tmp will show a relative path name in the PATH auditd log
7
Security
Defense Evasion
Defense Evasion consists of techniques that adversaries use to avoid detection throughout their compromise. Techniques used for defense evasion include uninstalling/disabling security software or obfuscating/encrypting data and scripts. Adversaries also leverage and abuse trusted processes to hide and masquerade their malware. Other tactics’ techniques are cross-listed here when those techniques include the added benefit of subverting defenses.
https://attack.mitre.org/tactics/TA0005T1222.002
File and Directory Permissions Modification: Linux and Mac File and Directory Permissions Modification
Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files. Adversaries may use these commands to make themselves the owner of files and directories or change the mode if current permissions allow it. They could subsequently lock others out of the file. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via .bash_profile and .bashrc or tainting/hijacking other instrumental binary/configuration files via Hijack Execution Flow.
https://attack.mitre.org/techniques/T1222/002Server
Linux Process Monitoring via FortiSIEM Agent
Correlation
No remediation guidance specified
If the following pattern or patterns match an ingested event within the given time window in seconds, trigger an incident.
300 seconds
If the following defined pattern/s occur within a 300 second time window.
SYSCALL AND CWD
This defines how two or more distinct events are related in a time-series based action. e.g. An event occurs followed by another event if the source IP, user, and messageId are the same
SYSCALL.msgId = CWD.msgId AND SYSCALL.hostName = CWD.hostName
This is the named definition of the event query, this is important if multiple subpatterns are defined to distinguish them.
This is the query logic that matches incoming events
eventType IN ("LINUX_PROCESS_EXEC","LINUX_Auditd_SYSCALL") AND procName IN ("chattr","chgrp","chmod","chown") AND userId != "0"
This defines how matching events are aggregated, only events with the same matching attribute values are grouped into one unique incident ID
msgId,commandPath,procName,userId,user,hostName
This is most typically a numerical constraint that defines when the rule should trigger an incident
COUNT(*) >= 1
Operator Rank: 0 Operator Type: AND
This operator defines the logic condition relating to the prior event subpattern clause and the following event subpattern clause
This is the named definition of the event query, this is important if multiple subpatterns are defined to distinguish them.
This is the query logic that matches incoming events
eventType = "LINUX_Auditd_CWD" AND commandPath REGEXP "^\/dev\/shm|^\/tmp|^\/var\/tmp"
This defines how matching events are aggregated, only events with the same matching attribute values are grouped into one unique incident ID
hostName,commandPath,msgId
This is most typically a numerical constraint that defines when the rule should trigger an incident
COUNT(*) >= 1
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=SYSCALL.hostName,
userId=SYSCALL.userId,
user=SYSCALL.user,
procName=SYSCALL.procName,
msgId=SYSCALL.msgId,
commandPath=CWD.commandPath