<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Control-Flow-Guard on Anything About IT</title><link>https://www.verboon.info/tags/control-flow-guard/</link><description>Recent content in Control-Flow-Guard on Anything About IT</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 29 Jul 2017 10:53:56 +0000</lastBuildDate><atom:link href="https://www.verboon.info/tags/control-flow-guard/index.xml" rel="self" type="application/rss+xml"/><item><title>How to check if Control Flow Guard is enabled</title><link>https://www.verboon.info/2017/07/how-to-check-if-control-flow-guard-is-enabled/</link><pubDate>Sat, 29 Jul 2017 10:53:56 +0000</pubDate><guid>https://www.verboon.info/2017/07/how-to-check-if-control-flow-guard-is-enabled/</guid><description>&lt;p&gt;How to check if Control Flow Guard is enabledControl Flow Guard helps mitigate exploits that are based on flow between code locations in memory. Control Flow Guard (CFG) is a mitigation that requires no configuration within the operating system, but instead is built into software when it’s compiled. So how to check if an Application is Control Flow Guard is enabled? For my own testing purposes I created two executables one called ConsoleApplication1.exe that has CFG enabled and ConsoleApplication1_NO_CFG.exe. One way to find out whether a running application has CFG enabled is to use the sysinternals process explorer utility. &lt;a href="images/clip_image002-1.png"&gt;

 &lt;img src="images/clip_image002_thumb-1.png" alt="clip_image002"&gt;


&lt;/a&gt;If you have Visual Studio installed, the you can use dumpbin.exe with the /HEADERS flag, then look for the DLL characteristics section.&lt;a href="images/clip_image004-1.png"&gt;

 &lt;img src="images/clip_image004_thumb-1.png" alt="clip_image004"&gt;


&lt;/a&gt;Another nice utility I found is &lt;a href="http://bytepointer.com/tools/index.htm#pelook"&gt;PELook&lt;/a&gt; from bytepointer.com &lt;a href="images/clip_image006-1.png"&gt;

 &lt;img src="images/clip_image006_thumb-1.png" alt="clip_image006"&gt;


&lt;/a&gt;Now while the above described methods are fine to look at an individual application, what if we wanted to scan an entire system with software installed? Use PowerShell!Luckily, I didn’t have to do all the work from scratch. I found the Get-PESecurity module from Eric Gruber on GitHub &lt;a href="https://github.com/NetSPI/PESecurity/blob/master/Get-PESecurity.psm1"&gt;here&lt;/a&gt;. The Get-PESecurity module checks if a Windows binary has been compiled with ASLR, DEP, SafeSEH, StrongNaming and Authenticode. But it didn’t show the Control Flow Guard information. After I familiarized myself a little bit with the &lt;a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms680547(v=vs.85).aspx#the_load_configuration_structure__image_only_"&gt;PE format specification&lt;/a&gt; on MSDN I learned that the information whether an image supports Control Flow Guard is stored in the DLLCharacteristics constant “GUARD_CF” with a value of 0x4000. So I extended the Get-PESecurity module here and there to add support for CFG. &lt;a href="images/clip_image008-1.png"&gt;

 &lt;img src="images/clip_image008_thumb-1.png" alt="clip_image008"&gt;


&lt;/a&gt;&lt;a href="images/clip_image010-1.png"&gt;

 &lt;img src="images/clip_image010_thumb-1.png" alt="clip_image010"&gt;


&lt;/a&gt;You can find my forked version of the Get-PESecurity PowerShell module which includes support for CFG here: &lt;a href="https://github.com/alexverboon/PESecurity"&gt;https://github.com/alexverboon/PESecurity&lt;/a&gt;If your company has in-house software developers encourage them to compile their applications with Control Flow Guard enabled. &lt;a href="images/clip_image012-1.png"&gt;

 &lt;img src="images/clip_image012_thumb-1.png" alt="clip_image012"&gt;


&lt;/a&gt;Additional resources I found while exploring CFG&lt;a href="https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065(v=vs.85).aspx"&gt;https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065(v=vs.85).aspx&lt;/a&gt;&lt;a href="http://sjc1-te-ftp.trendmicro.com/assets/wp/exploring-control-flow-guard-in-windows10.pdf"&gt;http://sjc1-te-ftp.trendmicro.com/assets/wp/exploring-control-flow-guard-in-windows10.pdf&lt;/a&gt;&lt;a href="https://docs.microsoft.com/en-us/windows/threat-protection/overview-of-threat-mitigations-in-windows-10"&gt;https://docs.microsoft.com/en-us/windows/threat-protection/overview-of-threat-mitigations-in-windows-10&lt;/a&gt;&lt;a href="https://lucasg.github.io/2017/02/05/Control-Flow-Guard"&gt;https://lucasg.github.io/2017/02/05/Control-Flow-Guard&lt;/a&gt;&lt;a href="https://github.com/NetSPI/PESecurity"&gt;https://github.com/NetSPI/PESecurity&lt;/a&gt;&lt;a href="https://blog.trailofbits.com/2016/12/27/lets-talk-about-cfi-microsoft-edition"&gt;https://blog.trailofbits.com/2016/12/27/lets-talk-about-cfi-microsoft-edition&lt;/a&gt;&lt;a href="https://blogs.technet.microsoft.com/askpfeplat/2017/04/24/windows-10-memory-protection-features"&gt;https://blogs.technet.microsoft.com/askpfeplat/2017/04/24/windows-10-memory-protection-features&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>