Skip to content

Commit 913a439

Browse files
authored
Add Cookbook rule for stopping osascript asking for passwords. (#608)
This adds a cookbook CEL rule for blocking osascript when it attempts to pop open a dialog prompting the user for passwords.
1 parent dfce0e5 commit 913a439

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

docs/docs/cookbook/cel.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,24 @@ args.exists(arg, arg in ['-a', '-m', '-r', '-A', '-t']) && args.join(" ").contai
4141
```
4242

4343
Note this will not stop using the system calls directly or otherwise programmatically modifying the timestamps.
44+
45+
## Prevent OSAScript From Popping Password Dialogs
46+
47+
A lot of malware on macOS will attempt to get users to enter their passwords
48+
into a dialog box via osascript. This is a basic rule to stop directly asking
49+
for a password dialog.
50+
51+
Make a SigningID rule for `platform:com.apple.osascript` with the following CEL
52+
Program
53+
54+
```clike
55+
(args.join(" ").lowerAscii().matches(".*\\W+with\\W+hidden\\W+answer.*") || args.join(" ").lowerAscii().contains("password")) && args.join(" ").lowerAscii().matches(".*\\W+display\\W+dialog.*") ? BLOCKLIST : ALLOWLIST
56+
```
57+
58+
Note: This will not stop obfuscated osascript that's evaluated at runtime or
59+
any other malicious behavior triggered through osascript. For better security
60+
block osascript all together if you can. Be aware software like the Google
61+
Cloud SDK installer and AI tools like claude code use osascript.
62+
63+
Also if you're using osascript to do this legitimately this will break your
64+
usage.

0 commit comments

Comments
 (0)