forfiles.exe
forfiles.exe enumerates files and can invoke commands via /c. It’s a classic LOLBIN that can be used to run arbitrary commands without launching a visible shell.
The helper asks you to “scan and repair” with a one-liner.
Press Win-R
Type:
forfiles /p C:\ /m *.log /c "cmd /c echo @path"Press Enter
Mitigations:
Block or audit forfiles usage via AppLocker/WDAC
Demonstrates forfiles /c invoking a command for each match. Use benign commands in testing.
Press Win-R
Type:
forfiles /p C:\Windows\System32 /m notepad.exe /c "cmd /c ""@path"""Press Enter (opens Notepad from System32)
Mitigations:
Alert on
forfilesspawning shell interpreters (cmd.exe, powershell.exe)
Uses forfiles to invoke Explorer on an SMB UNC path. Helpful for lures that steer users into a network share.
Press Win-R
Type:
forfiles /p C:\Windows\System32 /m notepad.exe /c 'cmd /c explorer \server\share'Press Enter
References:
Opens Explorer to a WebDAV path. Requires the Windows WebClient service.
Ensure 'WebClient' service is running (WebDAV client)
Press Win-R
Type:
forfiles /p C:\Windows\System32 /m notepad.exe /c 'cmd /c explorer \server@SSL\DavWWWRoot\site\folder'Press Enter