Attacks and Exploits

On a compromised host, the EDR scans every file written to disk, but the tester has a PowerShell prompt and a script on the tester's own web server. How can the tester run the script without writing it to disk?

Show the answer

Correct answerA. Load the script text into memory and run it with Invoke-Expression

AWhy this is right: Invoke-Expression runs a string held in memory, so no script file touches disk.

BWhy not this: Copying to ADMIN$ writes a file to disk, and PsExec adds a service artifact.

CWhy not this: Saving and opening the file writes it to disk, which is what the EDR scans.

DWhy not this: ISE is an editor; saving a copy still creates a file on disk.

PowerShell can fetch script text from a web server into a string and pass it to Invoke-Expression, so the code runs in memory and no script file is created. Saving a copy in ISE still writes a file that the EDR can scan.