SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/detecting-email-forwarding-rules-attack
detecting-email-forwarding-rules-attack
VerifiedDetect malicious inbox/mail-flow forwarding rules that adversaries create to maintain persistent access to email communications for intelligence collection and business email compromise. Use when hunting for suspicious auto-forwarding, hidden mailbox rules, or T1114-style email collection persistence after a compromised account or BEC incident.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 11.0 KB |
| SKILL.md | skill md | 3.6 KB |
| assets/template.md | markdown | 2.6 KB |
| references/api-reference.md | markdown | 1.8 KB |
| references/standards.md | markdown | 1.6 KB |
| references/workflows.md | markdown | 2.9 KB |
| scripts/agent.py | script | 5.9 KB |
| scripts/process.py | script | 3.6 KB |
references/api-reference.md
View on GitHub# API Reference: Detecting Email Forwarding Rules Attack
## Microsoft Graph API - Inbox Rules
```http
GET https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/inbox/messageRules
Authorization: Bearer {token}
# Response
{
"value": [
{
"displayName": "Forward invoices",
"isEnabled": true,
"conditions": {"subjectContains": ["invoice", "payment"]},
"actions": {
"forwardTo": [{"emailAddress": {"address": "attacker@evil.com"}}],
"delete": true,
"markAsRead": true
}
}
]
}
```
## Exchange Online PowerShell
```powershell
# List all inbox rules for a user
Get-InboxRule -Mailbox user@company.com | FL Name, ForwardTo, RedirectTo, DeleteMessage
# Find forwarding rules across all mailboxes
Get-Mailbox -ResultSize Unlimited | ForEach-Object {
Get-InboxRule -Mailbox $_.UserPrincipalName |
Where-Object { $_.ForwardTo -or $_.RedirectTo }
}
# Search unified audit log for rule creation
Search-UnifiedAuditLog -Operations "New-InboxRule","Set-InboxRule" -StartDate (Get-Date).AddDays(-30)
```
## Suspicious Rule Indicators
| Indicator | Severity | Description |
|-----------|----------|-------------|
| External forwarding | HIGH | Forwards to non-org domain |
| Forward + delete | CRITICAL | Forwards then deletes original |
| Financial keywords | HIGH | Targets invoice/payment subjects |
| Forward + mark read | HIGH | Hides forwarded messages |
| Move to RSS/Junk | MEDIUM | Hides messages in unused folders |
## Splunk SPL Detection
```spl
index=o365 Operation IN ("New-InboxRule", "Set-InboxRule")
| spath output=forward path=Parameters{}.Value
| where isnotnull(forward) AND NOT match(forward, "@company\\.com")
```
## CLI Usage
```bash
python agent.py --token "eyJ..." --user-id user@company.com --org-domain company.com
python agent.py --audit-log exchange_audit.log
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 193k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 193k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 193k | Updated | Claude CodeCodex | Verified | Install |