apple-mail

Warn

Audited by Socket on Sep 16, 2026

12 alerts found:

Securityx5Anomalyx7
SecurityMEDIUM
scripts/get-email-by-id.sh

The code appears intended to retrieve Apple Mail messages and does not show clear malicious behavior. It has a significant command-injection risk because IDS, ACCOUNT, and MAILBOX are interpolated directly into executable AppleScript without validation or escaping. An attacker who can control these arguments may be able to alter AppleScript execution and potentially perform unauthorized Mail automation or other actions allowed by osascript. Numeric ID validation and AppleScript-safe quoting are required.

Confidence: 98%Severity: 78%
SecurityMEDIUM
scripts/search-emails.sh

The code implements a legitimate Apple Mail search function and contains no clear evidence of intentional malware, data exfiltration, persistence, or destructive behavior. However, it dynamically generates AppleScript from untrusted command-line arguments. ACCOUNT and MAILBOX are directly injectable, LIMIT is not restricted to an integer, and QUERY escaping is incomplete. These flaws can permit unauthorized Apple Mail actions or data access when attacker-controlled arguments are supplied. BCC data is also exposed in output. The script should use strict validation and robust AppleScript escaping, especially for mailbox names and the limit.

Confidence: 97%Severity: 73%
SecurityMEDIUM
scripts/send-email.sh

The script has a significant command-injection-style vulnerability in its AppleScript generation. Untrusted TO, CC, BCC, and FROM values are inserted without escaping and then executed by osascript. Subject and body receive partial escaping, but the overall implementation should not be used with attacker-controlled arguments until all AppleScript string values are safely escaped or passed through a non-code data mechanism. No clear malware behavior is shown, but the injection flaw presents a meaningful security risk.

Confidence: 98%Severity: 78%
AnomalyLOW
scripts/create-draft.sh

The script is intended to create a visible draft email in Apple Mail. It contains an AppleScript injection vulnerability because sender and recipient arguments are inserted without escaping. A caller able to control these arguments may inject AppleScript commands executed through Mail with the user's privileges, potentially causing unauthorized mail actions or other application-mediated effects. No clear malicious payload, credential theft, persistence, exfiltration, or destructive behavior is present in the supplied code itself. Escape all interpolated values, validate email addresses, and avoid constructing executable AppleScript from raw input.

Confidence: 98%Severity: 62%
AnomalyLOW
scripts/get-emails.sh

The script appears intended to export Apple Mail messages and does not show direct malware behavior. However, unescaped account/mailbox values and an unvalidated limit are embedded into dynamically executed AppleScript, creating a meaningful injection risk if arguments can be attacker-controlled. Validate limit as an integer and safely escape or avoid interpolating user input into AppleScript source.

Confidence: 97%Severity: 68%
AnomalyLOW
scripts/archive-email.sh

The script has a command-injection vulnerability in its generated AppleScript because all relevant command-line arguments are interpolated without validation or escaping. MESSAGE_ID should be strictly validated as an expected identifier, and all string values should be safely escaped or passed through a non-interpolated mechanism. No clear malware, credential theft, network exfiltration, or persistence behavior is present; the risk is primarily unauthorized AppleScript execution and mail modification when inputs are attacker-controlled.

Confidence: 98%Severity: 68%
AnomalyLOW
scripts/create-reply-draft.sh

The script appears intended to automate creation of Apple Mail reply drafts and contains no clear malware, credential theft, exfiltration, persistence, or destructive behavior. However, it dynamically executes AppleScript containing unescaped ACCOUNT, MAILBOX, and MESSAGE_ID inputs, and uses fragile body escaping. An attacker able to supply these arguments could potentially inject AppleScript and cause unintended Mail actions. Inputs should be validated and safely escaped or passed using a non-interpolating mechanism.

Confidence: 97%Severity: 68%
SecurityMEDIUM
scripts/delete-email.sh

The script has a legitimate email-deletion purpose but is vulnerable to AppleScript injection because all command-line inputs are interpolated into an unquoted heredoc without escaping or validation. An attacker able to supply arguments could potentially alter mailbox selection or execute additional AppleScript actions permitted to the invoking user. Use quoted heredocs with explicit parameter passing, or robustly escape and validate each value, especially requiring MESSAGE_ID to match the expected identifier format. The fragment does not show clear malware, but the injection flaw creates a meaningful security risk.

Confidence: 98%Severity: 78%
AnomalyLOW
scripts/get-unread-count.sh

The code has a legitimate purpose and no evident malware. It contains a command-injection-style risk because unvalidated command-line arguments are embedded directly into AppleScript source executed by osascript. Exploitation requires a caller able to invoke the script with crafted arguments, but successful exploitation could enable unintended AppleScript actions under the user's privileges.

Confidence: 97%Severity: 62%
AnomalyLOW
scripts/list-mailboxes.sh

The script is intended to enumerate macOS Mail mailboxes, but the specified-account path is vulnerable to AppleScript injection because the command-line argument is inserted into an executable heredoc without escaping. No direct malicious behavior or explicit data theft is present in the fragment, but untrusted arguments could cause unintended AppleScript execution.

Confidence: 98%Severity: 68%
SecurityMEDIUM
scripts/mark-read.sh

The code is a legitimate Mail automation script with an AppleScript injection vulnerability. Treat all arguments as untrusted, validate MESSAGE_ID against the expected format, and safely escape or pass values without direct script interpolation. The fragment does not itself show malware, but exploitation could permit unauthorized AppleScript actions.

Confidence: 98%Severity: 72%
AnomalyLOW
scripts/mark-unread.sh

The code has a legitimate purpose and shows no apparent data theft, persistence, destructive behavior, network activity, or other malicious functionality. However, direct interpolation of command-line arguments into AppleScript permits AppleScript injection and should be fixed by validating MESSAGE_ID and safely escaping or passing account and mailbox values without source-code interpolation.

Confidence: 98%Severity: 58%
Audit Metadata
Analyzed At
Sep 16, 2026, 09:38 PM
Package URL
pkg:socket/skills-sh/rbouschery%2Fmarketplace%2Fapple-mail%2F@1f630269075b6151721a4a6d9ad238580ef6089201a19ae966f2347c75519a4e