Try it using Invoke-Atomic

Email Collection: Local Email Collection

Description from ATT&CK

Adversaries may target user email on local systems to collect sensitive information. Files containing email data can be acquired from a user’s local system, such as Outlook storage or cache files.

Outlook stores data locally in offline data files with an extension of .ost. Outlook 2010 and later supports .ost file sizes up to 50GB, while earlier versions of Outlook support up to 20GB.(Citation: Outlook File Sizes) IMAP accounts in Outlook 2013 (and earlier) and POP accounts use Outlook Data Files (.pst) as opposed to .ost, whereas IMAP accounts in Outlook 2016 (and later) use .ost files. Both types of Outlook data files are typically stored in

1
C:\Users\<username>\Documents\Outlook Files
or
1
C:\Users\<username>\AppData\Local\Microsoft\Outlook
.(Citation: Microsoft Outlook Files) https://www.aleksandrhovhannisyan.com/blog/how-to-add-a-copy-to-clipboard-button-to-your-jekyll-blog/

Atomic Tests

Atomic Test #1 - Email Collection with PowerShell Get-Inbox

Search through local Outlook installation, extract mail, compress the contents, and saves everything to a directory for later exfiltration. Successful execution will produce stdout message stating "Please be patient, this may take some time…". Upon completion, final output will be a mail.csv file.

Note: Outlook is required, but no email account necessary to produce artifacts.

Supported Platforms: windows

auto_generated_guid: 3f1b5096-0139-4736-9b78-19bcb02bb1cb

Inputs:

Name Description Type Default Value
output_file Output file path String $env:TEMP\mail.csv
file_path File path for Get-Inbox.ps1 String PathToAtomicsFolder\T1114.001\src

Attack Commands: Run with powershell!

1
2
powershell -executionpolicy bypass -command #{file_path}\Get-Inbox.ps1 -file #{output_file}

Cleanup Commands:

1
2
Remove-Item #{output_file} -Force -ErrorAction Ignore

Dependencies: Run with powershell!

Description: Get-Inbox.ps1 must be located at #{file_path}

Check Prereq Commands:

1
2
if (Test-Path #{file_path}\Get-Inbox.ps1) {exit 0} else {exit 1}

Get Prereq Commands:

1
2
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1114.001/src/Get-Inbox.ps1" -OutFile "#{file_path}\Get-Inbox.ps1"

source