sigma
sigma copied to clipboard
Value Modifiers and Conditional Field Mapping Bug
Using value modifiers in a rule appears to conflict with conditional field mappings in a config file. Using the examples:
Set the type: PATH
selection to be modified using |contains
title: Edit of .bash_profile and .bashrc
id: e74e15cc-c4b6-4c80-b7eb-dfe49feb7fe9
status: experimental
description: Detects change of user environment. Adversaries can insert code into these files to gain persistence each time a user logs in or opens a new shell.
author: Peter Matkovski
date: 2019/05/12
references:
- 'MITRE Attack technique T1156; .bash_profile and .bashrc. '
logsource:
product: linux
service: auditd
detection:
selection:
type|contains: 'PATH'
name:
- '/home/*/.bashrc'
- '/home/*/.bash_profile'
- '/home/*/.profile'
- '/etc/profile'
- '/etc/shells'
- '/etc/bashrc'
- '/etc/csh.cshrc'
- '/etc/csh.login'
condition: selection
falsepositives:
- Admin or User activity
level: medium
tags:
- attack.s0003
- attack.t1156 # an old one
- attack.persistence
- attack.t1546.004
Use a conditional field mapping:
fieldmappings:
type:
type=PATH:
- event.original
Produces the following, incorrect ElastAlert rule, note the type:*PATH*
rather than what it should be event.original:*PATH*
.
alert:
- debug
description: Detects change of user environment. Adversaries can insert code into these files to gain persistence each time a user logs in or opens a new shell.
filter:
- query:
query_string:
query: (event.module:auditd AND type:*PATH* AND auditd.paths.name:(\/home\/*\/.bashrc OR \/home\/*\/.bash_profile OR \/home\/*\/.profile OR \/etc\/profile OR \/etc\/shells OR \/etc\/bashrc OR \/etc\/csh.cshrc OR \/etc\/csh.login))
index: auditbeat-*
name: e74e15cc-c4b6-4c80-b7eb-dfe49feb7fe9-Edit-of-.bash_profile-and-.bashrc
priority: 3
realert:
minutes: 0
type: any