macOS chflags Hidden Flag Set via chflags hidden parameter

Alerts when chflags is run with the hidden flag on macOS to make files or directories less visible.

FreeReviewedSigma · Medium · v2
Product
macos
Category
process_creation
Author
Omar Khaled (@beacon_exe) (SigmaHQ), DRL 1.1
Published
2024-08-21
Updated
2026-07-31
title: macOS chflags Hidden Flag Set via chflags hidden parameter
id: 58cca037-7cdf-49c7-ad85-3d1cbde17964
status: test
description: This rule flags process executions of the chflags utility where the command line contains the hidden flag argument. Setting the hidden file system flag can make files or directories less visible in standard listings and file browsers, supporting attacker stealth. It relies on macOS process creation telemetry including the process image path/name and the command line.
references:
  - https://www.sentinelone.com/labs/apt32-multi-stage-macos-trojan-innovates-on-crimeware-scripting-technique/
  - https://www.welivesecurity.com/2019/04/09/oceanlotus-macos-malware-update/
  - https://www.paloaltonetworks.com/content/dam/pan/en_US/assets/pdf/reports/Unit_42/unit42-wirelurker.pdf
  - https://ss64.com/mac/chflags.html
  - https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_chflags_hidden_flag.yml
author: Omar Khaled (@beacon_exe), Huntrule Team
date: 2024-08-21
tags:
  - attack.credential-access
  - attack.command-and-control
  - attack.stealth
  - attack.t1218
  - attack.t1564.004
  - attack.t1552.001
  - attack.t1105
logsource:
  product: macos
  category: process_creation
detection:
  selection:
    Image|endswith: /chflags
    CommandLine|contains: "hidden "
  condition: selection
falsepositives:
  - Legitimate usage of chflags by administrators and users.
level: medium
license: DRL-1.1
related:
  - id: 3b2c1059-ae5f-40b6-b5d4-6106d3ac20fe
    type: derived