Collecting file signals

Collecting file signals with a PowerShell reference script

If your organization already runs CrowdStrike Falcon with Falcon Insight, you can start collecting media file signals for File Analysis without deploying any new endpoint software. This article describes how a reference workflow in Falcon Fusion SOAR uses Real Time Response (RTR) to hash media files with SHA-1 on Windows hosts, deliver the results to Falcon Next-Gen SIEM (NG-SIEM) and remove everything it created on the hosts afterwards. Submitting the hashes for analysis is covered in "Integrating CrowdStrike Falcon with the File Analysis API".

This workflow is provided as an example to illustrate the approach. NetClean does not provide support for implementing, modifying or operating it in your environment. Review, test and adapt it according to your own security and change management practices before deployment.

The setup

Three RTR scripts run on the hosts in a host group you choose. One starts a background process that hashes media files with SHA-1 and uploads the rows to NG-SIEM through an HTTP Event Connector (HEC). One reports whether that process has finished, and one removes everything the process created. A Falcon Fusion SOAR workflow starts and follows the scripts host by host. From NG-SIEM, the hashes can be submitted to the NetClean File Analysis API, where they are analyzed and enriched against NetClean's file risk indicators.

CrowdStrike Falcon (RTR scripts, started by a Fusion workflow)
→ NG-SIEM (through HEC)
→ NetClean File Analysis API
→ match/no match
→ Case in Falcon

The files stay on the host. Only hash values are submitted to NetClean.

What this gives you

This approach surfaces file presence: media files found on a host at the time a run is started. It does not show that a file was opened or viewed, which is the layer Workstation Event Screening in ProActive is built to see. It is a standalone route for organizations that want to put NetClean's risk intelligence to work against data their CrowdStrike deployment can already collect, without introducing new endpoint software into their environment.

What setting this up generally involves

  1. Confirm that your Falcon environment meets the requirements below, and that legal, HR and your data protection officer have approved the inventory of files on users' computers
  2. Create an HEC connection in NG-SIEM and note its ingest URL and API key
  3. Review the three RTR scripts attached to this article, set your HEC details and your collection scope in the Collect script, and upload the scripts as custom scripts shared with workflows
  4. Create a host group with the Windows hosts to cover, and confirm that the Response policy allows RTR for them
  5. Create an API client for CrowdStrike HTTP Request with read access to hosts only
  6. Decide what the scripts should collect. See "Choosing what to analyze: files" for which file types, folders and size limits to start with, and "Configuration options" below for where to set them.
  7. Create the workflow by importing the exported workflow file attached to this article, or by building it in the Fusion editor. The workflow, scripts and Fusion actions are built and owned by you.
  8. Continue with the analysis part of the workflow. See "Integrating CrowdStrike Falcon with the File Analysis API".

Each of these steps has its own configuration options and trade-offs, particularly the collection scope and how long a run may wait for hosts to finish, covered below.

The workflow runs real RTR scripts on every online Windows host in the host group, and the inventory covers files on users' computers. Make sure the required approvals are in place, restrict who can read the collected rows in NG-SIEM, and test with a host group of one host before the first full run.

Details

At a glance

  • Collection method: script-based collection (RTR scripts started by a Falcon Fusion SOAR workflow)
  • Collection mode: on-demand (an analyst starts the workflow)
  • Delivery path: via SIEM (CrowdStrike NG-SIEM, through an HEC connection)
  • Visible signal: file presence
  • OS coverage: Windows
  • Hash algorithms: SHA-1
  • Where credentials live: the HEC API key is set in the Collect script in Falcon and handed to the worker in an environment variable. It is not written to disk on the host. The NetClean access token is used by the analysis part of the workflow.
  • After a run: files created on the hosts are overwritten and deleted

Requirements

  • CrowdStrike Falcon with Falcon Insight (RTR), Falcon Fusion SOAR and NG-SIEM
  • An HEC connection in NG-SIEM (under Data onboarding). The ingest URL and the API key go into the Collect script and nowhere else.
  • Outbound HTTPS (TLS 1.2) from the hosts to your NG-SIEM ingest endpoint
  • The three RTR scripts below, attached to this article
  • The exported workflow file attached to this article, unless you build the workflow yourself in the Fusion editor
  • A host group with Windows hosts where RTR is allowed by the Response policy
  • An API client for CrowdStrike HTTP Request with Hosts: Read only, following the principle of least privilege
  • Permissions in Fusion to run the workflow
