# Ensure Regular Review of SUID and SGID Files to Prevent Privilege Escalation

- Source: https://support.icompaas.com/support/solutions/articles/62000235401-ensure-regular-review-of-suid-and-sgid-files-to-prevent-privilege-escalation
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [CIS Amazon Linux 2 Benchmark v3.0.0](https://support.icompaas.com/support/solutions/62000112696) › [CIS Amazon Linux 2 Benchmarks](https://support.icompaas.com/support/solutions/folders/62000169265)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Profile Applicability:  
Level 1

Description:  
Files with SUID (Set User ID) and SGID (Set Group ID) permissions execute with the privileges of the file owner or group, respectively. While necessary for some system functions, these files can be exploited by attackers to gain elevated privileges if misconfigured or vulnerable.

Rationale:  
Regularly reviewing SUID and SGID files helps detect unauthorized or suspicious files, reducing the risk of privilege escalation attacks.

**Impact:** **Pros:**

-   Enhances system security by controlling privileged file usage.  
    
-   Helps identify and remediate potentially dangerous files.  
    

**Cons:**

-   Review process can be time-consuming and requires expertise.  
    
-   Removing necessary SUID/SGID bits may disrupt system functionality.  
    

**Default Value:** No default automated review is typically configured; manual review is required.

Pre-requisites:

-   Root or sudo privileges to list and inspect SUID and SGID files.  
    

Remediation:

### Test Plan:

Using Linux command line:

List all SUID files:

find / -perm -4000 -type f 2>/dev/null

List all SGID files:

find / -perm -2000 -type f 2>/dev/null

Review the list for unauthorized or unexpected files.  
  
Implementation Plan:

Using Linux command line:

1.  Investigate and validate the necessity of each SUID and SGID file.  
      
    Remove SUID/SGID bits from unnecessary files:
    
    chmod u-s /path/to/file  # Remove SUID  
    chmod g-s /path/to/file  # Remove SGID  
    

2.  Document changes and monitor for new files with these permissions.  
    

### Backout Plan:

Using Linux command line:

        1. Restore SUID/SGID bits to files if removal causes issues:   

chmod u+s /path/to/file  # Restore SUID  
chmod g+s /path/to/file  # Restore SGID  

        2. Reassess the security impact.

References:

-   CIS Amazon Linux 2 Benchmark v3.0.0  
    
-   [NIST SP 800-53 Revision 5 - CM-6  
    ](https://csrc.nist.gov/publications/detail/sp/800-53/rev-5/final#cm-6)
    
-   Linux File Permissions

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
