Defense-In-Depth write-up

.BGI files can be sent on mail as attachment and can execute code when opened.Requires that BGinfo.exe has been run on the remote machine once. It will also bypass Outlook attachment protection (Fixed with Defense-in-depth patch from September 2017). PowerShell functions to generate BGI and VBSWebMeter here:



I was acknowledged on the MSRC acknowledgments page and I wanted to do a quick little write-up on my contribution to the Defense-in-depth patch.



Earlier this year I discovered that you can use BGInfo to execute code to bypass application whitelisting with the use of .BGI files. After this blogpost I also discovered that .BGI files are in fact not blocked by Microsoft Outlook as an attachment (I guess you see where this is going). It turned out if BGinfo had been executed one time on a computer it would associate .BGI files with BGinfo (nice). So I tried to send myself a .BGI file and open the attachment. “boom”, it executed beautifully.


At first I was really excited since Microsoft offered bounty for similar types of attacks.


The problem with this was that .BGI files was not a part of the predefined list that would trigger a bounty (bummer). Money is not something that drives me, but it would be a nice bonus to have.

The list of extensions that would have qualified for a bounty: ade;adp;app;asp;bas;bat;cer;chm;cmd;cnt;com;cpl;crt;csh;der;diagcab;exe;


I also created two PowerShell functions to create this BGI file and the needed VBS script. More on this here:


This is how a typical mail would look like.


A video where I used an earlier version of my script to demonstrate the PoC for Microsoft. (no music – sorry)



This issue is fixed with the Defense-in-depth patches for September 2017. I have verified on Office 2016.
Office 2016:
Office 2013:
Office 2010:
Office 2007:


If for some reason you are not able to patch and need to fix this at once I recommend that you implement blocking of .BGI files. This can be done by adding block rule in Group Policy like this:


Hope you liked my write-up, and as always feedback is mostly welcome.



Disclosure timeline:
05/26/2017: Report submitted to
06/02/2017: Response from Microsoft that it was sent to Product team.
06/16/2017: Response from Microsoft that it was not bounty worthy due to the list of predefined files.
08/01/2017: Confirmation that it will be fixed in the Defense-in-depth patch of September 2017
09/12/2017: Patch released

One thought on “Defense-In-Depth write-up

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.