Detection rules › Elastic

Egress Network Connection from RPM Package

Time window
3s
Sequence by
process.entity_id, process.parent.entity_id
Source
github.com/elastic/protections-artifacts

This rule monitors for egress network connections from processes that are executed from an RPM package parent. Attackers can backdoor an RPM package to establish initial access, or install a malicious RPM package to maintain persistence.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
This rule monitors for egress network connections from processes that are executed from an RPM package parent. Attackers
can backdoor an RPM package to establish initial access, or install a malicious RPM package to maintain persistence.
"""
id = "d20cd4ba-ff65-4e1c-8012-4241d449b16b"
license = "Elastic License v2"
name = "Egress Network Connection from RPM Package"
os_list = ["linux"]
version = "1.0.13"

query = '''
sequence with maxspan=3s
  [process where event.type == "start" and event.action == "exec" and
   process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
   process.parent.args : "/var/tmp/rpm-tmp.*" and not (
     (process.name == "curl" and process.command_line like ("*.microsoft.com/api/report*", "*check.percona.com*")) or
     process.executable in ("/sbin/runuser", "/usr/sbin/runuser") or
     process.working_directory like~ (
       "/builds/packages/naudit-repos", "/disco_flowlytics/docker/overlay2/*", "/builddir/build/BUILD/librdkafka-*/mklove/deps/src/libzstd"
     ) or
     process.args : ("/usr/local/cpanel/3rdparty/wp-toolkit/*", "/usr/bin/rpmkeys") or
     (process.executable == "/bin/sudo" and process.args in (
       "https://global.endpoint.security.micro",
       "https://global.endpoint.security.micros"
       )
     ) or
     (process.name == "curl" and process.args == "sudo" and process.args == "mdatp" and process.args == "--cacert") or
     process.command_line like "runuser -u mdatp*" or
     process.name == "sudo"
   )
  ] by process.entity_id
  [network where event.type == "start" and event.action == "connection_attempted" and not (
     destination.ip == null or
     destination.ip == "0.0.0.0" or
     cidrmatch(
       destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
       "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
       "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
       "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
       "FF00::/8", "172.31.0.0/16"
       ) or
      process.executable in (
      "/opt/cisco/amp/bin/ampinsthelper", "/usr/libexec/platform-python", "/sbin/update-pciids",
      "/etc/nginx/ea-nginx/config-scripts/global/config-scripts-global-cloudflare",
      "/opt/kerio/GFIAgent/GFIAgentInstaller", "/usr/share/centrifydc/libexec/adinfo",
      "/opt/teleport/system/bin/tsh"
      ) or
      process.executable like "/usr/local/cpanel/3rdparty/perl/*/bin/perl"
    )
  ] by process.parent.entity_id
'''

min_endpoint_version = "8.6.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"



[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"

[[threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[threat.technique.subtechnique]]
id = "T1546.016"
name = "Installer Packages"
reference = "https://attack.mitre.org/techniques/T1546/016/"


[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"


[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "8.6.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 3s, correlated by process.entity_id, process.parent.entity_id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and
   process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
   process.parent.args : "/var/tmp/rpm-tmp.*" and not (
     (process.name == "curl" and process.command_line like ("*.microsoft.com/api/report*", "*check.percona.com*")) or
     process.executable in ("/sbin/runuser", "/usr/sbin/runuser") or
     process.working_directory like~ (
       "/builds/packages/naudit-repos", "/disco_flowlytics/docker/overlay2/*", "/builddir/build/BUILD/librdkafka-*/mklove/deps/src/libzstd"
     ) or
     process.args : ("/usr/local/cpanel/3rdparty/wp-toolkit/*", "/usr/bin/rpmkeys") or
     (process.executable == "/bin/sudo" and process.args in (
       "https://global.endpoint.security.micro",
       "https://global.endpoint.security.micros"
       )
     ) or
     (process.name == "curl" and process.args == "sudo" and process.args == "mdatp" and process.args == "--cacert") or
     process.command_line like "runuser -u mdatp*" or
     process.name == "sudo"
   )
  ] by process.entity_id

Stage 2: network

[network where event.type == "start" and event.action == "connection_attempted" and not (
     destination.ip == null or
     destination.ip == "0.0.0.0" or
     cidrmatch(
       destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
       "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
       "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
       "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
       "FF00::/8", "172.31.0.0/16"
       ) or
      process.executable in (
      "/opt/cisco/amp/bin/ampinsthelper", "/usr/libexec/platform-python", "/sbin/update-pciids",
      "/etc/nginx/ea-nginx/config-scripts/global/config-scripts-global-cloudflare",
      "/opt/kerio/GFIAgent/GFIAgentInstaller", "/usr/share/centrifydc/libexec/adinfo",
      "/opt/teleport/system/bin/tsh"
      ) or
      process.executable like "/usr/local/cpanel/3rdparty/perl/*/bin/perl"
    )
  ] by process.parent.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq--cacertexcludes:process.args field:"process.args" value:"--cacert"
process.argseqmdatpexcludes:process.args field:"process.args" value:"mdatp"
process.argseqsudoexcludes:process.args field:"process.args" value:"sudo"
process.nameeqcurlexcludes:process.name field:"process.name" value:"curl"
process.argsinhttps://global.endpoint.security.micro, https://global.endpoint.security.microsexcludes:process.args field:"process.args" value:"https://global.endpoint.security.micro" field:"process.args" value:"https://global.endpoint.security.micros"
process.executableeq/bin/sudoexcludes:process.executable field:"process.executable" value:"/bin/sudo"
process.command_linematch.microsoft.com/api/report, check.percona.comexcludes:process.command_line field:"process.command_line" value:".microsoft.com/api/report" field:"process.command_line" value:"check.percona.com"
process.argswildcard/usr/local/cpanel/3rdparty/wp-toolkit/*, /usr/bin/rpmkeysexcludes:process.args field:"process.args" value:"/usr/local/cpanel/3rdparty/wp-toolkit/*" field:"process.args" value:"/usr/bin/rpmkeys"
process.command_linestarts_withrunuser -u mdatpexcludes:process.command_line field:"process.command_line" value:"runuser -u mdatp"
process.executablein/sbin/runuser, /usr/sbin/runuserexcludes:process.executable field:"process.executable" value:"/sbin/runuser" field:"process.executable" value:"/usr/sbin/runuser"
process.nameeqsudoexcludes:process.name field:"process.name" value:"sudo"
process.working_directorywildcard/builds/packages/naudit-repos, /disco_flowlytics/docker/overlay2/*, /builddir/build/BUILD/librdkafka-*/mklove/deps/src/libzstdexcludes:process.working_directory field:"process.working_directory" value:"/builds/packages/naudit-repos" field:"process.working_directory" value:"/disco_flowlytics/docker/overlay2/*" field:"process.working_directory" value:"/builddir/build/BUILD/librdkafka-*/mklove/deps/src/libzstd"
destination.ipcidr_match10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8, 172.31.0.0/16excludes:destination.ip
destination.ipeq0.0.0.0excludes:destination.ip field:"destination.ip" value:"0.0.0.0"
destination.ipis_null(no value, null check)excludes:destination.ip
process.executablein/etc/nginx/ea-nginx/config-scripts/global/config-scripts-global-cloudflare, /opt/cisco/amp/bin/ampinsthelper, /opt/kerio/GFIAgent/GFIAgentInstaller, /opt/teleport/system/bin/tsh, /sbin/update-pciids, /usr/libexec/platform-python, /usr/share/centrifydc/libexec/adinfoexcludes:process.executable
process.executablewildcard/usr/local/cpanel/3rdparty/perl/*/bin/perlexcludes:process.executable field:"process.executable" value:"/usr/local/cpanel/3rdparty/perl/*/bin/perl"

Indicators

These rows show field, operator, and value matches.