Invoke-SendMail - Empire Module
This page contains detailed information about how to use the powershell/management/mailraider/send_mail Empire module. For list of all Empire modules, visit the Empire Module Library.
Module Overview
Name: Invoke-SendMail
Module: powershell/management/mailraider/send_mail
Source code [1]: empire/server/modules/powershell/management/mailraider/send_mail.yaml
Source code [2]: empire/server/data/module_source/management/MailRaider.ps1
MITRE ATT&CK:
T1114
Language: PowerShell
Needs admin: No
OPSEC safe: No
Background: Yes
The send_mail module sends emails using a custom or default template to specified target email addresses.
This module runs in a foreground and is OPSEC unsafe as it writes on the disk and therefore could be detected by AV/EDR running on the target system.
Note that the send_mail module does not need administrative privileges to work properly which means that a normal user can run this module.
Required Module Options
This is a list of options that are required by the send_mail module:
Agent
Agent to run module on.
Additional Module Options
This is a list of additional options that are supported by the send_mail module:
Attachment
Full path to the file to use as a payload.
Body
Body of the email.
OutputFunction
PowerShell's output function to use ("Out-String", "ConvertTo-Json", "ConvertTo-Csv", "ConvertTo-Html", "ConvertTo-Xml").
Default value: Out-String
.
Suggested values: Out-String
, ConvertTo-Json
, ConvertTo-Csv
, ConvertTo-Html
, ConvertTo-Xml
.
Subject
Subject of the email.
TargetList
List of email addresses read from a file.
Targets
Array of target email addresses. If Targets or TargetList parameter are not specified, a list of 100 email addresses will be randomly selected from the Global Address List.
Template
Full path to the template html file.
URL
URL to include in the email.
Send_mail Example Usage
Here's an example of how to use the send_mail module in the Empire client console:
[+] New agent Y4LHEV83 checked in
[*] Sending agent (stage 2) to Y4LHEV83 at 192.168.204.135
(empire usestager/windows/ducky) > usemodule powershell/management/mailraider/send_mail
Author @xorrior
Background True
Comments https://github.com/xorrior/EmailRaider
http://www.xorrior.com/phishing-on-the-inside/
Description Sends emails using a custom or default template to specified target
email addresses.
Language powershell
Name powershell/management/mailraider/send_mail
NeedsAdmin False
OpsecSafe False
Techniques http://attack.mitre.org/techniques/T1114
,Record Options--,------------,----------,-------------------------------------,
| Name | Value | Required | Description |
|----------------|------------|----------|-------------------------------------|
| Agent | | True | Agent to run module on. |
|----------------|------------|----------|-------------------------------------|
| Attachment | | False | Full path to the file to use as a |
| | | | payload. |
|----------------|------------|----------|-------------------------------------|
| Body | | False | Body of the email. |
|----------------|------------|----------|-------------------------------------|
| OutputFunction | Out-String | False | PowerShell's output function to use |
| | | | ("Out-String", "ConvertTo-Json", |
| | | | "ConvertTo-Csv", "ConvertTo-Html", |
| | | | "ConvertTo-Xml"). |
|----------------|------------|----------|-------------------------------------|
| Subject | | False | Subject of the email. |
|----------------|------------|----------|-------------------------------------|
| TargetList | | False | List of email addresses read from a |
| | | | file. |
|----------------|------------|----------|-------------------------------------|
| Targets | | False | Array of target email addresses. If |
| | | | Targets or TargetList parameter are |
| | | | not specified, a list of 100 email |
| | | | addresses will be randomly selected |
| | | | from the Global Address List. |
|----------------|------------|----------|-------------------------------------|
| Template | | False | Full path to the template html |
| | | | file. |
|----------------|------------|----------|-------------------------------------|
| URL | | False | URL to include in the email. |
'----------------'------------'----------'-------------------------------------'
(Empire: usemodule/powershell/management/mailraider/send_mail) > set Agent Y4LHEV83
[*] Set Agent to Y4LHEV83
(Empire: usemodule/powershell/management/mailraider/send_mail) > execute
[*] Tasked Y4LHEV83 to run Task 1
...
Now wait for the results to come.
Author
References
- https://github.com/BC-SECURITY/Empire/tree/master/empire/server/modules/powershell/management/mailraider/send_mail.yaml
- https://github.com/BC-SECURITY/Empire/tree/master/empire/server/data/module_source/management/MailRaider.ps1
- https://github.com/xorrior/EmailRaider
- http://www.xorrior.com/phishing-on-the-inside/
- http://attack.mitre.org/techniques/T1114
- http://bigorg.com/projections.xls
- https://social.technet.microsoft.com/forums/windowsserver/en-US/6b25cbd2-2bff-4820-ab53-796e306066eb/defining-custom-outlook-rules-using-powershell
- https://github.com/PowerShellEmpire/PowerTools/blob/master/PowerView/powerview.ps1#L5672
See Also
Check also the following modules related to this module:
- powershell/management/mailraider/get_subfolders
- powershell/management/mailraider/mail_search
- powershell/management/mailraider/view_email
- powershell/management/mailraider/search_gal
- powershell/management/mailraider/get_emailitems
- powershell/management/mailraider/disable_security
- python/persistence/osx/mail
- python/collection/osx/search_email
Version
This page has been created based on Empire version 4.1.3 (BC Security Fork).
Visit Empire Module Library for more modules.