Skip to content

[New Rule] Timestomping using SetFile - #7194

Open
litemars wants to merge 10 commits into
mainfrom
new_rule/timestomp_with_setfile.toml
Open

litemars wants to merge 10 commits into
mainfrom
new_rule/timestomp_with_setfile.toml

Conversation

@litemars

@litemars litemars commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary - What I changed

Adds a new macOS BB rule, which detects SetFile being used to change a file's creation (-d) or modification (-m) timestamp.

SetFile ships with Xcode Command Line Tools. The existing Timestomping using Touch Command rule (rules/cross-platform/defense_evasion_timestomp_touch.toml) only covers touch.

Test

touch /tmp/test.txt
SetFile -m 01/01/1970 /tmp/test.txt
SetFile -d "01/01/2020 10:00:00" /tmp/test.txt

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown

Starting the rule tests ...

Removed noise and performance metrics from rule metadata.
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown

Starting the rule tests ...

@litemars
litemars marked this pull request as ready for review November 24, 2026 12:47
Copilot AI balanced review requested due to automatic review settings November 24, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new rule has inconsistent creation and update dates and an inaccurate distinction between macOS timestamp-setting behaviors in both its description and investigation guide.

2 open issues
What changed in this PR

Adds a macOS building-block rule for timestamp changes using SetFile, complementing the existing touch timestomping detection.

Changes:

  • Detects SetFile executions with -d or -m using Elastic Defend process events.
  • Configures hourly execution and one-hour suppression by host and parent executable.
  • Includes investigation guidance, integration setup instructions, and MITRE ATT&CK Timestomp mapping.
File Description
rules_building_block/​defense_evasion_timestomp_setfile.toml Adds the SetFile detection, suppression settings, and supporting guidance.

Review effort: Balanced

Removed detailed investigation guide and setup instructions for timestomping using SetFile.
Updated creation and updated dates in the configuration.

query = '''
process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and
process.name == "SetFile" and process.args in ("-d", "-m")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
process.name == "SetFile" and process.args in ("-d", "-m")
process.name : "SetFile" and process.args in ("-d", "-m")

Use case insensitive ":"

litemars and others added 4 commits December 1, 2026 11:03
Updated description for defense evasion timestomp setfile.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Bryan Porras <bryan.porras@elastic.co>
Co-authored-by: Bryan Porras <bryan.porras@elastic.co>
Co-authored-by: Bryan Porras <bryan.porras@elastic.co>
@litemars
litemars requested a review from django-88 December 1, 2026 10:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants