Overview
The SearchIndex command queries the Windows Search Index to locate files matching specified patterns. The Windows Search Index maintains a database of file metadata and content for faster searching. This command is useful for quickly finding files containing sensitive keywords like passwords, credentials, keys, and other security-relevant terms without performing full file system traversal.Syntax
Arguments
- search_path (optional) - Directory path to search within. Defaults to searching all indexed locations
- pattern1,pattern2,… (optional) - Comma-separated list of search patterns/keywords. Default is “password”
Examples
Output
The command returns:- File path
- File name
- File size
- Last modified timestamp
- File type/extension
- Matched search term
- File title (if available)
- File author (if available)
Use Cases
Red Team
- Quickly locate files containing passwords
- Find credential files without full filesystem scan
- Discover API keys and tokens in documents
- Locate configuration files with sensitive data
- Find private keys and certificates
- Identify database connection strings
- Discover sensitive emails and documents
- Locate scripts with hardcoded credentials
- Find backup files with credentials
- Identify files with security-relevant keywords
Blue Team
- Audit for insecure credential storage
- Identify sensitive data at risk
- Detect policy violations (credentials in files)
- Support incident response investigations
- Locate potentially compromised credentials
- Audit data loss prevention compliance
- Identify files requiring encryption
- Discover Shadow IT credentials
- Validate secure credential storage practices
- Support forensic analysis
- Identify insider threat indicators
Example Output
Performance Considerations
WARNING: This command can be time-intensive depending on the scope of the search. Performance factors:- Size of the Windows Search Index
- Number of indexed locations
- Breadth of search path specified
- Number of search patterns
- Index update status
- System performance
Remote Execution
This command does not support remote execution. Windows Search Index queries must be performed on the local system.Detection Considerations
Indicators
- COM interface queries to Windows Search Index
- Access to Windows.edb (Search Index database)
- SQL queries against Search Index
- Access to HKLM\SOFTWARE\Microsoft\Windows Search
- Unusual processes querying Search Index
- Large-scale index enumeration
Defensive Recommendations
- Monitor for Windows Search Index queries by suspicious processes
- Alert on mass Search Index enumeration
- Track processes accessing Windows.edb
- Implement least privilege for Search Index access
- Use AppLocker or similar to control execution of enumeration tools
- Monitor for sensitive keyword searches in audit logs
- Correlate Search Index queries with other reconnaissance
- Consider disabling indexing for sensitive directories
- Monitor COM interface usage for Search Index access
- Track unusual search patterns or query volumes
Related Commands
- InterestingFiles - “Interesting” files matching various patterns (filesystem scan)
- FileInfo - Information about specific files
- dir - Lists files/folders in specified directories
- RecycleBin - Items in the Recycle Bin
- LOLBAS - Locates Living Off The Land Binaries and Scripts