Curl SOCKS Proxy Activity from Unusual Parent

This rule detects the use of the curl command-line tool with SOCKS proxy options, launched from an unusual parent process. Attackers may use curl to establish a SOCKS proxy connection to bypass network restrictions and exfiltrate data or communicate with C2 servers.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2024/11/04"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/11/04"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule detects the use of the `curl` command-line tool with SOCKS proxy options, launched from an unusual parent 
11process. Attackers may use `curl` to establish a SOCKS proxy connection to bypass network restrictions and exfiltrate
12data or communicate with C2 servers.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.*"]
16language = "eql"
17license = "Elastic License v2"
18name = "Curl SOCKS Proxy Activity from Unusual Parent"
19risk_score = 21
20rule_id = "734239fe-eda8-48c0-bca8-9e3dafd81a88"
21setup = """## Setup
22
23This rule requires data coming in from Elastic Defend.
24
25### Elastic Defend Integration Setup
26Elastic 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.
27
28#### Prerequisite Requirements:
29- Fleet is required for Elastic Defend.
30- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
31
32#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
33- Go to the Kibana home page and click "Add integrations".
34- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
35- Click "Add Elastic Defend".
36- Configure the integration name and optionally add a description.
37- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
38- 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).
39- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
40- 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.
41For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
42- Click "Save and Continue".
43- 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.
44For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
45
46Elastic Defend integration does not collect environment variable logging by default.
47In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the Elastic Defend integration.
48 #### To set up environment variable capture for an Elastic Agent policy:
49- Go to “Security → Manage → Policies”.
50- Select an “Elastic Agent policy”.
51- Click “Show advanced settings”.
52- Scroll down or search for “linux.advanced.capture_env_vars”.
53- Enter the names of environment variables you want to capture, separated by commas.
54- For this rule the linux.advanced.capture_env_vars variable should be set to "HTTP_PROXY,HTTPS_PROXY,ALL_PROXY".
55- Click “Save”.
56After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.
57For more information on capturing environment variables refer to the [helper guide](https://www.elastic.co/guide/en/security/current/environment-variable-capture.html).
58"""
59severity = "low"
60tags = [
61    "Domain: Endpoint",
62    "OS: Linux",
63    "Use Case: Threat Detection",
64    "Tactic: Command and Control",
65    "Data Source: Elastic Defend",
66]
67timestamp_override = "event.ingested"
68type = "eql"
69query = '''
70process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
71process.name == "curl" and (
72  process.parent.executable like (
73    "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/var/run/*", "/root/*", "/boot/*", "/var/www/html/*", "/opt/.*"
74  ) or
75  process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
76) and (
77  process.args like ("--socks5-hostname", "--proxy", "--preproxy", "socks5*") or
78  process.args == "-x" or 
79  process.env_vars like ("http_proxy=socks5h://*", "HTTPS_PROXY=socks5h://*", "ALL_PROXY=socks5h://*")
80)
81'''
82
83[[rule.threat]]
84framework = "MITRE ATT&CK"
85
86[[rule.threat.technique]]
87id = "T1572"
88name = "Protocol Tunneling"
89reference = "https://attack.mitre.org/techniques/T1572/"
90
91[rule.threat.tactic]
92id = "TA0011"
93name = "Command and Control"
94reference = "https://attack.mitre.org/tactics/TA0011/"

Related rules

to-top