diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_open.rule b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_open.rule new file mode 100644 index 0000000000..c69567f1c7 --- /dev/null +++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_open.rule @@ -0,0 +1,36 @@ +documentation_complete: true + +prodtype: rhel7,fedora + +title: 'Record Events that Modify User/Group Information via open syscall - /etc/group' + +description: |- + The audit system should collect write events to /etc/group file for all users and root. + If the auditd daemon is configured + to use the augenrules program to read audit rules during daemon + startup (the default), add the following lines to a file with suffix + .rules in the directory /etc/audit/rules.d: +
-a always,exit -F arch=b32 -S open -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modify+ If the auditd daemon is configured to use the auditctl + utility to read audit rules during daemon startup, add the following lines to + /etc/audit/audit.rules file: +
-a always,exit -F arch=b64 -S open -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modify+ +rationale: |- + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. + Auditing these events could serve as evidence of potential system compromise. + +severity: medium + +references: + ospp@rhel7: FAU_GEN.1.1.c + +{{{ complete_ocil_entry_audit_syscall(syscall="open") }}} + +warnings: + - general: |- + Note that these rules can be configured in a + number of ways while still achieving the desired effect. Here the system calls + have been placed independent of other system calls. Grouping system calls related + to the same event is more efficient. See the following example: +
-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modifydiff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_open_by_handle_at.rule b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_open_by_handle_at.rule new file mode 100644 index 0000000000..c33354b287 --- /dev/null +++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_open_by_handle_at.rule @@ -0,0 +1,36 @@ +documentation_complete: true + +prodtype: rhel7,fedora + +title: 'Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group' + +description: |- + The audit system should collect write events to /etc/group file for all group and root. + If the auditd daemon is configured + to use the augenrules program to read audit rules during daemon + startup (the default), add the following lines to a file with suffix + .rules in the directory /etc/audit/rules.d: +
-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modify+ If the auditd daemon is configured to use the auditctl + utility to read audit rules during daemon startup, add the following lines to + /etc/audit/audit.rules file: +
-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modify+ +rationale: |- + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. + Auditing these events could serve as evidence of potential system compromise. + +severity: medium + +references: + ospp@rhel7: FAU_GEN.1.1.c + +{{{ complete_ocil_entry_audit_syscall(syscall="open_by_handle_at") }}} + +warnings: + - general: |- + Note that these rules can be configured in a + number of ways while still achieving the desired effect. Here the system calls + have been placed independent of other system calls. Grouping system calls related + to the same event is more efficient. See the following example: +
-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modifydiff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_openat.rule b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_openat.rule new file mode 100644 index 0000000000..61bde4d6e9 --- /dev/null +++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_group_openat.rule @@ -0,0 +1,36 @@ +documentation_complete: true + +prodtype: rhel7,fedora + +title: 'Record Events that Modify User/Group Information via openat syscall - /etc/group' + +description: |- + The audit system should collect write events to /etc/group file for all users and root. + If the auditd daemon is configured + to use the augenrules program to read audit rules during daemon + startup (the default), add the following lines to a file with suffix + .rules in the directory /etc/audit/rules.d: +
-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modify+ If the auditd daemon is configured to use the auditctl + utility to read audit rules during daemon startup, add the following lines to + /etc/audit/audit.rules file: +
-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modify+ +rationale: |- + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. + Auditing these events could serve as evidence of potential system compromise. + +severity: medium + +references: + ospp@rhel7: FAU_GEN.1.1.c + +{{{ complete_ocil_entry_audit_syscall(syscall="openat") }}} + +warnings: + - general: |- + Note that these rules can be configured in a + number of ways while still achieving the desired effect. Here the system calls + have been placed independent of other system calls. Grouping system calls related + to the same event is more efficient. See the following example: +
-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=group-modifydiff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_passwd_open_by_handle_at.rule b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_passwd_open_by_handle_at.rule new file mode 100644 index 0000000000..0f91bb7d58 --- /dev/null +++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_passwd_open_by_handle_at.rule @@ -0,0 +1,36 @@ +documentation_complete: true + +prodtype: rhel7,fedora + +title: 'Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd' + +description: |- + The audit system should collect write events to /etc/passwd file for all users and root. + If the auditd daemon is configured + to use the augenrules program to read audit rules during daemon + startup (the default), add the following lines to a file with suffix + .rules in the directory /etc/audit/rules.d: +
-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify+ If the auditd daemon is configured to use the auditctl + utility to read audit rules during daemon startup, add the following lines to + /etc/audit/audit.rules file: +
-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify+ +rationale: |- + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. + Auditing these events could serve as evidence of potential system compromise. + +severity: medium + +references: + ospp@rhel7: FAU_GEN.1.1.c + +{{{ complete_ocil_entry_audit_syscall(syscall="open_by_handle_at") }}} + +warnings: + - general: |- + Note that these rules can be configured in a + number of ways while still achieving the desired effect. Here the system calls + have been placed independent of other system calls. Grouping system calls related + to the same event is more efficient. See the following example: +
-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modifydiff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_passwd_openat.rule b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_passwd_openat.rule new file mode 100644 index 0000000000..f1fab2b945 --- /dev/null +++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_etc_passwd_openat.rule @@ -0,0 +1,36 @@ +documentation_complete: true + +prodtype: rhel7,fedora + +title: 'Record Events that Modify User/Group Information via openat syscall - /etc/passwd' + +description: |- + The audit system should collect write events to /etc/passwd file for all users and root. + If the auditd daemon is configured + to use the augenrules program to read audit rules during daemon + startup (the default), add the following lines to a file with suffix + .rules in the directory /etc/audit/rules.d: +
-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify+ If the auditd daemon is configured to use the auditctl + utility to read audit rules during daemon startup, add the following lines to + /etc/audit/audit.rules file: +
-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify+ +rationale: |- + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. + Auditing these events could serve as evidence of potential system compromise. + +severity: medium + +references: + ospp@rhel7: FAU_GEN.1.1.c + +{{{ complete_ocil_entry_audit_syscall(syscall="openat") }}} + +warnings: + - general: |- + Note that these rules can be configured in a + number of ways while still achieving the desired effect. Here the system calls + have been placed independent of other system calls. Grouping system calls related + to the same event is more efficient. See the following example: +
-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modifydiff --git a/rhel7/profiles/ospp42.profile b/rhel7/profiles/ospp42.profile index 343ac9eb3c..68f4e38bc8 100644 --- a/rhel7/profiles/ospp42.profile +++ b/rhel7/profiles/ospp42.profile @@ -171,3 +171,8 @@ selections: - audit_rules_kernel_module_loading_rmmod - security_patches_up_to_date - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_openat + - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_group_open + - audit_rules_etc_group_openat + - audit_rules_etc_group_open_by_handle_at diff --git a/shared/templates/create_audit_rules_path_syscall.py b/shared/templates/create_audit_rules_path_syscall.py new file mode 100644 index 0000000000..0283bf439c --- /dev/null +++ b/shared/templates/create_audit_rules_path_syscall.py @@ -0,0 +1,33 @@ +#!/usr/bin/python2 + +# +# create_audit_rules_path_syscall_detailed.py +# generate template-based checks for changes to a path via syscalls + + +from template_common import FilesGenerator, UnknownTargetError + +import re + +class AuditRulesPathSyscallGenerator(FilesGenerator): + def generate(self, target, args): + path,syscall = args[0:2] + pathid = re.sub('[-\./]', '_', path) + # remove root slash made into '_' + pathid = pathid[1:] + if target == "oval": + self.file_from_template( + "./template_OVAL_audit_rules_path_syscall", + { + "PATH": path, + "PATHID": pathid, + "SYSCALL": syscall + }, + "./oval/audit_rules_{0}_{1}.xml", pathid, syscall + ) + else: + raise UnknownTargetError(target) + + def csv_format(self): + return("CSV should contains lines of the format: " + + "PATH,SYSCALL") diff --git a/shared/templates/csv/audit_rules_path_syscall.csv b/shared/templates/csv/audit_rules_path_syscall.csv new file mode 100644 index 0000000000..015f02f58d --- /dev/null +++ b/shared/templates/csv/audit_rules_path_syscall.csv @@ -0,0 +1,11 @@ +# format: +#