Unknown Execution of Binary with RWX Memory Region

Monitors for the execution of a previously unknown unix binary with read, write and execute memory region permissions. The mprotect() system call is used to change the access protections on a region of memory that has already been allocated. This syscall allows a process to modify the permissions of pages in its virtual address space, enabling or disabling permissions such as read, write, and execute for those pages. RWX permissions on memory is in many cases overly permissive, and should be analyzed thoroughly.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2024/03/13"
 3integration = ["auditd_manager"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Monitors for the execution of a previously unknown unix binary with read, write and execute memory region permissions.
11The mprotect() system call is used to change the access protections on a region of memory that has already been
12allocated. This syscall allows a process to modify the permissions of pages in its virtual address space, enabling or
13disabling permissions such as read, write, and execute for those pages. RWX permissions on memory is in many cases
14overly permissive, and should be analyzed thoroughly.
15"""
16from = "now-9m"
17index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
18language = "kuery"
19license = "Elastic License v2"
20name = "Unknown Execution of Binary with RWX Memory Region"
21references = ["https://man7.org/linux/man-pages/man2/mprotect.2.html"]
22risk_score = 47
23rule_id = "23bcd283-2bc0-4db2-81d4-273fc051e5c0"
24setup = """## Setup
25
26This rule requires the use of the `auditd_manager` integration. `Auditd_manager` is a tool designed to simplify and enhance the management of the audit subsystem in Linux systems. It provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system. The following steps should be executed in order to install and deploy `auditd_manager` on a Linux system.

Kibana --> Management --> Integrations --> Auditd Manager --> Add Auditd Manager

1`Auditd_manager` subscribes to the kernel and receives events as they occur without any additional configuration. However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
2For this detection rule to trigger, the following additional audit rules are required to be added to the integration:

-a always,exit -F arch=b64 -S mprotect

 1Add the newly installed `auditd manager` to an agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
 2"""
 3severity = "medium"
 4tags = [
 5    "Domain: Endpoint",
 6    "OS: Linux",
 7    "Use Case: Threat Detection",
 8    "Tactic: Execution",
 9    "Data Source: Auditd Manager",
10]
11timestamp_override = "event.ingested"
12type = "new_terms"
13
14query = '''
15event.category:process and host.os.type:linux and auditd.data.syscall:mprotect and auditd.data.a2:7
16'''
17
18
19[[rule.threat]]
20framework = "MITRE ATT&CK"
21[[rule.threat.technique]]
22id = "T1059"
23name = "Command and Scripting Interpreter"
24reference = "https://attack.mitre.org/techniques/T1059/"
25[[rule.threat.technique.subtechnique]]
26id = "T1059.004"
27name = "Unix Shell"
28reference = "https://attack.mitre.org/techniques/T1059/004/"
29
30
31
32[rule.threat.tactic]
33id = "TA0002"
34name = "Execution"
35reference = "https://attack.mitre.org/tactics/TA0002/"
36
37[rule.new_terms]
38field = "new_terms_fields"
39value = ["host.id", "process.executable"]
40[[rule.new_terms.history_window_start]]
41field = "history_window_start"
42value = "now-7d"

References

Related rules

to-top