Detection rules › Elastic

DNS Request to Suspicious File Upload/Download Service

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

This rule detects DNS queries to suspicious file upload/download services via living-off-the-land executables or executables in world/user-writable directories. Malware authors may use these services to exfiltrate data from the target system or to download payloads for later execution.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
This rule detects DNS queries to suspicious file upload/download services via living-off-the-land executables or
executables in world/user-writable directories. Malware authors may use these services to exfiltrate data from the
target system or to download payloads for later execution.
"""
id = "4b648636-f4d4-4ac8-ac34-df7758201824"
license = "Elastic License v2"
name = "DNS Request to Suspicious File Upload/Download Service"
os_list = ["linux"]
reference = ["https://lolexfil.github.io/"]
version = "1.0.3"

query = '''
sequence by process.entity_id with maxspan=10s
  [process where event.type == "start" and event.action == "exec" and (
    process.name in ("curl", "wget", "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox", "timeout", "env") or
    process.name like (".*", "python*", "perl*", "php*", "ruby*", "lua*", "node", "deno") or
    process.executable like (
      "./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
      "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/home/*/*", "/root/*"
    )
  ) and not (
    (process.name like "php*" and process.parent.name == "timeout" and process.args == "/var/tools/koalaping/bin/ping.php") or
    process.executable like "/home/*/OtherApps/firefox/firefox-bin" or
    process.working_directory like "/srv/sao/Processing/Workdir/*" or
    (
      process.parent.executable == "/usr/bin/gnome-shell" and
      process.args like (
        "/snap/firefox/*/firefox.launcher", "/usr/bin/firefox", "/home/*/OtherApps/firefox/firefox"
      )
    )  
  )]
  [dns where event.action == "lookup_result" and dns.question.name like~ (
    /* Generic suspicious upload/download services */
    "*pastebin.com", "*hastebin.com", "*dpaste.org", "*controlc.com", "*0bin.net", "*p.ip.fi", "*sprunge.us",
    "*paste.ee", "*paste.ofcode.org", "*textbin.net", "*send.now", "*send.cm", "*pixeldrain.com", "*megaupload.com",
    "*mediafire.com", "*bashupload.com", "*bujang.online", "*sendit.sh", "*paste4btc.com", "*ghostbin.com", "*filebin.net",
    "*paste.wakas.org",

    /* https://lolexfil.github.io/ */
    "*anonfiles.com", "*bayfiles.com" , "*bublup.com", "*catbox.moe", "*dropfiles.org", "*dropmefiles.com",
    "*easyupload.io", "*file.io", "*filetransfer.io", "*gofile.io", "*qaz.im", "*send.exploit.in", "*sendspace.com",
    "*share.riseup.net", "*temp.sh", "*tempsend.com", "*transfer.sh", "*ufile.io", "*paste.rs", "*nopaste.net"
  )]
'''

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

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"



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


[[threat.technique]]
id = "T1102"
name = "Web Service"
reference = "https://attack.mitre.org/techniques/T1102/"


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

[internal]
min_endpoint_version = "9.3.0"

Stages and Predicates

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

Stage 1: process

[process where event.type == "start" and event.action == "exec" and (
    process.name in ("curl", "wget", "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox", "timeout", "env") or
    process.name like (".*", "python*", "perl*", "php*", "ruby*", "lua*", "node", "deno") or
    process.executable like (
      "./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
      "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/home/*/*", "/root/*"
    )
  ) and not (
    (process.name like "php*" and process.parent.name == "timeout" and process.args == "/var/tools/koalaping/bin/ping.php") or
    process.executable like "/home/*/OtherApps/firefox/firefox-bin" or
    process.working_directory like "/srv/sao/Processing/Workdir/*" or
    (
      process.parent.executable == "/usr/bin/gnome-shell" and
      process.args like (
        "/snap/firefox/*/firefox.launcher", "/usr/bin/firefox", "/home/*/OtherApps/firefox/firefox"
      )
    )  
  )]

Stage 2: dns

[dns where event.action == "lookup_result" and dns.question.name like~ (
    "*pastebin.com", "*hastebin.com", "*dpaste.org", "*controlc.com", "*0bin.net", "*p.ip.fi", "*sprunge.us",
    "*paste.ee", "*paste.ofcode.org", "*textbin.net", "*send.now", "*send.cm", "*pixeldrain.com", "*megaupload.com",
    "*mediafire.com", "*bashupload.com", "*bujang.online", "*sendit.sh", "*paste4btc.com", "*ghostbin.com", "*filebin.net",
    "*paste.wakas.org",
    "*anonfiles.com", "*bayfiles.com" , "*bublup.com", "*catbox.moe", "*dropfiles.org", "*dropmefiles.com",
    "*easyupload.io", "*file.io", "*filetransfer.io", "*gofile.io", "*qaz.im", "*send.exploit.in", "*sendspace.com",
    "*share.riseup.net", "*temp.sh", "*tempsend.com", "*transfer.sh", "*ufile.io", "*paste.rs", "*nopaste.net"
  )]

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dns.question.namewildcard
  • *0bin.net
  • *anonfiles.com
  • *bashupload.com
  • *bayfiles.com
  • *bublup.com
  • *bujang.online
  • *catbox.moe
  • *controlc.com
  • *dpaste.org
  • *dropfiles.org
  • *dropmefiles.com
  • *easyupload.io
  • *file.io
  • *filebin.net
  • *filetransfer.io
  • *ghostbin.com
  • *gofile.io
  • *hastebin.com
  • *mediafire.com
  • *megaupload.com
  • *nopaste.net
  • *p.ip.fi
  • *paste.ee
  • *paste.ofcode.org
  • *paste.rs
  • *paste.wakas.org
  • *paste4btc.com
  • *pastebin.com
  • *pixeldrain.com
  • *qaz.im
  • *send.cm
  • *send.exploit.in
  • *send.now
  • *sendit.sh
  • *sendspace.com
  • *share.riseup.net
  • *sprunge.us
  • *temp.sh
  • *tempsend.com
  • *textbin.net
  • *transfer.sh
  • *ufile.io
field:"QueryName" kind:wildcard
event.actioneq
  • exec
  • lookup_result
field:"EventType" kind:eq
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /home/*/*
  • /lost+found/*
  • /proc/*
  • /root/*
  • /run/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namein
  • bash
  • busybox
  • csh
  • curl
  • dash
  • env
  • fish
  • ksh
  • sh
  • tcsh
  • timeout
  • wget
  • zsh
field:"process_name" kind:in
process.namewildcard
  • .*
  • deno
  • lua*
  • node
  • perl*
  • php*
  • python*
  • ruby*
field:"process_name" kind:wildcard