|
| 1 | +[metadata] |
| 2 | +creation_date = "2025/01/09" |
| 3 | +integration = ["auditd_manager"] |
| 4 | +maturity = "production" |
| 5 | +updated_date = "2025/01/09" |
| 6 | + |
| 7 | +[rule] |
| 8 | +author = ["Elastic"] |
| 9 | +description = """ |
| 10 | +This rule leverages Auditd data to detect the use of the `prctl` syscall to potentially hide a process |
| 11 | +by changing its name. The `prctl` syscall is used to control various process attributes. Attackers can use |
| 12 | +this syscall to change the name of a process to a hidden directory or file, making it harder to detect. The query |
| 13 | +looks for the `prctl` syscall with the `PR_SET_NAME` argument set to `f` (PR_SET_NAME is used to set the name of a process). |
| 14 | +""" |
| 15 | +from = "now-9m" |
| 16 | +index = ["logs-auditd_manager.auditd-*", "auditbeat-*"] |
| 17 | +language = "eql" |
| 18 | +license = "Elastic License v2" |
| 19 | +name = "Potential Process Name Stomping with Prctl" |
| 20 | +references = [ |
| 21 | + "https://haxrob.net/process-name-stomping/", |
| 22 | + "https://haxrob.net/hiding-in-plain-sight-part-2/", |
| 23 | + "https://www.elastic.co/security-labs/linux-detection-engineering-with-auditd", |
| 24 | +] |
| 25 | +risk_score = 47 |
| 26 | +rule_id = "fef62ecf-0260-4b71-848b-a8624b304828" |
| 27 | +setup = """## Setup |
| 28 | +
|
| 29 | +This rule requires data coming in from Auditd Manager. |
| 30 | +
|
| 31 | +### Auditd Manager Integration Setup |
| 32 | +The Auditd Manager Integration receives audit events from the Linux Audit Framework which is a part of the Linux kernel. |
| 33 | +Auditd Manager 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. |
| 34 | +
|
| 35 | +#### The following steps should be executed in order to add the Elastic Agent System integration "auditd_manager" on a Linux System: |
| 36 | +- Go to the Kibana home page and click “Add integrations”. |
| 37 | +- In the query bar, search for “Auditd Manager” and select the integration to see more details about it. |
| 38 | +- Click “Add Auditd Manager”. |
| 39 | +- Configure the integration name and optionally add a description. |
| 40 | +- Review optional and advanced settings accordingly. |
| 41 | +- Add the newly installed “auditd manager” to an existing or a new agent policy, and deploy the agent on a Linux system from which auditd log files are desirable. |
| 42 | +- Click “Save and Continue”. |
| 43 | +- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/auditd_manager). |
| 44 | +
|
| 45 | +#### Rule Specific Setup Note |
| 46 | +Auditd Manager subscribes to the kernel and receives events as they occur without any additional configuration. |
| 47 | +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. |
| 48 | +- For this detection rule the following additional audit rules are required to be added to the integration: |
| 49 | + -- "-a exit,always -F arch=b64 -S prctl -k prctl_detection" |
| 50 | +""" |
| 51 | +severity = "medium" |
| 52 | +tags = [ |
| 53 | + "Data Source: Auditd Manager", |
| 54 | + "Domain: Endpoint", |
| 55 | + "OS: Linux", |
| 56 | + "Use Case: Threat Detection", |
| 57 | + "Tactic: Defense Evasion", |
| 58 | +] |
| 59 | +timestamp_override = "event.ingested" |
| 60 | +type = "eql" |
| 61 | +query = ''' |
| 62 | +process where host.os.type == "linux" and auditd.data.syscall == "prctl" and auditd.data.a0 == "f" and |
| 63 | +process.executable like ( |
| 64 | + "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/var/run/*", "/etc/update-motd.d/*", |
| 65 | + "/tmp/*", "/var/log/*", "/var/tmp/*", "/home/*", "/run/shm/*", "/run/*", "./*" |
| 66 | +) |
| 67 | +''' |
| 68 | + |
| 69 | +[[rule.threat]] |
| 70 | +framework = "MITRE ATT&CK" |
| 71 | + |
| 72 | +[[rule.threat.technique]] |
| 73 | +id = "T1036" |
| 74 | +name = "Masquerading" |
| 75 | +reference = "https://attack.mitre.org/techniques/T1036/" |
| 76 | + |
| 77 | +[[rule.threat.technique.subtechnique]] |
| 78 | +id = "T1036.005" |
| 79 | +name = "Match Legitimate Name or Location" |
| 80 | +reference = "https://attack.mitre.org/techniques/T1036/005/" |
| 81 | + |
| 82 | +[rule.threat.tactic] |
| 83 | +id = "TA0005" |
| 84 | +name = "Defense Evasion" |
| 85 | +reference = "https://attack.mitre.org/tactics/TA0005/" |
0 commit comments