Skip to content

Have there been any executions of PsExec?

ID: Q1036

Description: PsExec is a command-line tool that allows you to execute commands on remote computers. It is part of the Sysinternals suite of tools, which are a collection of free and open-source utilities for Windows system administration. It works by establishing a remote connection to the target computer and then executing the specified command. The command can be anything that you would normally run on a local computer, such as a batch file, a PowerShell script, or a simple command-line instruction.

Approaches to Answer

Approaches

Note

There are often multiple ways to approach answering a question. This section explains the approaches considered, how they work, and any benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction.

Examine Windows Prefetch for evidence of PsExec usage

🗂️ Explanation

Windows Prefetch files are designed to speed up application start times. To do this, they store information about recently launched applications, including the file name of the executable and the number of times it has been run.

References

📝 Notes

Each approach comes with certain caveats or limitations. These can often be tacit knowledge or assumed that "everyone knows that" (even though they don't). This can lead to incorrect assumptions and analysis. Explicitly stating what is covered and not covered by the approach reduces ambiguity.

Covered

  • Executions of PsExec on Windows systems with Prefetch enabled.

Not Covered

  • Systems where the Prefetch service has been disabled.
  • There is a maximum number of .pf allowed by Windows (the number varies by Windows version). If too many other Prefetch files were created, the PsExec Prefetch file may have been deleted, and thus will not be parsed.
  • Instances when the PsExec executable has been renamed.
  • Non-Windows systems, as the Prefetch service is Windows-only.

💾 Data

The following data source(s) are needed for this approach to the question.

Description
Files used by the Windows Prefetch service.
Type
ForensicArtifact
Value
WindowsPrefetchFiles (view on GitHub)

⚙️ Processors

A processor is what takes the data collected and processes it in some way to produce structured data for an investigator to review. Multiple processor options can be defined, as there are often multiple programs capable of doing similar processing. Plaso is an example of a processor (it processes raw artifacts into a timeline). After the data is processed, additional analysis steps may be needed to answer the question.

The following processors can process the raw data specified above. Explicit instructions on how to run the processor are not included here, but any relevant configuration options are.

More information on Plaso.

Recommended options:

 --parsers prefetch

📊 Analysis

After processing the raw data, further analysis steps are necessary to answer the question. After loading Plaso's output into one of these analysis platforms, use the following steps to refine the data to answer the question.

OpenSearch

  1. Filter the results to just Prefetch files for psexec.exe
  2. OpenSearch query:

    data_type:"windows:prefetch:execution" AND executable:psexec\.exe
    

Examine Windows Event Logs for PsExec executions

🗂️ Explanation

Windows systems can be set to log new process creation events to the Security event log. The logs contain the new process name, process ID, parent process name, process creation time, and many more useful fields.

References

📝 Notes

Each approach comes with certain caveats or limitations. These can often be tacit knowledge or assumed that "everyone knows that" (even though they don't). This can lead to incorrect assumptions and analysis. Explicitly stating what is covered and not covered by the approach reduces ambiguity.

Covered

  • Executions of PsExec on Windows systems with logging enabled.

Not Covered

  • Many factors can impact log retention; if the event log containing the relevant event has been deleted, it won't be found by this approach.
  • Instances when the PsExec executable has been renamed.

💾 Data

The following data source(s) are needed for this approach to the question.

Description
Windows Event Log files
Type
ForensicArtifact
Value
WindowsEventLogs (view on GitHub)

⚙️ Processors

A processor is what takes the data collected and processes it in some way to produce structured data for an investigator to review. Multiple processor options can be defined, as there are often multiple programs capable of doing similar processing. Plaso is an example of a processor (it processes raw artifacts into a timeline). After the data is processed, additional analysis steps may be needed to answer the question.

The following processors can process the raw data specified above. Explicit instructions on how to run the processor are not included here, but any relevant configuration options are.

More information on Plaso.

Recommended options:

 --parsers winevtx

📊 Analysis

After processing the raw data, further analysis steps are necessary to answer the question. After loading Plaso's output into one of these analysis platforms, use the following steps to refine the data to answer the question.

OpenSearch

  1. Filter the results to Process Creation events containing "psexec.exe"
  2. OpenSearch query:

    data_type:"windows:evtx:record" event_identifier:4688 source_name:Microsoft-Windows-Security-Auditing xml_string:"psexec.exe"