Perl Script File Creation or Modification
Description
Detects when a .pl file gets created or modified by a non-perl binary. Perl is a scripting language that comes pre-installed on macOS and is a trusted binary offering an extensive set of capabilities and advantages to an adversary. Its use on a macOS system is not common and therefore specific behaviors exhibited can be classified as malicious or suspicious at least.
Query · eql
sequence by process.entity_id with maxspan=15s
[network where event.type == "start"]
[file where event.action == "modification" and file.extension == "pl" and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
file.path like ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/var/tmp/*", "/private/var/tmp/*") and
not Effective_process.executable like "/nix/store/*-nix-*/bin/nix"]