SpiderLabs Blog

Post-Exploitation Persistent Email Forwarder in Outlook Desktop

Written by Abi Waddell | Oct 5, 2022 1:19:00 PM

There is an exploitation method that can automatically forward emails CC’d to external addresses via an Outlook Desktop rule, even when this action is prevented on the corporate Exchange server.

This can be a serious data exfiltration risk allowing post-exploitation persistence in a previously breached account. The legitimate email account owner is highly likely to be unaware of the creation of this rule. It also permits legitimate non-breached account owners to bypass any Exchange rules prohibiting emails from being auto forwarded to external addresses.

If a user's email account has been breached, the standard advice is to change their password or implement multifactor authentication. Even if this is done, it will not prevent any emails from being auto forwarded to an external email account via the cc field of any sent emails. All the victim’s outbound emails can be sent to an external address belonging to an attacker in a manner which is unlikely to be discovered by the victim.

A user compromised in this way would be unlikely to scrutinize their sent emails, which would flag the suspicious cc'ing of emails being sent to an unknown external email address. If they do stumble onto this, it may not be for some time, which would still allow lots of emails to be exfiltrated.

This issue cannot be solved by any existing measures, including by configuring the Mail Flow rules settings in Exchange. This vulnerability has been reported to Microsoft. The company responded, stating that there is no fix for this vulnerability at present. Microsoft further stated that the Office product team would flag this for future review, but currently, there is no timeline for when this will occur. Also, this vulnerability has been submitted to the Mitre Att&ck Framework for review.

Currently, this is not a common attack method as it must take place post-exploitation, which means the attacker already must have some control over the system. This is more of a pentest/red team technique.

A potential attack scenario would follow these steps. An attacker convinces a victim to open a file that infects their system with a backdoor. The attacker uses the backdoor to gain access to Outlook Desktop and then triggers the attack in the post. If the attack gets discovered and the system cleaned up from the back door the attacker will still receive confidential emails to his inbox unless the IR team knows to look at the CC rules.

Even if this is accomplished, conducting an attack would be time consuming as each target would have to be hit individually. To counter this an attacker would likely pick their victim via a spearphishing attack to get the most bang for their buck.

Reproduction steps:

1) Open Outlook (Desktop).

2) Add an external email address that you can access for the purpose of this proof of concept into the address book. In this example the non-corporate external address joeblogs123@hackeremail.com is used.

3) Create a new email rule to apply to messages that are sent with the condition that `This is a confidential message’ in the subject field of sent messages. It can be any condition/wording, but this is just as an example.

4) Select the configuration option to `cc the message to people or public group’ and add any external address that has been included in the Outlook contacts list.

Figure 1: Rules and Alerts

5) Choose a name for this rule.

6) To check if this works, create a test email with `this is a confidential message’ in the subject field and address it to anyone inside or outside the organization. Click `send’.

7) Check the sent folder and you will see that the external address specified in step 3) above was added automatically to the cc field.

Figure 2: Attacker email automatically added to the CC field 

8) Check that the external address (the one that was cc’d) has received the test email.

The above steps will work even if the Exchange server has created rules prohibiting the auto-forwarding of inbound emails to an external address.

Conclusion

Trustwave SpiderLabs notes that the attack takes place post-exploitation, which means that the attacker already must have some control over the system. This is more of a pentest/red team technique. Trustwave SpiderLabs hopes this information will be instructive for defenders, forensic analysts and incident responders as it gives them another checkbox to look for during a breach or cleanup.