Skip to content

Commit edee5c0

Browse files
committed
[New Rule] Curl or Wget Egress Network Connection via LoLBin
1 parent f0e9281 commit edee5c0

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
[metadata]
2+
creation_date = "2025/11/20"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
updated_date = "2025/11/20"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule detects the execution of curl or wget binaries through a GTFOBin (living-off-the-land) technique in Linux
11+
environments. Attackers may exploit these utilities to download and execute malicious files from the internet while
12+
attempting to evade detection. The rule specifically targets binaries that are capable of executing shell commands
13+
directly from the proxied binary, rather than just spawning a shell.
14+
"""
15+
from = "now-9m"
16+
index = ["logs-endpoint.events.process*", "logs-endpoint.events.network*"]
17+
language = "eql"
18+
license = "Elastic License v2"
19+
name = "Curl or Wget Egress Network Connection via LoLBin"
20+
references = ["https://gtfobins.github.io/#+shell"]
21+
risk_score = 47
22+
rule_id = "d1ee711a-a3ba-4d73-b5ab-84cab5b37fb3"
23+
setup = """## Setup
24+
25+
This rule requires data coming in from Elastic Defend.
26+
27+
### Elastic Defend Integration Setup
28+
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
29+
30+
#### Prerequisite Requirements:
31+
- Fleet is required for Elastic Defend.
32+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
33+
34+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
35+
- Go to the Kibana home page and click "Add integrations".
36+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
37+
- Click "Add Elastic Defend".
38+
- Configure the integration name and optionally add a description.
39+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
40+
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
41+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
42+
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
43+
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
44+
- Click "Save and Continue".
45+
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
46+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
47+
"""
48+
severity = "medium"
49+
tags = [
50+
"Domain: Endpoint",
51+
"OS: Linux",
52+
"Use Case: Threat Detection",
53+
"Tactic: Defense Evasion",
54+
"Tactic: Execution",
55+
"Tactic: Command and Control",
56+
"Tactic: Exfiltration",
57+
"Data Source: Elastic Defend",
58+
]
59+
type = "eql"
60+
query = '''
61+
sequence with maxspan=3s
62+
[process where event.type == "start" and event.action == "exec" and process.name in (
63+
"aa-exec", "aoss", "awk", "run-parts", "bundle", "bundler", "busctl", "busybox", "byebug", "c89", "c99", "cabal",
64+
"capsh", "cdist", "certbot", "check_by_ssh", "choom", "cobc", "cowsay", "cowthink", "cpio", "cpulimit", "csvtool",
65+
"dc", "distcc", "easy_install", "emacs", "enscript", "expect", "find", "flock", "gawk", "gcc", "gdb", "gem",
66+
"genie", "ghc", "ghci", "gimp", "grc", "gtester", "ionice", "irb", "jjs", "jrunscript", "knife", "latex",
67+
"latexmk", "lftp", "logsave", "ltrace", "mail", "mawk", "msgfilter", "multitime", "mysql", "nawk", "neofetch",
68+
"nice", "nohup", "npm", "nroff", "nsenter", "octave", "openvpn", "pandoc", "pdb", "pdflatex", "pdftex", "perf",
69+
"pexec", "pip", "rake", "rc", "rlwrap", "rpmdb", "rpmquery", "rpmverify", "rsync", "rtorrent", "runscript",
70+
"rview", "rvim", "script", "scrot", "sed", "service", "setarch", "setlock", "sg", "socat", "softlimit", "split",
71+
"sqlite3", "sqlmap", "sshpass", "start-stop-daemon", "stdbuf", "tar", "taskset",
72+
"tasksh", "tex", "time", "tmate", "torify", "torsocks", "tshark", "valgrind", "vi", "view",
73+
"vim", "vimdiff", "watch", "xdg-user-dir", "xdotool", "xelatex", "xetex", "yarn", "zip", "zypper"
74+
) and not (
75+
process.executable == "/tmp/newroot/unshare" or
76+
process.parent.args in (
77+
"/etc/.agent/server_agent.sh", "/nessus/update2.sh", "/etc/cron.daily/spamassassin", "/etc/cron.daily/rkhunter",
78+
"buildkit-runc", "/usr/sbin/spamassassin-maint"
79+
) or
80+
process.parent.executable like (
81+
"/usr/local/bin/fail2ban_cluster.sh", "/script/downloadArtifacts.sh", "/etc/cron.daily/rkhunter",
82+
"/usr/bin/bbb-conf", "/usr/sbin/sos", "/usr/bin/make", "/var/lib/amagent/*", "/etc/cron.daily/spamassassin",
83+
"/usr/lib/cron/run-crons", "/usr/sbin/spamassassin-maint", "/usr/sbin/oracle-libs-update"
84+
) or
85+
process.parent.name in ("rkhunter", "vivaldi-stable.postinst", "runc") or
86+
process.parent.command_line == "runc init" or
87+
process.parent.command_line like "/home/*/bin/DownloadExchangeFiles_mcx*" or
88+
process.command_line in (
89+
"nice -10 /opt/aws/discovery/update", "xargs -n 1 curl -o lpsc -L", "/usr/bin/ruby /usr/bin/rake run:server_hooks",
90+
"nohup ./update2.sh"
91+
) or
92+
process.parent.command_line in ("/bin/sh -c nice -n 15 $HOME/bin/cron.pl > /dev/null 2>&1", "/bin/sh /etc/cron.daily/rkhunter") or
93+
process.command_line like ("*/home/linuxbrew/.linuxbrew/*", "*Homebrew*", "*webhook*") or
94+
process.args like ("/usr/lib/jvm/*", "/root/.forge/provision-*.sh", "/usr/src/ucrm/scripts/update-certificates.sh", "/etc/periodic/weekly/update_mmdb.sh") or
95+
(process.name == "nohup" and process.command_line like "nohup /usr/*/*.sh") or
96+
(process.name == "julia" and process.parent.name == "julia")
97+
)
98+
] by process.entity_id
99+
[network where event.type == "start" and event.action == "connection_attempted" and
100+
process.name in ("wget", "curl") and not (
101+
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
102+
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",
103+
"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",
104+
"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",
105+
"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",
106+
"FF00::/8"
107+
)
108+
)
109+
] by process.parent.entity_id
110+
'''
111+
112+
[[rule.threat]]
113+
framework = "MITRE ATT&CK"
114+
115+
[rule.threat.tactic]
116+
name = "Defense Evasion"
117+
id = "TA0005"
118+
reference = "https://attack.mitre.org/tactics/TA0005/"
119+
120+
[[rule.threat.technique]]
121+
id = "T1218"
122+
name = "System Binary Proxy Execution"
123+
reference = "https://attack.mitre.org/techniques/T1218/"
124+
125+
[[rule.threat]]
126+
framework = "MITRE ATT&CK"
127+
128+
[rule.threat.tactic]
129+
name = "Execution"
130+
id = "TA0002"
131+
reference = "https://attack.mitre.org/tactics/TA0002/"
132+
133+
[[rule.threat.technique]]
134+
id = "T1059"
135+
name = "Command and Scripting Interpreter"
136+
reference = "https://attack.mitre.org/techniques/T1059/"
137+
138+
[[rule.threat.technique.subtechnique]]
139+
name = "Unix Shell"
140+
id = "T1059.004"
141+
reference = "https://attack.mitre.org/techniques/T1059/004/"
142+
143+
[[rule.threat]]
144+
framework = "MITRE ATT&CK"
145+
146+
[rule.threat.tactic]
147+
id = "TA0011"
148+
name = "Command and Control"
149+
reference = "https://attack.mitre.org/tactics/TA0011/"
150+
151+
[[rule.threat]]
152+
framework = "MITRE ATT&CK"
153+
154+
[rule.threat.tactic]
155+
id = "TA0010"
156+
name = "Exfiltration"
157+
reference = "https://attack.mitre.org/tactics/TA0010/"

0 commit comments

Comments
 (0)