Modify Shell Configuration File
Description
Detect attempts to modify shell configuration files, primarily aimed at establishing persistence by automatically inserting commands into scripts executed by shells. The upstream rule excludes shell processes because they often create unnecessary noise. However, this might lead to missed detections. To customize the rule for your situation, you can fine-tune it using enhanced profiling. For example, you might want to only consider interactive shell processes (where proc.tty != 0).
Query · falco
open_write and (fd.filename in (shell_config_filenames) or
fd.name in (shell_config_files) or
fd.directory in (shell_config_directories))
and not proc.name in (shell_binaries) and not exe_running_docker_save and not user_known_shell_config_modifiers
Rule dependencies
Depends on
-
composes · Falco macro
exe_running_docker_saveA shared condition, not a detection — not indexed on this site. -
composes · Falco macro
open_writeA shared condition, not a detection — not indexed on this site. -
composes · Falco macro
user_known_shell_config_modifiersA shared condition, not a detection — not indexed on this site.
Analyst notes
A shell configuration file has been modified | file=%fd.name pcmdline=%proc.pcmdline evt_type=%evt.type user=%user.name user_uid=%user.uid user_loginuid=%user.loginuid process=%proc.name proc_exepath=%proc.exepath parent=%proc.pname command=%proc.cmdline terminal=%proc.tty