Suspicious pbpaste High Volume Activity
Identifies a high volume of pbpaste executions, which may indicate a bash loop continuously collecting clipboard
contents, potentially allowing an attacker to harvest user credentials or other sensitive information.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/09/12"
3integration = ["endpoint", "jamf_protect"]
4maturity = "production"
5updated_date = "2026/10/26"
6[transform]
7[[transform.investigate]]
8label = "Show events having the same responsible process"
9providers = [
10 [
11 { excluded = false, field = "host.hostname", queryType = "phrase", value = "{{host.hostname}}", valueType = "string" },
12 { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.group_leader.entity_id}}", valueType = "string" }
13 ]
14]
15
16[[transform.investigate]]
17label = "Show events having the same parent process"
18providers = [
19 [
20 { excluded = false, field = "host.hostname", queryType = "phrase", value = "{{host.hostname}}", valueType = "string" },
21 { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.parent.entity_id}}", valueType = "string" }
22 ]
23]
24
25
26[rule]
27author = ["Thijs Xhaflaire"]
28description = """
29Identifies a high volume of `pbpaste` executions, which may indicate a bash loop continuously collecting clipboard
30contents, potentially allowing an attacker to harvest user credentials or other sensitive information.
31"""
32from = "now-9m"
33index = ["logs-jamf_protect*", "logs-endpoint.events.process-*"]
34language = "eql"
35license = "Elastic License v2"
36name = "Suspicious pbpaste High Volume Activity"
37note = """## Triage and analysis
38
39> **Disclaimer**:
40> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
41
42### Investigating Suspicious pbpaste High Volume Activity
43
44`pbpaste` is a native macOS utility that writes the current contents of the general pasteboard (clipboard) to standard output. Adversaries and infostealers can call it repeatedly from a shell loop or script to harvest anything the user copies, such as passwords pasted from a password manager, tokens, or seed phrases. This rule alerts when `pbpaste` is executed at least five times on the same host within one minute, a pattern consistent with automated clipboard collection rather than interactive use.
45
46### Possible investigation steps
47
48- Review the sequence of `pbpaste` executions and their timing to determine whether they occur at regular intervals, which suggests a loop or scheduled task.
49- Identify the parent and responsible process of the `pbpaste` executions to find the script, interpreter, or application driving the activity. For Elastic Defend data, review `process.parent.executable`, `process.parent.command_line`, and `process.group_leader.executable`; for Jamf Protect data, review `process.parent.executable` and `process.responsible.executable`.
50 - $investigate_0
51 - $investigate_1
52- If the parent is a shell or script interpreter (`bash`, `zsh`, `sh`, `osascript`, `python`), recover the script content from the command line or from the script file on disk and look for redirection of output to files or network utilities.
53- Check whether the responsible process is signed and trusted (`process.code_signature.*`), and whether its executable lives in a user-writable or temporary location such as `/tmp`, `/Users/Shared`, or a hidden directory under the user's home.
54- Look for file creation events from the same process tree that may store the collected clipboard data, and for outbound network connections (for example via `curl`, `nc`, or the interpreter itself) that may exfiltrate it.
55- Determine how the responsible process was established on the host, such as a recently created LaunchAgent, LaunchDaemon, login item, or a recently downloaded application.
56- Review other alerts for the same `host.id` and `user.name` around the alert time to identify related credential access, persistence, or exfiltration activity.
57
58### False positive analysis
59
60- Clipboard managers, text expansion tools, and developer utilities may call `pbpaste` frequently. Verify the responsible application is a known, signed tool approved for use in the environment.
61- Users or administrators running shell scripts or automation (for example Shortcuts, Automator, or terminal workflows) can produce bursts of `pbpaste` executions. Confirm the script and its author with the user.
62- When the activity is confirmed benign, create an exception scoped to the specific responsible process executable or parent command line rather than to `pbpaste` itself.
63
64### Response and remediation
65
66- Isolate the affected host from the network to prevent further collection and exfiltration of clipboard data.
67- Terminate the process tree responsible for the `pbpaste` executions and remove the associated script or binary.
68- Remove any persistence mechanism that launches the collection script, such as LaunchAgents, LaunchDaemons, cron jobs, or login items.
69- Assume that any credentials, tokens, or secrets copied to the clipboard during the activity window are compromised: rotate them and revoke active sessions.
70- Review the host for additional infostealer behavior, such as access to browser credential stores or the user's keychain.
71- Escalate to the incident response team if exfiltration is confirmed or if other hosts show the same responsible process or script.
72"""
73references = ["https://www.loobins.io/binaries/pbpaste/"]
74risk_score = 47
75rule_id = "e29599ee-d6ad-46a9-9c6a-dc39f361890d"
76setup = """## Setup
77
78This rule requires data coming in from Jamf Protect.
79
80### Jamf Protect Integration Setup
81Jamf Protect is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events incoming events and send data to the Elastic.
82
83#### Prerequisite Requirements:
84- Fleet is required for Jamf Protect.
85- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
86
87#### The following steps should be executed in order to add the Jamf Protect integration:
88- Go to the Kibana home page and click "Add integrations".
89- In the query bar, search for "Jamf Protect" and select the integration to see more details about it.
90- Click "Add Jamf Protect".
91- Configure the integration name.
92- Click "Save and Continue".
93"""
94severity = "medium"
95tags = [
96 "Domain: Endpoint",
97 "OS: macOS",
98 "Use Case: Threat Detection",
99 "Tactic: Credential Access",
100 "Data Source: Jamf Protect",
101 "Data Source: Elastic Defend",
102 "Resources: Investigation Guide",
103 "Noise: High",
104 "Performance: Normal",
105 "Profile: Aggressive",
106 "Rule Type: Event Correlation (EQL)",
107 "Platform: macOS",
108]
109timestamp_override = "event.ingested"
110type = "eql"
111
112query = '''
113sequence by host.hostname, host.id with maxspan=1m
114[process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.name: "pbpaste"] with runs = 5
115'''
116
117
118[[rule.threat]]
119framework = "MITRE ATT&CK"
120
121[[rule.threat.technique]]
122id = "T1056"
123name = "Input Capture"
124reference = "https://attack.mitre.org/techniques/T1056/"
125
126[rule.threat.tactic]
127id = "TA0006"
128name = "Credential Access"
129reference = "https://attack.mitre.org/tactics/TA0006/"
130
131[[rule.threat]]
132framework = "MITRE ATT&CK"
133
134[[rule.threat.technique]]
135id = "T1115"
136name = "Clipboard Data"
137reference = "https://attack.mitre.org/techniques/T1115/"
138
139[rule.threat.tactic]
140id = "TA0009"
141name = "Collection"
142reference = "https://attack.mitre.org/tactics/TA0009/"
Triage and analysis
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating Suspicious pbpaste High Volume Activity
pbpaste is a native macOS utility that writes the current contents of the general pasteboard (clipboard) to standard output. Adversaries and infostealers can call it repeatedly from a shell loop or script to harvest anything the user copies, such as passwords pasted from a password manager, tokens, or seed phrases. This rule alerts when pbpaste is executed at least five times on the same host within one minute, a pattern consistent with automated clipboard collection rather than interactive use.
Possible investigation steps
- Review the sequence of
pbpasteexecutions and their timing to determine whether they occur at regular intervals, which suggests a loop or scheduled task. - Identify the parent and responsible process of the
pbpasteexecutions to find the script, interpreter, or application driving the activity. For Elastic Defend data, reviewprocess.parent.executable,process.parent.command_line, andprocess.group_leader.executable; for Jamf Protect data, reviewprocess.parent.executableandprocess.responsible.executable.- $investigate_0
- $investigate_1
- If the parent is a shell or script interpreter (
bash,zsh,sh,osascript,python), recover the script content from the command line or from the script file on disk and look for redirection of output to files or network utilities. - Check whether the responsible process is signed and trusted (
process.code_signature.*), and whether its executable lives in a user-writable or temporary location such as/tmp,/Users/Shared, or a hidden directory under the user's home. - Look for file creation events from the same process tree that may store the collected clipboard data, and for outbound network connections (for example via
curl,nc, or the interpreter itself) that may exfiltrate it. - Determine how the responsible process was established on the host, such as a recently created LaunchAgent, LaunchDaemon, login item, or a recently downloaded application.
- Review other alerts for the same
host.idanduser.namearound the alert time to identify related credential access, persistence, or exfiltration activity.
False positive analysis
- Clipboard managers, text expansion tools, and developer utilities may call
pbpastefrequently. Verify the responsible application is a known, signed tool approved for use in the environment. - Users or administrators running shell scripts or automation (for example Shortcuts, Automator, or terminal workflows) can produce bursts of
pbpasteexecutions. Confirm the script and its author with the user. - When the activity is confirmed benign, create an exception scoped to the specific responsible process executable or parent command line rather than to
pbpasteitself.
Response and remediation
- Isolate the affected host from the network to prevent further collection and exfiltration of clipboard data.
- Terminate the process tree responsible for the
pbpasteexecutions and remove the associated script or binary. - Remove any persistence mechanism that launches the collection script, such as LaunchAgents, LaunchDaemons, cron jobs, or login items.
- Assume that any credentials, tokens, or secrets copied to the clipboard during the activity window are compromised: rotate them and revoke active sessions.
- Review the host for additional infostealer behavior, such as access to browser credential stores or the user's keychain.
- Escalate to the incident response team if exfiltration is confirmed or if other hosts show the same responsible process or script.
References
Related rules
- Potential Cookies Theft via Browser Debugging
- Suspicious Instance Metadata Service (IMDS) API Command Line Execution
- Connection to Common Large Language Model Endpoints
- Potential Data Exfiltration Through Curl
- Potential Reverse Shell Activity via Terminal