Linux and Mac Permissions

T1222.002

Sub-technique of T1222 File and Directory Permissions Modification.View on attack.mitre.org

About this technique

Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files. File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions. File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).

Most Linux and Linux-based platforms provide a standard set of permission groups (user, group, and other) and a standard set of permissions (read, write, and execute) that are applied to each group. While nuances of each platform’s permissions implementation may vary, most of the platforms provide two primary commands used to manipulate file and directory ACLs: chown (short for change owner), and chmod (short for change mode).

Adversarial may use these commands to make themselves the owner of files and directories or change the mode if current permissions allow it. They could subsequently lock others out of the file. Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via Unix Shell Configuration Modification or tainting/hijacking other instrumental binary/configuration files via Hijack Execution Flow.

Detection rules8

Rules on DetectionCode tagged with T1222.002.

Sigma4

RuleLevelLog source
Chmod Targeting Sensitive Directoriesmediumlinux / process_creation
Remove Immutable File Attributemediumlinux / process_creation
Remove Immutable File Attribute - Auditdmediumlinux / NULL
File or Folder Permissions Changelowlinux / NULL

Splunk4

RuleTypeRiskData source
Linux Auditd Change File Owner To RootAnomalyNULLLinux Auditd Proctitle
Linux Auditd File Permission Modification Via ChmodAnomalyNULLLinux Auditd Proctitle
Linux Auditd File Permissions Modification Via ChattrAnomalyNULLLinux Auditd Execve
Linux Change File Owner To RootAnomalyNULLSysmon for Linux EventID 1

Groups3

Software11

Campaigns1

Procedure examples15

Groups3

Used byProcedure example
GroupAPT32

APT32's macOS backdoor changes the permission of the file it wants to execute to 755.

GroupRocke

Rocke has changed file permissions of files so they could not be modified.

GroupTeamTNT

TeamTNT has modified the permissions on binaries with chattr.

Software11

Used byProcedure example
MalwareBlack Basta

The Black Basta binary can use `chmod` to gain full permissions to targeted files.

MalwareBundlore

Bundlore changes the permissions of a payload using the command chmod -R 755.

MalwareCOATHANGER

COATHANGER will set the GID of `httpsd` to 90 when infected.

MalwareDok

Dok gives all users execute permissions for the application using the command chmod +x /Users/Shared/AppStore.app.

MalwareDRYHOOK

DRYHOOK has the ability to remount the filesystem as “read-write” to make changes and then restores it to “read-only” prior to killing processes to apply the modifications.

MalwareKinsing

Kinsing has used chmod to modify permissions on key files for use.

MalwareOSX_OCEANLOTUS.D

OSX_OCEANLOTUS.D has changed permissions of a second-stage payload to an executable via chmod.

MalwareOSX/Shlayer

OSX/Shlayer can use the chmod utility to set a file as executable, such as chmod 777 or chmod +x.

View all 11 software examples

Campaigns1

Used byProcedure example
CampaignKV Botnet Activity

KV Botnet Activity altered permissions on downloaded tools and payloads to enable execution on victim machines.

References3

  1. 20 macOS Common Tools and Techniques Open source
    Phil Stokes. (2021, February 16). 20 Common Tools & Techniques Used by macOS Threat Actors & Malware. Retrieved August 23, 2021.
  2. Hybrid Analysis Icacls1 June 2018 Open source
    Hybrid Analysis. (2018, June 12). c9b65b764985dfd7a11d3faf599c56b8.exe. Retrieved August 19, 2018.
  3. Hybrid Analysis Icacls2 May 2018 Open source
    Hybrid Analysis. (2018, May 30). 2a8efbfadd798f6111340f7c1c956bee.dll. Retrieved August 19, 2018.

Data from MITRE ATT&CK® (Enterprise). ATT&CK® is a registered trademark of The MITRE Corporation.