ScriptFunctionOutput the workflow reads
NetClean-FileAnalysis-CrowdStrike-Reference-Collect.ps1The Collect script. Starts a background process (worker) that SHA-1 hashes media files and uploads the rows to NG-SIEM over HECstarted or already_running
NetClean-FileAnalysis-CrowdStrike-Reference-Status.ps1The Status script. Reads the worker's log and process without changing anythingstate=done, state=running or state=not_running
NetClean-FileAnalysis-CrowdStrike-Reference-Cleanup.ps1The Cleanup script. Stops the worker, overwrites and deletes the files it created and searches for remaining copies of the HEC keystate=cleaned or state=cleanup_incomplete, plus key_logs

The scripts have no input or output schema. They become Fusion actions when they are uploaded under Response scripts and files with Share script with workflow ticked. The workflow therefore cannot pass parameters, and the Collect script runs with the defaults set in the script.

Each uploaded row becomes one event in NG-SIEM with the fields below. Otherwise the analysis part of the workflow finds no hashes. The workflow limits a run with NG-SIEM's own ingest timestamp, so host clocks do not affect which rows are selected.

FieldContentUsed for
mf_toolA fixed identifier for this collection: Collect-MediafilesSelecting the collection's rows
mf_sha1The file's SHA-1 (the workflow lowercases it)Batching and the File Analysis API lookup
mf_hostHostnameCase comment on a match
mf_userThe profile folder in the path (C:\Users\name), otherwise unknown. It is not the file owner.Case comment on a match
mf_pathFull file pathCase comment on a match
mf_epoch, mf_size, mf_modified_utcUpload time per the host, file size and last modified timeNot used by the workflow

How the rows reach NG-SIEM

  1. Start the worker. The Collect script writes a configuration file and the worker script to C:\Windows\Temp and launches a hidden PowerShell process. The HEC key is handed over in an environment variable, which the worker reads and removes at once.
  2. Hash the files. The worker runs at below-normal priority, skips reparse points and writes host, path, size, modified time and SHA-1 to an inventory CSV file on the host.
  3. Upload the rows, 500 per request, as JSON to your HEC ingest endpoint.
  4. Log the result. Failed requests go to an error log and count as rows_failed. A final line with the number of hashed, skipped, sent and failed rows is written to the worker log.

How collection works

The workflow is started by an analyst with two inputs: max_wait_hours (default 8), covered here, and the NetClean access token, covered in the integration guide. The collection part has five phases in a fixed order, and two of them can stop the run.

  1. Initialize. The run state is created and reset. A since value is set to the run's start time in epoch seconds, so only rows from this run are analyzed.
  2. Fetch target hosts. The workflow lists the Windows hosts in the host group (up to 5,000). If the call fails or the list is empty, the run stops.
  3. Start collection per host. Hosts are handled one at a time. A host counts as online if it was last seen less than 2 hours ago. The Collect script runs on online hosts (timeout 120 seconds, not queued for offline hosts), and a host that answers started or already_running is added to the pending list. Offline hosts are skipped. If no host starts, the run stops.
  4. Poll and clean up. Every 10 minutes, the Status script runs for each pending host (timeout 60 seconds), until the list is empty or max_wait_hours has passed. When a host reports state=done, the workflow retrieves its inventory CSV file to the Falcon cloud, runs the Cleanup script and counts the host as done. If the worker has disappeared (state=not_running), cleanup runs and the host counts as failed. Any other answer, or an offline host, means the host is polled again in the next round.
  5. Clean up unfinished hosts. Hosts still hashing when the wait is over get the Cleanup script, which stops the worker and deletes the files. Cleanup is queued for hosts that are offline and runs when they reconnect.

Configuration options

The Collect script has these parameters. The workflow cannot pass parameters, so set your values as the defaults in the script's parameter block before you upload it.

  • Folders (Roots): a comma-separated list of folders to scan. Empty means all fixed drives.
  • Exclusions (Exclude): a comma-separated list of folders to skip
  • File types (Extensions): the file extensions to hash
  • Size limits (MinSizeKB, MaxSizeMB): files outside the range are skipped. 0 means no limit.

The defaults in the attached script follow the guidance in "Choosing what to analyze: files", which also covers folders, file types, size limits and deduplication in more detail. Adjust them to your environment.

