Skip to content

Commit c2500ea

Browse files
norbert791swachchhanda000frack113
authored
Merge PR #6027 from @norbert791 - Fix false positives for OpenCode to some osascript related rules
fix: MacOS Scripting Interpreter AppleScript - Add filter for OpenCode fix: Clipboard Access Via OSAScript - Filter OpenCode and update metadata --------- Co-authored-by: Swachchhanda Shrawan Poudel <87493836+swachchhanda000@users.noreply.github.com> Co-authored-by: frack113 <62423083+frack113@users.noreply.github.com>
1 parent f7f8cc1 commit c2500ea

3 files changed

Lines changed: 49 additions & 31 deletions

File tree

rules/macos/process_creation/proc_creation_macos_applescript.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ references:
77
- https://redcanary.com/blog/applescript/
88
author: Alejandro Ortuno, oscd.community
99
date: 2020-10-21
10-
modified: 2023-02-01
10+
modified: 2026-05-21
1111
tags:
1212
- attack.execution
1313
- attack.t1059.002
@@ -21,7 +21,15 @@ detection:
2121
- ' -e '
2222
- '.scpt'
2323
- '.js'
24-
condition: selection
24+
filter_optional_opencode:
25+
# OpenCode uses osascript to handle copying text from the TUI on MacOS devices. See https://github.com/anomalyco/opencode/blob/ca723f1cbc6fc4244ae57e61e9de8c4e37380ed4/packages/opencode/src/cli/cmd/tui/util/clipboard.ts#L65 for reference.
26+
ParentImage|endswith: 'opencode'
27+
CommandLine|contains|all:
28+
- 'osascript'
29+
- ' -e '
30+
- 'set imageData to the clipboard'
31+
- 'set fileRef'
32+
condition: selection and not 1 of filter_optional_*
2533
falsepositives:
2634
- Application installers might contain scripts as part of the installation process.
2735
level: medium
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
title: Clipboard Access Via OSAScript
2+
id: 7794fa3c-edea-4cff-bec7-267dd4770fd7
3+
related:
4+
- id: 1bc2e6c5-0885-472b-bed6-be5ea8eace55
5+
type: derived
6+
status: test
7+
description: Detects access to clipboard content via osascript, which may be used for data collection but also occurs in legitimate clipboard utilities and automation scripts
8+
references:
9+
- https://www.sentinelone.com/blog/how-offensive-actors-use-applescript-for-attacking-macos/
10+
author: Sohan G (D4rkCiph3r)
11+
date: 2023-01-31
12+
modified: 2026-05-22
13+
tags:
14+
- attack.collection
15+
- attack.execution
16+
- attack.t1115
17+
- attack.t1059.002
18+
logsource:
19+
product: macos
20+
category: process_creation
21+
detection:
22+
selection:
23+
Image|endswith: '/osascript'
24+
CommandLine|contains|all:
25+
- ' -e '
26+
- 'clipboard'
27+
filter_optional_opencode:
28+
# OpenCode uses osascript to handle copying text from the TUI on MacOS devices. See https://github.com/anomalyco/opencode/blob/ca723f1cbc6fc4244ae57e61e9de8c4e37380ed4/packages/opencode/src/cli/cmd/tui/util/clipboard.ts#L65 for reference.
29+
ParentImage|endswith: 'opencode'
30+
CommandLine|contains|all:
31+
- 'osascript'
32+
- ' -e '
33+
- 'set imageData to the clipboard'
34+
- 'set fileRef'
35+
condition: selection and not 1 of filter_optional_*
36+
falsepositives:
37+
- Legitimate clipboard utilities and automation scripts that read or write clipboard content
38+
- Developer tools and IDEs that use osascript for clipboard integration
39+
level: medium

rules/macos/process_creation/proc_creation_macos_clipboard_data_via_osascript.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)