PowerShell

From enterprise
Jump to: navigation, search
PowerShell
Technique
ID T1086
Tactic Execution
Platform Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP, Windows 7, Windows 8, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2012 R2, Windows Vista, Windows 8.1, Windows 10
Permissions Required User, Administrator
Data Sources Windows Registry, File monitoring, Process command-line parameters, Process monitoring
Supports Remote Yes

PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system.1 Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer.

PowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.

Administrator permissions are required to use PowerShell to connect to remote systems.

A number of PowerShell-based offensive testing tools are available, including Empire,2 PowerSploit,3 and PSAttack.4

Examples

  • APT29 has used encoded PowerShell scripts uploaded to CozyCar installations to download and install SeaDuke.5 APT29 also used PowerShell scripts to evade defenses.6
  • APT3 has used PowerShell on victim systems to download and run payloads after exploitation.7
  • APT32 has used PowerShell-based tools and shellcode loaders for execution.8
  • Deep Panda has used PowerShell scripts to download and execute programs in memory, without writing to disk.9
  • FIN10 uses PowerShell for execution as well as PowerShell Empire to establish persistence.102
  • FIN6 has used a Metasploit PowerShell module to download and execute shellcode and to set up a local listener.11
  • FIN7 uses a PowerShell script to launch shellcode that retrieves an additional payload.1213
  • Patchwork used PowerSploit to download and run a reverse shell.14
  • The Poseidon Group's Information Gathering Tool (IGT) includes PowerShell components.15
  • Stealth Falcon malware uses PowerShell commands to perform various functions, including gathering system information via WMI and executing commands from its C2 server.16
  • Threat Group-3390 has used PowerShell for execution.17
  • menuPass uses PowerSploit to inject shellcode into PowerShell.18
  • AutoIt downloads a PowerShell script that decodes to a typical shellcode loader.19
  • Cobalt Strike can execute a payload on a remote host with PowerShell. This technique does write any data to disk.20
  • HALFBAKED can execute PowerShell scripts.12
  • HAMMERTOSS is known to use PowerShell.21
  • POSHSPY uses PowerShell to execute various commands, one to execute its payload.22
  • POWERSOURCE is a PowerShell backdoor.2324
  • SeaDuke uses a module to execute Mimikatz with PowerShell to perform Pass the Ticket.5

Mitigation

It may be possible to remove PowerShell from systems when not needed, but a review should be performed to assess the impact to an environment, since it could be in use for many legitimate purposes and administrative functions. When PowerShell is necessary, restrict PowerShell execution policy to administrators and to only execute signed scripts. Be aware that there are methods of bypassing the PowerShell execution policy, depending on environment configuration.25 Disable/restrict the WinRM Service to help prevent uses of PowerShell for remote execution.

Detection

If proper execution policy is set, adversaries will likely be able to define their own execution policy if they obtain administrator or system access, either through the Registry or at the command line. This change in policy on a system may be a way to detect malicious use of PowerShell. If PowerShell is not used in an environment, then simply looking for PowerShell execution may detect malicious activity.

It is also beneficial to turn on PowerShell logging to gain increased fidelity in what occurs during execution.26 PowerShell 5.0 introduced enhanced logging capabilities, and some of those features have since been added to PowerShell 4.0. Earlier versions of PowerShell do not have many logging features.27 An organization can gather PowerShell execution details in a data analytic platform to supplement it with other data.

References

  1. ^  Microsoft. (n.d.). Windows PowerShell Scripting. Retrieved April 28, 2016.
  2. a b  Schroeder, W., Warner, J., Nelson, M. (n.d.). Github PowerShellEmpire. Retrieved April 28, 2016.
  3. ^  PowerSploit. (n.d.). Retrieved December 4, 2014.
  4. ^  Haight, J. (2016, April 21). PS>Attack. Retrieved June 1, 2016.
  5. a b  Symantec Security Response. (2015, July 13). “Forkmeiamfamous”: Seaduke, latest weapon in the Duke armory. Retrieved July 22, 2015.
  6. ^  Dunwoody, M. and Carr, N.. (2016, September 27). No Easy Breach DerbyCon 2016. Retrieved October 4, 2016.
  7. ^  Moran, N., et al. (2014, November 21). Operation Double Tap. Retrieved January 14, 2016.
  8. ^  Carr, N.. (2017, May 14). Cyber Espionage is Alive and Well: APT32 and the Threat to Global Corporations. Retrieved June 18, 2017.
  9. ^  Alperovitch, D. (2014, July 7). Deep in Thought: Chinese Targeting of National Security Think Tanks. Retrieved November 12, 2014.
  10. ^  FireEye iSIGHT Intelligence. (2017, June 16). FIN10: Anatomy of a Cyber Extortion Operation. Retrieved June 25, 2017.
  11. ^  FireEye Threat Intelligence. (2016, April). Follow the Money: Dissecting the Operations of the Cyber Crime Group FIN6. Retrieved June 1, 2016.
  12. a b  Carr, N., et al. (2017, April 24). FIN7 Evolution and the Phishing LNK. Retrieved April 24, 2017.
  13. ^  Gorelik, M.. (2017, June 9). FIN7 Takes Another Bite at the Restaurant Industry. Retrieved July 13, 2017.
  14. ^  Cymmetria. (2016). Unveiling Patchwork - The Copy-Paste APT. Retrieved August 3, 2016.
  1. ^  Kaspersky Lab's Global Research and Analysis Team. (2016, February 9). Poseidon Group: a Targeted Attack Boutique specializing in global cyber-espionage. Retrieved March 16, 2016.
  2. ^  Marczak, B. and Scott-Railton, J.. (2016, May 29). Keep Calm and (Don’t) Enable Macros: A New Threat Actor Targets UAE Dissidents. Retrieved June 8, 2016.
  3. ^  Counter Threat Unit Research Team. (2017, June 27). BRONZE UNION Cyberespionage Persists Despite Disclosures. Retrieved July 13, 2017.
  4. ^  PwC and BAE Systems. (2017, April). Operation Cloud Hopper: Technical Annex. Retrieved April 13, 2017.
  5. ^  Settle, A., et al. (2016, August 8). MONSOON - Analysis Of An APT Campaign. Retrieved September 22, 2016.
  6. ^  Strategic Cyber LLC. (2017, March 14). Cobalt Strike Manual. Retrieved May 24, 2017.
  7. ^  FireEye Labs. (2015, July). HAMMERTOSS: Stealthy Tactics Define a Russian Cyber Threat Group. Retrieved September 17, 2015.
  8. ^  Dunwoody, M.. (2017, April 3). Dissecting One of APT29’s Fileless WMI and PowerShell Backdoors (POSHSPY). Retrieved April 5, 2017.
  9. ^  Miller, S., et al. (2017, March 7). FIN7 Spear Phishing Campaign Targets Personnel Involved in SEC Filings. Retrieved March 8, 2017.
  10. ^  Brumaghin, E. and Grady, C.. (2017, March 2). Covert Channels and Poor Decisions: The Tale of DNSMessenger. Retrieved March 8, 2017.
  11. ^  Sutherland, S. (2014, September 9). 15 Ways to Bypass the PowerShell Execution Policy. Retrieved July 23, 2015.
  12. ^  Malware Archaeology. (2016, June). WINDOWS POWERSHELL LOGGING CHEAT SHEET - Win 7/Win 2008 or later. Retrieved June 24, 2016.
  13. ^  Dunwoody, M. (2016, February 11). GREATER VISIBILITY THROUGH POWERSHELL LOGGING. Retrieved February 16, 2016.