Limitations

  • Windows only. The workflow does not cover macOS or Linux hosts.
  • Results come from runs you start, not a continuous event stream. Each run re-hashes every host.
  • Hosts not seen within 2 hours are not queued and are not covered by that run. Hosts still hashing when max_wait_hours is reached are not checked either.
  • Upload errors are easy to miss. The worker reports done even when calls to HEC failed, so check rows_failed in each host's status line in the execution log.
  • Hosts are started and polled one at a time, so a run takes longer as the host group grows.

Volume & limits

  • The collection scope set in the script is the main lever for run time and volume. See "Choosing what to analyze: files".
  • The script has no cache and no deduplication, so every run hashes and uploads every matching file again. "Choosing what to analyze: files" describes deduplication before analysis.
  • max_wait_hours sets how long the workflow waits for hosts to finish. Raise it for large file volumes or slow hosts, but keep it well below 24 hours, because the analysis queries only search one day back.
  • The worker uploads 500 rows per request.
  • A host counts as online if it was last seen less than 2 hours ago, and the host list is limited to 5,000 hosts.

Security considerations

Review these before deployment. They reduce risk but do not make the workflow tamper-proof.

  • Credentials on the host: the HEC API key is set in the Collect script in Falcon and handed to the worker in an environment variable, which the worker reads and removes at once. It is not written to disk. Use a dedicated HEC connection and rotate the key regularly.
  • The key in logs: because the key is part of the script text, it can end up in PowerShell logs (script block logging, transcripts) and Falcon telemetry. The Cleanup script reports logs that hold the key (key_logs) but does not delete them. Rotate the key if hosts_key_in_logs is above 0.
  • Cleanup: the Cleanup script stops the worker, overwrites the files the scripts created in C:\Windows\Temp with zeros and deletes them. It also removes any other small script, log or text file in that folder that holds a copy of the key. It never touches the media files. On SSDs the drive may still keep old blocks, which is another reason to rotate the key.
  • Personal data: every row includes the full file path and a user name taken from the profile folder. Restrict who can read the rows in NG-SIEM, and make sure the approvals described above are in place.
  • Least privilege: the API client used by the workflow has read access to hosts only, and the HEC connection should be dedicated to this workflow.

Verifying collection

The run summary written at the end of every run contains these counters. On a successful collection:

  • hosts_in_group is greater than 0 and hosts_started is close to it. The difference is offline hosts.
  • hosts_collected equals hosts_started
  • hosts_failed and hosts_still_hashing_at_deadline are 0
  • hosts_cleaned covers every host, and hosts_cleanup_not_confirmed and hosts_key_in_logs are 0

Also check that each host's status line in the execution log shows rows_failed=0. How to read the full run summary, including the stop reason, is covered in "Integrating CrowdStrike Falcon with the File Analysis API".

Troubleshooting

Technical stops are diagnosed with the run summary and usually end in a new run. If the same stop repeats, escalate to your Falcon administrator and attach the Execution ID and the run summary.

Symptom in the summaryLikely causeAction
A step shows as [Missing Activity]The script is no longer shared with workflows. Editing and saving a script can switch sharing off.Tick Share script with workflow and reconnect the step
Host group lookup failed, or the group has no Windows hostsThe API client lacks Hosts: Read, the group ID is wrong, or there are no Windows hosts in the groupCheck the API client and group membership, then run again
No host was online, or the Collect script did not startHosts not seen for over 2 hours, RTR blocked by policy, or the script is not shared with workflowsCheck Last seen, the Response policy and script sharing
hosts_failed greater than 0The worker crashed or was cleaned up, for example after a rebootRun again. Escalate if it recurs.
hosts_still_hashing_at_deadline greater than 0Large file volumes or slow hostsRaise max_wait_hours for the next run, or narrow the scope
hosts_cleanup_not_confirmed greater than 0The host was offline (cleanup is queued) or a file could not be deletedCheck the status line, and run the Cleanup script manually over RTR if needed
hosts_key_in_logs greater than 0The HEC key is in PowerShell logs (script block logging or transcripts)Rotate the HEC key. The workflow does not delete logs.

Further reading

CrowdStrike's own documentation covers the platform features and APIs this workflow relies on:

This article refers to CrowdStrike Falcon as described by the workflow it documents. Other CrowdStrike configurations may work differently.

Downloads (2)

NetClean-FileAnalysis-CrowdStrike-Reference-Collect.ps1

File · 8.24 KB

Download PS1

NetClean-FileAnalysis-CrowdStrike-Reference-Cleanup.ps1

File · 4.7 KB

Download PS1