Back to skill

Security audit

osascript-email

Security checks for vulnerabilities and agentic risk

Overview

This macOS Mail.app email skill is mostly purpose-aligned, but its ready-to-use helpers build executable AppleScript from insufficiently validated fields, creating a real review concern before installation.

Install only if you understand that this can silently send mail from a configured macOS Mail.app account. Treat recipient, sender, subject, body, and attachment path values as trusted-only unless the helper is rewritten to pass values as data rather than AppleScript source, validate addresses and paths, and require explicit confirmation before sending or attaching files.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/send_email.py:22
Finding

AppleScript Injection Through Unsafely Interpolated Email Fields

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/attachments.md:22
Finding

AppleScript Injection in Documented Attachment Helper

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/send_email.py (reported line 45)May include surrounding context.

python
end tell
return "sent"'''

    result = subprocess.run(
        ["osascript", "-e", script],
        capture_output=True,
        text=True

Excessive Permissions

Low
Category
Privilege Escalation
Confidence
80% confidence
Finding

Skill requests more permissions than appear necessary for its stated functionality. Review if elevated access is justified.

Content

Scanner excerpt · SKILL.md (reported line 82)May include surrounding context.

md
| Email lands in Drafts | `send m` not reached (script errored before) | Check escape characters |
| `execution error: Mail got an error: Invalid recipient` | Address typo | Verify recipient address |
| Email sends but empty body | Newline escape issue in content string | Use Python helper instead |
| `returncode != 0` with no stderr | osascript permission denied | Grant Automation permission: **macOS Ventura+**: System Settings → Privacy & Security → Automation; **older macOS**: System Preferences → Security & Privacy → Automation |

---