Skip to content

Commit

Permalink
Add new rule dir_perms_world_writable_system_owned_group.
Browse files Browse the repository at this point in the history
Change old STIG reference ID from dir_perms_world_writable_system_owned
because this rule actually checks for UID and not the GID as it was
expected.
  • Loading branch information
ggbecker committed Nov 25, 2020
1 parent d2a0380 commit e1e3a79
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
</criteria>
</definition>
<unix:file_test check="all" comment="check for local directories that are world writable and have uid greater than or equal to {{{ auid }}}" id="test_dir_world_writable_uid_gt_value" version="1">
<unix:object object_ref="all_local_directories" />
<unix:state state_ref="state_gid_is_user_and_world_writable" />
<unix:object object_ref="all_local_directories_uid" />
<unix:state state_ref="state_uid_is_user_and_world_writable" />
</unix:file_test>
<unix:file_object comment="all local directories" id="all_local_directories" version="1">
<unix:file_object comment="all local directories" id="all_local_directories_uid" version="1">
<unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="local" />
<unix:path operation="equals">/</unix:path>
<unix:filename xsi:nil="true" />
<filter action="include">state_gid_is_user_and_world_writable</filter>
<filter action="include">state_uid_is_user_and_world_writable</filter>
</unix:file_object>
<unix:file_state comment="uid greater than or equal to {{{ auid }}} and world writable" id="state_gid_is_user_and_world_writable" version="1">
<unix:file_state comment="uid greater than or equal to {{{ auid }}} and world writable" id="state_uid_is_user_and_world_writable" version="1">
<unix:user_id datatype="int" operation="greater than or equal">{{{ auid }}}</unix:user_id>
<unix:owrite datatype="boolean">true</unix:owrite>
</unix:file_state>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ title: 'Ensure All World-Writable Directories Are Owned by a System Account'
description: |-
All directories in local partitions which are
world-writable should be owned by root or another
system account. If any world-writable directories are not
system account. If any world-writable directories are not
owned by a system account, this should be investigated.
Following this, the files should be deleted or assigned to an
appropriate group.
appropriate owner.
rationale: |-
Allowing a user account to own a world-writable directory is
Expand All @@ -24,12 +24,12 @@ identifiers:
cce@rhel7: CCE-80136-5

references:
stigid@ol7: OL07-00-021030
stigid@ol7: OL07-00-021031
disa: CCI-000366
nist: CM-6(a),AC-6(1)
nist-csf: PR.AC-4,PR.DS-5
srg: SRG-OS-000480-GPOS-00227
stigid@rhel7: RHEL-07-021030
stigid@rhel7: RHEL-07-021031
isa-62443-2013: 'SR 2.1,SR 5.2'
isa-62443-2009: 4.3.3.7.3
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<def-group>
<definition class="compliance" id="dir_perms_world_writable_system_owned_group" version="1">
{{{ oval_metadata("All world writable directories should be group owned by a system user.") }}}
<criteria comment="check for local directories that are world writable and have gid greater than or equal to {{{ auid }}}" negate="true">
<criterion comment="check for local directories that are world writable and have gid greater than or equal to {{{ auid }}}" test_ref="test_dir_world_writable_gid_gt_value" />
</criteria>
</definition>
<unix:file_test check="all" comment="check for local directories that are world writable and have gid greater than or equal to {{{ auid }}}" id="test_dir_world_writable_gid_gt_value" version="1">
<unix:object object_ref="all_local_directories_gid" />
<unix:state state_ref="state_gid_is_user_and_world_writable" />
</unix:file_test>
<unix:file_object comment="all local directories" id="all_local_directories_gid" version="1">
<unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="local" />
<unix:path operation="equals">/</unix:path>
<unix:filename xsi:nil="true" />
<filter action="include">state_gid_is_user_and_world_writable</filter>
</unix:file_object>
<unix:file_state comment="gid greater than or equal to {{{ auid }}} and world writable" id="state_gid_is_user_and_world_writable" version="1">
<unix:group_id datatype="int" operation="greater than or equal">{{{ auid }}}</unix:group_id>
<unix:owrite datatype="boolean">true</unix:owrite>
</unix:file_state>
</def-group>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
documentation_complete: true

prodtype: fedora,ol7,ol8,rhel7,rhel8,rhv4,wrlinux1019

title: 'Ensure All World-Writable Directories Are Group Owned by a System Account'

description: |-
All directories in local partitions which are
world-writable should be group owned by root or another
system account. If any world-writable directories are not
group owned by a system account, this should be investigated.
Following this, the files should be deleted or assigned to an
appropriate group.
rationale: |-
Allowing a user account to group own a world-writable directory is
undesirable because it allows the owner of that directory to remove
or replace any files that may be placed in the directory by other
users.
severity: medium

identifiers:
cce@rhel7: CCE-80136-5

references:
stigid@ol7: OL07-00-021030
disa: CCI-000366
nist: CM-6(a),AC-6(1)
nist-csf: PR.AC-4,PR.DS-5
srg: SRG-OS-000480-GPOS-00227
stigid@rhel7: RHEL-07-021030
isa-62443-2013: 'SR 2.1,SR 5.2'
isa-62443-2009: 4.3.3.7.3
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
iso27001-2013: A.10.1.1,A.11.1.4,A.11.1.5,A.11.2.1,A.13.1.1,A.13.1.3,A.13.2.1,A.13.2.3,A.13.2.4,A.14.1.2,A.14.1.3,A.6.1.2,A.7.1.1,A.7.1.2,A.7.3.1,A.8.2.2,A.8.2.3,A.9.1.1,A.9.1.2,A.9.2.3,A.9.4.1,A.9.4.4,A.9.4.5
cis-csc: 12,13,14,15,16,18,3,5

ocil_clause: 'there is output'

ocil: |-
The following command will discover and print world-writable directories that
are not group owned by a system account, given the assumption that only system
accounts have a gid lower than 500. Run it once for each local partition <i>PART</i>:
<pre>$ sudo find <i>PART</i> -xdev -type d -perm -0002 -gid +499 -print</pre>
1 change: 1 addition & 0 deletions rhel7/profiles/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ selections:
- mount_option_nosuid_removable_partitions
- mount_option_nosuid_remote_filesystems
- dir_perms_world_writable_system_owned
- dir_perms_world_writable_system_owned_group
- accounts_umask_interactive_users
- rsyslog_cron_logging
- file_owner_cron_allow
Expand Down

0 comments on commit e1e3a79

Please sign in to comment.