Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLES-15-030730 'Record Unsuccessul Delete Attempts to Files - renameat2' #6826

Merged
merged 7 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
documentation_complete: true

prodtype: sle15

title: 'Record Unsuccessul Delete Attempts to Files - renameat2'

description: |-
The audit system should collect unsuccessful file deletion
attempts for all users and root. If the <tt>auditd</tt> daemon is configured
to use the <tt>augenrules</tt> program to read audit rules during daemon
startup (the default), add the following lines to a file with suffix
<tt>.rules</tt> in the directory <tt>/etc/audit/rules.d</tt>.
If the <tt>auditd</tt> daemon is configured to use the <tt>auditctl</tt>
utility to read audit rules during daemon startup, add the following lines to
<tt>/etc/audit/audit.rules</tt> file.
<pre>-a always,exit -F arch=b32 -S renameat2 -F exit=-EACCES -F auid&gt;={{{ auid }}} -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b32 -S renameat2 -F exit=-EPERM -F auid&gt;={{{ auid }}} -F auid!=unset -F key=unsuccessful-delete</pre>
If the system is 64 bit then also add the following lines:
<pre>
-a always,exit -F arch=b64 -S renameat2 -F exit=-EACCES -F auid&gt;={{{ auid }}} -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b64 -S renameat2 -F exit=-EPERM -F auid&gt;={{{ auid }}} -F auid!=unset -F key=unsuccessful-delete</pre>

rationale: |-
Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing
these events could serve as evidence of potential system compromise.

severity: medium

identifiers:
cce@sle15: CCE-85719-3

references:
disa@sle15: CCI-000172
nist@sle15: AU-12(c),AU-12.1(iv)
srg@sle15: SRG-OS-000468-GPOS-00212
stigid@sle15: SLES-15-030730

{{{ complete_ocil_entry_audit_syscall(syscall="renameat2") }}}

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:
<pre>-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat,renameat2 -F exit=-EACCES -F auid>={{{ auid }}} -F auid!=unset -F key=unsuccesful-delete</pre>

template:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this template has hardcoded a different audit rule key. It adds

-F key=access

at the end istead of

-F key=unsuccessful-delete

which is specified in your rule description.
It depends if it is a problem for you as keys can be arbitrary values, they are more for humans than for computers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vojtapolasek The key difference is not an issue. Our rule notes that the key maybe different and looking at other rules that use this template I saw that in most cases the keys in the description were not access.

name: audit_rules_unsuccessful_file_modification
vars:
name: renameat2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
yarunachalam marked this conversation as resolved.
Show resolved Hide resolved
default_result: FAIL
result_after_remediation: PASS
1 change: 1 addition & 0 deletions sle15/profiles/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ selections:
- audit_rules_unsuccessful_file_modification_openat
- audit_rules_unsuccessful_file_modification_open_by_handle_at
- audit_rules_unsuccessful_file_modification_renameat
- audit_rules_unsuccessful_file_modification_renameat2
- audit_rules_unsuccessful_file_modification_rename
- audit_rules_unsuccessful_file_modification_truncate
- audit_rules_unsuccessful_file_modification_unlink
Expand Down
8 changes: 4 additions & 4 deletions tests/shared/audit/30-ospp-v42-4-delete-failed.rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Unsuccessful file delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
yarunachalam marked this conversation as resolved.
Show resolved Hide resolved
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat,renameat2 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat,renameat2 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat,renameat2 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat,renameat2 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete
4 changes: 2 additions & 2 deletions tests/shared/audit/30-ospp-v42-4-delete-success.rules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Successful file delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete
yarunachalam marked this conversation as resolved.
Show resolved Hide resolved
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat,renameat2 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat,renameat2 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete