Query Details
// Detecting WafflesExploits Shellcode in Image Files // https://wafflesexploits.github.io/posts/Hide_a_Payload_in_Plain_Sight_Embedding_Shellcode_in_a_Image_file/ let ImageExtension = dynamic([".apng", ".png", ".avif", ".gif", ".jpg", ".jpeg", ".jfif", ".pjpeg", ".pjp", ".png", ".svg", ".webp", ".bmp", ".tif", ".tiff"]); let CPPId = dynamic(["Microsoft Visual C++"]); let WhiteListedFileName = dynamic(["logo.png","vcredist.bmp","watermark.bmp","header.bmp","SplashScreen.bmp"]); DeviceFileEvents | where InitiatingProcessVersionInfoFileDescription has_any(CPPId) | where ActionType == @"FileCreated" | where FileName has_any(ImageExtension) | where not(FileName has_any(WhiteListedFileName))
This query is designed to detect suspicious activity related to the creation of image files that might contain hidden malicious code, specifically shellcode, as described in the WafflesExploits technique. Here's a simple breakdown of what the query does:
Image File Extensions: It defines a list of common image file extensions, such as .png, .jpg, .gif, etc.
C++ Identifiers: It specifies that the initiating process should be related to "Microsoft Visual C++", which might indicate a development or compilation process.
Whitelisted File Names: It lists certain image file names that are considered safe or expected, such as "logo.png" or "vcredist.bmp".
Device File Events: The query looks at events where files are created on a device.
Filter Conditions:
In summary, this query identifies newly created image files that are not on a safe list and are created by processes associated with Microsoft Visual C++, potentially indicating an attempt to hide malicious code within an image file.

Steven Lim
Released: February 16, 2025
Tables
Keywords
Operators