Event Triggered Execution: Unix Shell Configuration Modification T1546.004

Tactics: Privilege Escalation, Persistence

Adversaries may establish persistence through executing malicious commands triggered by a user’s shell. User Unix Shells execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user’s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user’s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately.

Events covered

2 catalog events are tagged with this technique by at least one rule.

ProviderEventTitle
ESFexecProcess Execution (Notify)
Linux-AuditdEvent ID 1302PATH

Authoring guide

Patterns shared across the 14 rules above: which fields they filter on, what specific values they look for, and what they exclude. The catalog normalizes field names across vendors so Sigma's Image, Elastic's process.name, and Splunk's process_name collapse into one row. Each rule contributes at most once per row.

Fields filtered most (22 distinct)

The fields most rules look at when detecting this technique. The How column shows the operators authors use (eq, wildcard, regex_match, match) and how often each appears. Sample values are concrete examples to start from, not an exhaustive list.

FieldRulesHowSample values
EventType9eq 5, in 4exec, creation, ProcessRollup2, connection_attempted, exec_event
host.os.type8eq 7, in 1
event.type7eq 6, ne 1start, change, deletion
TargetFilename6wildcard 4, starts_with 2, contains 1/boot/efi/efi/*/grub.cfg, /boot/grub/grub.cfg, /boot/grub2/grub.cfg, /dev/shm/.*.swp, /etc/*
process_name5in 3, eq 1, is_not_null 1, wildcard 1bash, *.elf, *.lua*, *.php*, csh
process.args3in 3, contains 1, eq 1, wildcard 1* /dev/shm/* , * /home/*, * /run/*, --, --directory
CommandLine2contains 1, in 1, wildcard 1* nc *, * nc.traditional *, * ncat *, */etc/profile, *~/.bash_profile
container.id2starts_with 2?
event.category2eq 2file, process
file.extension2eq 1, in 1service, swp, timer
file.name2in 2.bash_aliases, .bash_login, .bash_logout, .bash_profile, .bashrc
parent_process_name2eq 2login, sshd
process.args_count2eq 21, 2
type2eq 2PATH, CWD
Image1starts_with 1./, /boot/, /dev/shm/

Top indicator values (443 distinct)

Specific (field, operator, value) combinations the rules check for, ranked by how many rules under this technique use each one. The Corpus reach column counts how many rules across the entire catalog (any technique) check the same combination. High numbers point to widely-used indicators that are likely noisy on their own; combine them with another condition for useful signal. Blank means the combination is specific to rules under this technique. Click a value to expand the rules under this technique that use it.

FieldKindValueRules (here)Corpus reach
event.typeeq
start
5606
EventTypeeq
exec
3171
EventTypein
ProcessRollup2
2117
EventTypein
creation
223
EventTypein
exec
2171
TargetFilenamewildcard
/etc/bash.bashrc
22
TargetFilenamewildcard
/etc/cron.allow
23
TargetFilenamewildcard
/etc/cron.d/*
23
TargetFilenamewildcard
/etc/cron.daily/*
23
TargetFilenamewildcard
/etc/cron.deny
23
TargetFilenamewildcard
/etc/cron.hourly/*
23
TargetFilenamewildcard
/etc/cron.monthly/*
23
TargetFilenamewildcard
/etc/cron.weekly/*
23
TargetFilenamewildcard
/etc/crontab
23
TargetFilenamewildcard
/etc/csh.cshrc
22
TargetFilenamewildcard
/etc/csh.login
22
TargetFilenamewildcard
/etc/fish/config.fish
22
TargetFilenamewildcard
/etc/ksh.kshrc
22
TargetFilenamewildcard
/etc/profile
22
TargetFilenamewildcard
/etc/profile.d/*
22
TargetFilenamewildcard
/etc/systemd/system/*
24
TargetFilenamewildcard
/etc/zsh/*
22
TargetFilenamewildcard
/home/*/.bash_aliases
22
TargetFilenamewildcard
/home/*/.bash_login
22
TargetFilenamewildcard
/home/*/.bash_logout
22
TargetFilenamewildcard
/home/*/.bashrc
22
TargetFilenamewildcard
/home/*/.config/fish/config.fish
22
TargetFilenamewildcard
/home/*/.config/systemd/user/*
24
TargetFilenamewildcard
/home/*/.cshrc
22
TargetFilenamewildcard
/home/*/.kshrc
22

Exclusions (183 distinct)

Field/operator/value combinations excluded by rules under this technique (top-level not() clauses), sorted by how many rules exclude each. These are the false-positive paths the community has learned to filter out. A new rule that ignores the high-count entries here will likely fire on the same noisy paths. Click a value to expand the rules under this technique that exclude it.

Rules under this technique

Every rule in the catalog tagged with this technique, grouped by vendor. Click a rule title for its full predicates, exclusions, and indicators.

Platform (all)
Domain (all)

Sigma 1 rule

Elastic 10 rules

Splunk 3 rules