Skip to content
WETNav

Collection · Windows · LOLBAS

findstr.exe

Find String

Searches files for text. Used to hunt for passwords in files and Group Policy XML, and it can also copy file content into alternate data streams.

Legitimate use

Used in scripts to filter output and search files.

Worst caseHigh

Switches

/s

Searches the current folder and all subfolders.

Low
/i

Case-insensitive search.

Info
/m

Prints only the names of files that match.

Low
/v

Prints lines that do not match.

Low
/l

Treats the search string literally.

Info
/n

Prints line numbers.

Info
/c

Gives a literal search string.

Info

Command lines to worry about

  • High

    Search for Group Policy Preferences passwords

    Looks for the cpassword attribute in SYSVOL XML. That value can be decrypted with a published key.

    Detection regexfindstr(\.exe)?\s+.*cpassword

    T1552.006

  • Medium

    Recursive search for password strings

    Searches folders for files containing passwords. Check which share or folder was searched.

    Detection regexfindstr(\.exe)?\s+.*\/s\b.*\b(password|passwd|pwd|credential)s?\b

    T1552.001

Where it is recorded

  • Security4688Process creation with the full command line, when command-line auditing is enabled.
  • Sysmon1Process creation with command line, hashes and parent process.
  • Security5145Detailed file share access when the search runs against a share such as SYSVOL.

Community detections

12 SigmaHQ rules for findstr.exe. The explainer checks every pasted command line against all of them.

  • High
    Findstr GPP Passwords

    Look for the encrypted cpassword value within Group Policy Preference files on the Domain Controller. This value can be decrypted with gpp-decrypt.

    T1552.006by frack113

  • High
    LSASS Process Reconnaissance Via Findstr.EXE

    Detects findstring commands that include the keyword lsass, which indicates recon actviity for the LSASS process PID

    T1552.006by Florian Roth (Nextron Systems)

  • High
    Suspicious Spool Service Child Process

    Detects suspicious print spool service (spoolsv.exe) child processes.

    T1203T1068by Justin C. (@endisphotic), @dreadphones (detection), Thomas Patzke (Sigma rule)

  • High
    Sysmon Discovery Via Default Driver Altitude Using Findstr.EXE

    Detects usage of "findstr" with the argument "385201". Which could indicate potential discovery of an installed Sysinternals Sysmon service using the default driver altitude (even if the name is changed).

    T1518.001by frack113

  • High
    Webshell Detection With Command Line Keywords

    Detects certain command line parameters often used during reconnaissance activity via web shells

    T1505.003T1018T1033T1087by Florian Roth (Nextron Systems), Jonhnathan Ribeiro, Anton Kutepov, oscd.community, Chad Hudson, Matt Anderson

  • Medium
    Automated Collection Command Prompt

    Once established within a system or network, an adversary may use automated techniques for collecting internal data.

    T1119T1552.001by frack113

  • Medium
    Findstr Launching .lnk File

    Detects usage of findstr to identify and execute a lnk file as seen within the HHS redirect attack

    T1036T1202T1027.003by Trent Liffick

  • Medium
    Permission Misconfiguration Reconnaissance Via Findstr.EXE

    Detects usage of findstr with the "EVERYONE" or "BUILTIN" keywords. This was seen being used in combination with "icacls" and other utilities to spot misconfigured files or folders permissions.

    T1552.006by Nasreddine Bencherchali (Nextron Systems)

  • Medium
    Private Keys Reconnaissance Via CommandLine Tools

    Adversaries may search for private key certificate files on compromised systems for insecurely stored credential

    T1552.004by frack113, Nasreddine Bencherchali (Nextron Systems)

  • Medium
    Remote File Download Via Findstr.EXE

    Detects execution of "findstr" with specific flags and a remote share path. This specific set of CLI flags would allow "findstr" to download the content of the file located on the remote share as described in the LOLBAS entry.

    T1218T1564.004T1552.001T1105by Furkan CALISKAN, @caliskanfurkan_, @oscd_initiative, Nasreddine Bencherchali (Nextron Systems)

  • Medium
    Security Tools Keyword Lookup Via Findstr.EXE

    Detects execution of "findstr" to search for common names of security tools. Attackers often pipe the results of recon commands such as "tasklist" or "whoami" to "findstr" in order to filter out the results. This detection focuses on the keywords that the attacker might use as a filter.

    T1518.001by Nasreddine Bencherchali (Nextron Systems), frack113

  • Low
    Insensitive Subfolder Search Via Findstr.EXE

    Detects execution of findstr with the "s" and "i" flags for a "subfolder" and "insensitive" search respectively. Attackers sometimes leverage this built-in utility to search the system for interesting files or filter through results of commands.

    T1218T1564.004T1552.001T1105by Furkan CALISKAN, @caliskanfurkan_, @oscd_initiative, Nasreddine Bencherchali (Nextron Systems)

Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.