SlideShare une entreprise Scribd logo
1  sur  31
Enterprise PowerShell for Remote 
Security Assessments 
A Practical Approach 
Presented by James Tarala 
Principal Consultant © 2014 Enclave Security
2 
Problem Statement 
• During a security assessment an administrator needs to be 
able to perform tasks against multiple remote machines 
• For example: 
– Generate a user account list from multiple remote machines 
– Reset the password for the local administrator account across all the 
machines in a domain 
– Local a known malicious process on a list of workstations 
– Kill a known malicious process on a list of workstations 
– Query / parse the event log from multiple workstations 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
3 
Remote Management Architecture 
Enterprise Systems 
Windows Servers 
Unix / Linux Servers 
Admin Workstation 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
4 
Solution #1: SSH & PowerShell 
• Traditionally, when sysadmins need to perform remote 
command line management, they use SSH 
• One solution is to install an SSH server that serves a 
powershell.exe shell when clients connect 
• Supports Windows and Unix management workstations 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
5 
Advantages of PowerShell SSH Server 
• There are a number of advantages to this approach: 
– Provides an encrypted channel between systems 
– Utilizes standard protocols that are well tested 
– Creates an interactive session with a remote system 
– Can be scripted to allow for automation 
– Firewall rules are simple to create via Windows Firewall 
– Allows for two-factor authentication through the use of key files 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
6 
FreeSSHd Configuration (Example) 
• One option is to use the free FreeSSHd software 
• Replace default cmd.exe shell with powershell.exe shell 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
7 
PowerShell Server (Example) 
• Another option is to use the PowerShellServer commercial 
software to create a PowerShell Terminal Server 
• Allows standard SSH clients to connect to server, and issue 
PowerShell commands remotely 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
8 
PowerShell SSH Client via SSH.NET Library 
• Project to create a PowerShell version of an SSH client 
• Free download from Codeplex (https://sshnet.codeplex.com/) 
• Supports a number of standard SSH functions, including: 
– Implementation of standard remote shell 
– SFTP / SCP functionality 
– Tracks progress of uploads / downloads for progress bars 
– Supports key files for authentication 
– Supports standard encryption algorithms / key lengths 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
9 
PowerShell SSH Client via NetCmdlets Tools 
• Commercial third party PowerShell client modules 
• Allows PowerShell clients to run standard network client 
protocols from within a PowerShell session 
• Includes SSH, DNS, Email, LDAP, WebDAV, and more 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
10 
Disadvantages of PowerShell SSH Server 
• Unfortunately, there are disadvantages to these approaches: 
– Third party software has to be installed / configured 
– Third party software must be maintained / kept up to date 
– Third party client software will be necessary 
– Additional licensing costs may be incurred (per system) 
– May not function on all versions of Windows 
– Only supports key files for two-factor authentication 
– Authentication / access must be managed per system 
– Only allows for interactive logon sessions & results of commands may 
be difficult to include in local scripts 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
11 
Solution #2: WS-Management 
• Distributed Management Task Force (DMTF) standard for 
remotely managing systems via web 
• Microsoft first implemented it via Windows Remote 
Management (WinRM) for XP/2003 & Vista/2008 
• Most recent release WinRM 2.0 in PowerShell 2.0 & later 
• Also supports a separate set of protocols using the Common 
Information Model (CIM) – an upgrade to WMI 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
12 
CMDLET Specific vs. Native Remoting 
CMDLET Specific Remoting 
• DCOM or RPC or WinRM 
• Each CMDLET functions differently 
• Different server setup per protocol 
• Different syntax per CMDLET 
• No support for interactive shells 
• No support for disconnecting from 
running commands 
• Parses & processes commands locally 
Native PowerShell Remoting 
• WS-Management v2.0 
• Each CMDLET functions the same 
• Identical server setup for all systems 
• Same syntax for all CMDLETs 
• Support for interactive shells 
• Support for disconnecting and 
reconnecting to running commands 
• Parses & processes commands remotely 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
13 
WS-Man - OS Requirements / Configuration 
• Requires at least PowerShell 2.0 
• Available by default in Windows 7 / 2008 R2 and later 
• Installation kits available for Windows XP / Vista / 2003 / 2008 
• To automatically install, run: 
Enable-PSRemoting 
• “-SkipNetworkProfileCheck” switch might be necessary if 
current firewall profile is “Public” 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
14 
Enable-PSRemoting 
• Built in script for enabling PSRemoting on a computer 
• Automates the steps that could be set manually or via a 
Group Policy Object 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
15 
WS-Man - Service Requirements / Configuration 
• WS-Management service must be “Started”, ideally 
configured to startup type “Automatic” 
• Enable-PSRemoting script automatically enables this 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
16 
WS-Man - Firewall Requirements / Configuration 
• Firewall rules added by default via PS command 
• New rule for “Windows Remote Management (HTTP-in)” 
• Compatibility mode not necessary 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
17 
WS-Man - HTTP vs HTTPs 
• WS-Man communicates via serialized XML over HTTP 
• By default operates using HTTP on tcp/5985 
• Can also use encrypted HTTPs on tcp/5986 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
18 
WS-Man -Mass Configuration 
• Enable-PSRemoting script can be executed on all machines 
• Group Policies can be set to: 
1. Enable WinRM (Policies > Administrative Templates > Windows Components 
> Windows Remote Management (WinRM) > WinRM Service) 
2. Enable Firewall for tcp/5985 & tcp/5986 (Policies > Administrative Templates > 
Network > Network Connections > Windows Firewall > Domain Profile) 
3. Enable Automatic Service Startup (Policies > Windows Settings > Security 
Settings > System Services) 
4. Legacy clients need PowerShell 2.0 or later & .NET Framework (XP & 2003) 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
19 
PSSession - Like Native SSH for Windows 
• Creates an interactive session with a remote machine using the WS-Management 
protocol 
• To start a session: Enter-PSSession –Computername Name 
• To end a session: Exit-PSSession 
• Supports mutual authentication (via domain, SSL, or TrustedHosts) 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
20 
PSSession - PowerShell v3.0 
• New feature in PowerShell v3.0 & later 
• Allows users to disconnect / reconnect to running PSSession 
• Analogy: Similar to Metasploit sessions 
• Administrators can commandeer other users’ sessions 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
21 
Connect-PSSession / Disconnect-PSSession 
• These commands are available in PowerShell v3.0 & later 
– Disconnect-PSSession allows a user to disconnect from an 
existing PSSession 
– Connect-PSSession allows a user to reconnect to a PSSession in 
a disconnected state 
– Get-PSSession allows a user to list all current sessions 
– Remove-PSSession allows a user to delete a current session 
• Allows a user to kick off a process that may take some time 
and then return to it later as needed 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
22 
Invoke-Command 
• Creates a temporary PSSession with a remote machine 
• Session lasts for only as long as necessary for a command to 
execute 
• Can be used to execute a CMDLET, such as: 
Invoke-Command -ComputerName ENV-DC-01 -ScriptBlock {Get-Process} 
• Can be used to execute a PowerShell script, such as: 
Invoke-Command -ComputerName ENV-DC-01 -FilePath c:process.ps1 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
23 
Case Study – WS-Management in Action 
• WS-Management can extend PowerShell to give 
administrators the ability to scale security commands 
• These security capabilities can be used by: 
– Incident handlers 
– Penetration testers 
– Forensic analysts 
– IT Auditors 
• The following slides illustrate some of the capabilities 
PowerShell offers via WS-Management 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
24 
Generate Enterprise-Wide User Account List 
• The following command would allow you to remotely connect 
to multiple computers to retrieve a list of user accounts: 
Invoke-Command -ComputerName SVR01,SVR02 ` 
-ScriptBlock ` 
{Get-WMIObject Win32_Useraccount | ` 
Select Name,SID} 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
25 
Scan for Known Malicious Services 
• The following command would allow you to remotely connect 
to multiple computers to retrieve a list of servers running the 
apache service: 
Invoke-Command -ComputerName SVR01,SVR02 ` 
-ScriptBlock {Get-Service | ` 
Where {$_.Name –like “*apache*” | ` 
Select Name,Status,PSComputerName} 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
26 
Scan for Known Malicious Processes 
• The following command would allow you to remotely connect 
to multiple computers to retrieve a list of where the evil.exe 
process is currently running: 
Invoke-Command -ComputerName SVR01,SVR02 ` 
-ScriptBlock {Get-Process | ` 
Where {$_.Name –like “*evil.exe*” | ` 
Select Name,PSComputerName} 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
27 
Kill Known Malicious Processes 
• The following command would allow you to remotely connect 
to multiple computers to retrieve a list of where the evil.exe 
process is currently running, and then kill that process: 
Invoke-Command -ComputerName SVR01,SVR02 ` 
-ScriptBlock {Get-Process | ` 
Where {$_.Name –like “*evil.exe*” | ` 
Select Name,PSComputerName} | Stop-Process} 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
28 
Parse Event Logs for Login Events 
• The following command would allow you to remotely connect 
to multiple computers to retrieve a list of where & when the 
James user account has successfully logged in recently: 
Invoke-Command -ComputerName SVR01,SVR02 ` 
-ScriptBlock {Get-WinEvent –FilterHashtable ` 
@{logname='security'; id=4624} | ` 
Where {$_.Message -like "*james*"} | ` 
select timecreated,PSComputerName} 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
29 
Next Steps 
• If you find yourself regularly assessing Microsoft Windows 
based systems – learn PowerShell 
1. Learn the foundations of PowerShell scripting 
2. Learn the basic built-in cmdlets Windows provides 
3. Learn about additional modules that can be added to a 
standard Windows environment 
4. Write scripts to automate common assessment tasks 
5. Experiment with output & reporting in PowerShell 
6. Share your scripts with the community 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
30 
Further Questions 
• James Tarala 
– Principal Consultant & Founder, Enclave Security 
– E-mail: james.tarala@enclavesecurity.com 
– Twitter: @isaudit 
– Website: http://www.auditscripts.com/ 
• Resources for further study: 
– AuditScripts.com Audit Resources 
– SANS SEC 505: Securing Windows & Resisting Malware 
– Windows PowerShell in Action by Bruce Payette 
– PowerShell and WMI by Richard Siddaway 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
31 
References 
• http://windowsitpro.com/powershell/powershell-basics-remote- 
management 
• http://www.netcmdlets.com/overview/unix/ 
• http://www.powershelladmin.com/wiki/SSH_from_PowerShell 
_using_the_SSH.NET_library 
• http://blogs.technet.com/b/heyscriptingguy/archive/2012/11/15 
/digging-into-powershell-remote-authentication.aspx 
Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014

Contenu connexe

Tendances

VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...VMworld
 
Packaging tool options
Packaging tool optionsPackaging tool options
Packaging tool optionsLen Bass
 
Attack All the Layers: What's Working during Pentests (OWASP NYC)
Attack All the Layers: What's Working during Pentests (OWASP NYC)Attack All the Layers: What's Working during Pentests (OWASP NYC)
Attack All the Layers: What's Working during Pentests (OWASP NYC)Scott Sutherland
 
Going outside the application
Going outside the applicationGoing outside the application
Going outside the applicationMatthew Saltzman
 
Practical Steps to Scale Legal Support for Open Source
Practical Steps to Scale Legal Support for Open SourcePractical Steps to Scale Legal Support for Open Source
Practical Steps to Scale Legal Support for Open SourceBlack Duck by Synopsys
 
All You Need is One - A ClickOnce Love Story - Secure360 2015
All You Need is One -  A ClickOnce Love Story - Secure360 2015All You Need is One -  A ClickOnce Love Story - Secure360 2015
All You Need is One - A ClickOnce Love Story - Secure360 2015NetSPI
 
CNIT 152: 10 Enterprise Services
CNIT 152: 10 Enterprise ServicesCNIT 152: 10 Enterprise Services
CNIT 152: 10 Enterprise ServicesSam Bowne
 
Securing deployment pipeline
Securing deployment pipelineSecuring deployment pipeline
Securing deployment pipelineLen Bass
 
Introduction to dev ops
Introduction to dev opsIntroduction to dev ops
Introduction to dev opsLen Bass
 
Perforce on Tour 2015 - Optimising the Developer Pipeline at U-Blox
Perforce on Tour 2015 - Optimising the Developer Pipeline at U-BloxPerforce on Tour 2015 - Optimising the Developer Pipeline at U-Blox
Perforce on Tour 2015 - Optimising the Developer Pipeline at U-BloxPerforce
 
Secure360 - Attack All the Layers! Again!
Secure360 - Attack All the Layers! Again!Secure360 - Attack All the Layers! Again!
Secure360 - Attack All the Layers! Again!Scott Sutherland
 
Ch 10: Attacking Back-End Components
Ch 10: Attacking Back-End ComponentsCh 10: Attacking Back-End Components
Ch 10: Attacking Back-End ComponentsSam Bowne
 
Complete Guide to the Citrix Logon Process
Complete Guide to the Citrix Logon ProcessComplete Guide to the Citrix Logon Process
Complete Guide to the Citrix Logon ProcessJohn Grant
 
Contain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidenceContain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidenceBlack Duck by Synopsys
 
CSF18 - Moving from Reactive to Proactive Security - Sami Laiho
CSF18 - Moving from Reactive to Proactive Security - Sami LaihoCSF18 - Moving from Reactive to Proactive Security - Sami Laiho
CSF18 - Moving from Reactive to Proactive Security - Sami LaihoNCCOMMS
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldDevOps.com
 
CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)Sam Bowne
 
Forging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryForging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryNikhil Mittal
 

Tendances (20)

VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
 
Packaging tool options
Packaging tool optionsPackaging tool options
Packaging tool options
 
Attack All the Layers: What's Working during Pentests (OWASP NYC)
Attack All the Layers: What's Working during Pentests (OWASP NYC)Attack All the Layers: What's Working during Pentests (OWASP NYC)
Attack All the Layers: What's Working during Pentests (OWASP NYC)
 
Flight East 2018 Presentation–Black Duck at Docusign
Flight East 2018 Presentation–Black Duck at DocusignFlight East 2018 Presentation–Black Duck at Docusign
Flight East 2018 Presentation–Black Duck at Docusign
 
Going outside the application
Going outside the applicationGoing outside the application
Going outside the application
 
Practical Steps to Scale Legal Support for Open Source
Practical Steps to Scale Legal Support for Open SourcePractical Steps to Scale Legal Support for Open Source
Practical Steps to Scale Legal Support for Open Source
 
All You Need is One - A ClickOnce Love Story - Secure360 2015
All You Need is One -  A ClickOnce Love Story - Secure360 2015All You Need is One -  A ClickOnce Love Story - Secure360 2015
All You Need is One - A ClickOnce Love Story - Secure360 2015
 
6421 b Module-08
6421 b Module-086421 b Module-08
6421 b Module-08
 
CNIT 152: 10 Enterprise Services
CNIT 152: 10 Enterprise ServicesCNIT 152: 10 Enterprise Services
CNIT 152: 10 Enterprise Services
 
Securing deployment pipeline
Securing deployment pipelineSecuring deployment pipeline
Securing deployment pipeline
 
Introduction to dev ops
Introduction to dev opsIntroduction to dev ops
Introduction to dev ops
 
Perforce on Tour 2015 - Optimising the Developer Pipeline at U-Blox
Perforce on Tour 2015 - Optimising the Developer Pipeline at U-BloxPerforce on Tour 2015 - Optimising the Developer Pipeline at U-Blox
Perforce on Tour 2015 - Optimising the Developer Pipeline at U-Blox
 
Secure360 - Attack All the Layers! Again!
Secure360 - Attack All the Layers! Again!Secure360 - Attack All the Layers! Again!
Secure360 - Attack All the Layers! Again!
 
Ch 10: Attacking Back-End Components
Ch 10: Attacking Back-End ComponentsCh 10: Attacking Back-End Components
Ch 10: Attacking Back-End Components
 
Complete Guide to the Citrix Logon Process
Complete Guide to the Citrix Logon ProcessComplete Guide to the Citrix Logon Process
Complete Guide to the Citrix Logon Process
 
Contain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidenceContain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidence
 
CSF18 - Moving from Reactive to Proactive Security - Sami Laiho
CSF18 - Moving from Reactive to Proactive Security - Sami LaihoCSF18 - Moving from Reactive to Proactive Security - Sami Laiho
CSF18 - Moving from Reactive to Proactive Security - Sami Laiho
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)
 
Forging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryForging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active Directory
 

Similaire à Enterprise PowerShell for Remote Security Assessments

Automating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellAutomating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellEnclaveSecurity
 
Windows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementWindows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementSharkrit JOBBO
 
VMworld 2016: What's New with Horizon 7
VMworld 2016: What's New with Horizon 7VMworld 2016: What's New with Horizon 7
VMworld 2016: What's New with Horizon 7VMworld
 
What's new in IBM MQ Messaging
What's new in IBM MQ MessagingWhat's new in IBM MQ Messaging
What's new in IBM MQ MessagingMarkTaylorIBM
 
Expanding your options with the MQ Appliance
Expanding your options with the MQ ApplianceExpanding your options with the MQ Appliance
Expanding your options with the MQ ApplianceAnthony Beardsmore
 
Simplifying Ceph Management with Virtual Storage Manager (VSM)
Simplifying Ceph Management with Virtual Storage Manager (VSM)Simplifying Ceph Management with Virtual Storage Manager (VSM)
Simplifying Ceph Management with Virtual Storage Manager (VSM)Ceph Community
 
Command Central Overview
Command Central OverviewCommand Central Overview
Command Central OverviewSoftware AG
 
0505 Windows Server 2008 一日精華營 PartI
0505 Windows Server 2008 一日精華營 PartI0505 Windows Server 2008 一日精華營 PartI
0505 Windows Server 2008 一日精華營 PartITimothy Chen
 
Enterprise Node - Securing Your Environment
Enterprise Node - Securing Your EnvironmentEnterprise Node - Securing Your Environment
Enterprise Node - Securing Your EnvironmentKurtis Kemple
 
Microsoft System center Configuration manager 2012 sp1
Microsoft System center Configuration manager 2012 sp1Microsoft System center Configuration manager 2012 sp1
Microsoft System center Configuration manager 2012 sp1solarisyougood
 
Service management Dec 11
Service management Dec 11Service management Dec 11
Service management Dec 11Richard Conway
 
Service Management Dec 11
Service Management Dec 11Service Management Dec 11
Service Management Dec 11clarendonint
 
Securing with Sophos - Sophos Day Belux 2014
Securing with Sophos - Sophos Day Belux 2014Securing with Sophos - Sophos Day Belux 2014
Securing with Sophos - Sophos Day Belux 2014Sophos Benelux
 
DIPTI_RANJAN_BARIK(Wintel).doc
DIPTI_RANJAN_BARIK(Wintel).docDIPTI_RANJAN_BARIK(Wintel).doc
DIPTI_RANJAN_BARIK(Wintel).docDipti Ranjan Barik
 
Tech Ed 2008 Israel Server Management 360
Tech Ed 2008 Israel   Server Management 360Tech Ed 2008 Israel   Server Management 360
Tech Ed 2008 Israel Server Management 360Amit Gatenyo
 
Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016
Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016
Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016Leif Davidsen
 

Similaire à Enterprise PowerShell for Remote Security Assessments (20)

Automating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellAutomating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShell
 
IBM Notes in the Cloud
IBM Notes in the CloudIBM Notes in the Cloud
IBM Notes in the Cloud
 
Automation Suite PPT (2).pptx
Automation Suite PPT (2).pptxAutomation Suite PPT (2).pptx
Automation Suite PPT (2).pptx
 
Windows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementWindows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server Management
 
VMworld 2016: What's New with Horizon 7
VMworld 2016: What's New with Horizon 7VMworld 2016: What's New with Horizon 7
VMworld 2016: What's New with Horizon 7
 
What's new in IBM MQ Messaging
What's new in IBM MQ MessagingWhat's new in IBM MQ Messaging
What's new in IBM MQ Messaging
 
PowerShell Remoting
PowerShell RemotingPowerShell Remoting
PowerShell Remoting
 
Expanding your options with the MQ Appliance
Expanding your options with the MQ ApplianceExpanding your options with the MQ Appliance
Expanding your options with the MQ Appliance
 
Simplifying Ceph Management with Virtual Storage Manager (VSM)
Simplifying Ceph Management with Virtual Storage Manager (VSM)Simplifying Ceph Management with Virtual Storage Manager (VSM)
Simplifying Ceph Management with Virtual Storage Manager (VSM)
 
Windows azure overview for SharePoint Pros
Windows azure overview for SharePoint Pros Windows azure overview for SharePoint Pros
Windows azure overview for SharePoint Pros
 
Command Central Overview
Command Central OverviewCommand Central Overview
Command Central Overview
 
0505 Windows Server 2008 一日精華營 PartI
0505 Windows Server 2008 一日精華營 PartI0505 Windows Server 2008 一日精華營 PartI
0505 Windows Server 2008 一日精華營 PartI
 
Enterprise Node - Securing Your Environment
Enterprise Node - Securing Your EnvironmentEnterprise Node - Securing Your Environment
Enterprise Node - Securing Your Environment
 
Microsoft System center Configuration manager 2012 sp1
Microsoft System center Configuration manager 2012 sp1Microsoft System center Configuration manager 2012 sp1
Microsoft System center Configuration manager 2012 sp1
 
Service management Dec 11
Service management Dec 11Service management Dec 11
Service management Dec 11
 
Service Management Dec 11
Service Management Dec 11Service Management Dec 11
Service Management Dec 11
 
Securing with Sophos - Sophos Day Belux 2014
Securing with Sophos - Sophos Day Belux 2014Securing with Sophos - Sophos Day Belux 2014
Securing with Sophos - Sophos Day Belux 2014
 
DIPTI_RANJAN_BARIK(Wintel).doc
DIPTI_RANJAN_BARIK(Wintel).docDIPTI_RANJAN_BARIK(Wintel).doc
DIPTI_RANJAN_BARIK(Wintel).doc
 
Tech Ed 2008 Israel Server Management 360
Tech Ed 2008 Israel   Server Management 360Tech Ed 2008 Israel   Server Management 360
Tech Ed 2008 Israel Server Management 360
 
Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016
Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016
Expanding your options with the IBM MQ Appliance - IBM InterConnect 2016
 

Plus de EnclaveSecurity

Using an Open Source Threat Model for Prioritized Defense
Using an Open Source Threat Model for Prioritized DefenseUsing an Open Source Threat Model for Prioritized Defense
Using an Open Source Threat Model for Prioritized DefenseEnclaveSecurity
 
The CIS Critical Security Controls the International Standard for Defense
The CIS Critical Security Controls the International Standard for DefenseThe CIS Critical Security Controls the International Standard for Defense
The CIS Critical Security Controls the International Standard for DefenseEnclaveSecurity
 
Practical steps for assessing tablet & mobile device security
Practical steps for assessing tablet & mobile device securityPractical steps for assessing tablet & mobile device security
Practical steps for assessing tablet & mobile device securityEnclaveSecurity
 
Utilizing the Critical Security Controls to Secure Healthcare Technology
Utilizing the Critical Security Controls to Secure Healthcare TechnologyUtilizing the Critical Security Controls to Secure Healthcare Technology
Utilizing the Critical Security Controls to Secure Healthcare TechnologyEnclaveSecurity
 
Information Assurance Metrics: Practical Steps to Measurement
Information Assurance Metrics: Practical Steps to MeasurementInformation Assurance Metrics: Practical Steps to Measurement
Information Assurance Metrics: Practical Steps to MeasurementEnclaveSecurity
 
Governance fail security fail
Governance fail security failGovernance fail security fail
Governance fail security failEnclaveSecurity
 
The intersection of cool mobility and corporate protection
The intersection of cool mobility and corporate protectionThe intersection of cool mobility and corporate protection
The intersection of cool mobility and corporate protectionEnclaveSecurity
 
Recent changes to the 20 critical controls
Recent changes to the 20 critical controlsRecent changes to the 20 critical controls
Recent changes to the 20 critical controlsEnclaveSecurity
 
Prioritizing an audit program using the 20 critical controls
Prioritizing an audit program using the 20 critical controlsPrioritizing an audit program using the 20 critical controls
Prioritizing an audit program using the 20 critical controlsEnclaveSecurity
 
Overview of the 20 critical controls
Overview of the 20 critical controlsOverview of the 20 critical controls
Overview of the 20 critical controlsEnclaveSecurity
 
More practical insights on the 20 critical controls
More practical insights on the 20 critical controlsMore practical insights on the 20 critical controls
More practical insights on the 20 critical controlsEnclaveSecurity
 
Its time to rethink everything a governance risk compliance primer
Its time to rethink everything a governance risk compliance primerIts time to rethink everything a governance risk compliance primer
Its time to rethink everything a governance risk compliance primerEnclaveSecurity
 
Cyber war or business as usual
Cyber war or business as usualCyber war or business as usual
Cyber war or business as usualEnclaveSecurity
 
Benefits of web application firewalls
Benefits of web application firewallsBenefits of web application firewalls
Benefits of web application firewallsEnclaveSecurity
 

Plus de EnclaveSecurity (14)

Using an Open Source Threat Model for Prioritized Defense
Using an Open Source Threat Model for Prioritized DefenseUsing an Open Source Threat Model for Prioritized Defense
Using an Open Source Threat Model for Prioritized Defense
 
The CIS Critical Security Controls the International Standard for Defense
The CIS Critical Security Controls the International Standard for DefenseThe CIS Critical Security Controls the International Standard for Defense
The CIS Critical Security Controls the International Standard for Defense
 
Practical steps for assessing tablet & mobile device security
Practical steps for assessing tablet & mobile device securityPractical steps for assessing tablet & mobile device security
Practical steps for assessing tablet & mobile device security
 
Utilizing the Critical Security Controls to Secure Healthcare Technology
Utilizing the Critical Security Controls to Secure Healthcare TechnologyUtilizing the Critical Security Controls to Secure Healthcare Technology
Utilizing the Critical Security Controls to Secure Healthcare Technology
 
Information Assurance Metrics: Practical Steps to Measurement
Information Assurance Metrics: Practical Steps to MeasurementInformation Assurance Metrics: Practical Steps to Measurement
Information Assurance Metrics: Practical Steps to Measurement
 
Governance fail security fail
Governance fail security failGovernance fail security fail
Governance fail security fail
 
The intersection of cool mobility and corporate protection
The intersection of cool mobility and corporate protectionThe intersection of cool mobility and corporate protection
The intersection of cool mobility and corporate protection
 
Recent changes to the 20 critical controls
Recent changes to the 20 critical controlsRecent changes to the 20 critical controls
Recent changes to the 20 critical controls
 
Prioritizing an audit program using the 20 critical controls
Prioritizing an audit program using the 20 critical controlsPrioritizing an audit program using the 20 critical controls
Prioritizing an audit program using the 20 critical controls
 
Overview of the 20 critical controls
Overview of the 20 critical controlsOverview of the 20 critical controls
Overview of the 20 critical controls
 
More practical insights on the 20 critical controls
More practical insights on the 20 critical controlsMore practical insights on the 20 critical controls
More practical insights on the 20 critical controls
 
Its time to rethink everything a governance risk compliance primer
Its time to rethink everything a governance risk compliance primerIts time to rethink everything a governance risk compliance primer
Its time to rethink everything a governance risk compliance primer
 
Cyber war or business as usual
Cyber war or business as usualCyber war or business as usual
Cyber war or business as usual
 
Benefits of web application firewalls
Benefits of web application firewallsBenefits of web application firewalls
Benefits of web application firewalls
 

Dernier

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Dernier (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Enterprise PowerShell for Remote Security Assessments

  • 1. Enterprise PowerShell for Remote Security Assessments A Practical Approach Presented by James Tarala Principal Consultant © 2014 Enclave Security
  • 2. 2 Problem Statement • During a security assessment an administrator needs to be able to perform tasks against multiple remote machines • For example: – Generate a user account list from multiple remote machines – Reset the password for the local administrator account across all the machines in a domain – Local a known malicious process on a list of workstations – Kill a known malicious process on a list of workstations – Query / parse the event log from multiple workstations Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 3. 3 Remote Management Architecture Enterprise Systems Windows Servers Unix / Linux Servers Admin Workstation Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 4. 4 Solution #1: SSH & PowerShell • Traditionally, when sysadmins need to perform remote command line management, they use SSH • One solution is to install an SSH server that serves a powershell.exe shell when clients connect • Supports Windows and Unix management workstations Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 5. 5 Advantages of PowerShell SSH Server • There are a number of advantages to this approach: – Provides an encrypted channel between systems – Utilizes standard protocols that are well tested – Creates an interactive session with a remote system – Can be scripted to allow for automation – Firewall rules are simple to create via Windows Firewall – Allows for two-factor authentication through the use of key files Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 6. 6 FreeSSHd Configuration (Example) • One option is to use the free FreeSSHd software • Replace default cmd.exe shell with powershell.exe shell Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 7. 7 PowerShell Server (Example) • Another option is to use the PowerShellServer commercial software to create a PowerShell Terminal Server • Allows standard SSH clients to connect to server, and issue PowerShell commands remotely Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 8. 8 PowerShell SSH Client via SSH.NET Library • Project to create a PowerShell version of an SSH client • Free download from Codeplex (https://sshnet.codeplex.com/) • Supports a number of standard SSH functions, including: – Implementation of standard remote shell – SFTP / SCP functionality – Tracks progress of uploads / downloads for progress bars – Supports key files for authentication – Supports standard encryption algorithms / key lengths Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 9. 9 PowerShell SSH Client via NetCmdlets Tools • Commercial third party PowerShell client modules • Allows PowerShell clients to run standard network client protocols from within a PowerShell session • Includes SSH, DNS, Email, LDAP, WebDAV, and more Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 10. 10 Disadvantages of PowerShell SSH Server • Unfortunately, there are disadvantages to these approaches: – Third party software has to be installed / configured – Third party software must be maintained / kept up to date – Third party client software will be necessary – Additional licensing costs may be incurred (per system) – May not function on all versions of Windows – Only supports key files for two-factor authentication – Authentication / access must be managed per system – Only allows for interactive logon sessions & results of commands may be difficult to include in local scripts Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 11. 11 Solution #2: WS-Management • Distributed Management Task Force (DMTF) standard for remotely managing systems via web • Microsoft first implemented it via Windows Remote Management (WinRM) for XP/2003 & Vista/2008 • Most recent release WinRM 2.0 in PowerShell 2.0 & later • Also supports a separate set of protocols using the Common Information Model (CIM) – an upgrade to WMI Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 12. 12 CMDLET Specific vs. Native Remoting CMDLET Specific Remoting • DCOM or RPC or WinRM • Each CMDLET functions differently • Different server setup per protocol • Different syntax per CMDLET • No support for interactive shells • No support for disconnecting from running commands • Parses & processes commands locally Native PowerShell Remoting • WS-Management v2.0 • Each CMDLET functions the same • Identical server setup for all systems • Same syntax for all CMDLETs • Support for interactive shells • Support for disconnecting and reconnecting to running commands • Parses & processes commands remotely Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 13. 13 WS-Man - OS Requirements / Configuration • Requires at least PowerShell 2.0 • Available by default in Windows 7 / 2008 R2 and later • Installation kits available for Windows XP / Vista / 2003 / 2008 • To automatically install, run: Enable-PSRemoting • “-SkipNetworkProfileCheck” switch might be necessary if current firewall profile is “Public” Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 14. 14 Enable-PSRemoting • Built in script for enabling PSRemoting on a computer • Automates the steps that could be set manually or via a Group Policy Object Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 15. 15 WS-Man - Service Requirements / Configuration • WS-Management service must be “Started”, ideally configured to startup type “Automatic” • Enable-PSRemoting script automatically enables this Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 16. 16 WS-Man - Firewall Requirements / Configuration • Firewall rules added by default via PS command • New rule for “Windows Remote Management (HTTP-in)” • Compatibility mode not necessary Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 17. 17 WS-Man - HTTP vs HTTPs • WS-Man communicates via serialized XML over HTTP • By default operates using HTTP on tcp/5985 • Can also use encrypted HTTPs on tcp/5986 Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 18. 18 WS-Man -Mass Configuration • Enable-PSRemoting script can be executed on all machines • Group Policies can be set to: 1. Enable WinRM (Policies > Administrative Templates > Windows Components > Windows Remote Management (WinRM) > WinRM Service) 2. Enable Firewall for tcp/5985 & tcp/5986 (Policies > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile) 3. Enable Automatic Service Startup (Policies > Windows Settings > Security Settings > System Services) 4. Legacy clients need PowerShell 2.0 or later & .NET Framework (XP & 2003) Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 19. 19 PSSession - Like Native SSH for Windows • Creates an interactive session with a remote machine using the WS-Management protocol • To start a session: Enter-PSSession –Computername Name • To end a session: Exit-PSSession • Supports mutual authentication (via domain, SSL, or TrustedHosts) Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 20. 20 PSSession - PowerShell v3.0 • New feature in PowerShell v3.0 & later • Allows users to disconnect / reconnect to running PSSession • Analogy: Similar to Metasploit sessions • Administrators can commandeer other users’ sessions Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 21. 21 Connect-PSSession / Disconnect-PSSession • These commands are available in PowerShell v3.0 & later – Disconnect-PSSession allows a user to disconnect from an existing PSSession – Connect-PSSession allows a user to reconnect to a PSSession in a disconnected state – Get-PSSession allows a user to list all current sessions – Remove-PSSession allows a user to delete a current session • Allows a user to kick off a process that may take some time and then return to it later as needed Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 22. 22 Invoke-Command • Creates a temporary PSSession with a remote machine • Session lasts for only as long as necessary for a command to execute • Can be used to execute a CMDLET, such as: Invoke-Command -ComputerName ENV-DC-01 -ScriptBlock {Get-Process} • Can be used to execute a PowerShell script, such as: Invoke-Command -ComputerName ENV-DC-01 -FilePath c:process.ps1 Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 23. 23 Case Study – WS-Management in Action • WS-Management can extend PowerShell to give administrators the ability to scale security commands • These security capabilities can be used by: – Incident handlers – Penetration testers – Forensic analysts – IT Auditors • The following slides illustrate some of the capabilities PowerShell offers via WS-Management Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 24. 24 Generate Enterprise-Wide User Account List • The following command would allow you to remotely connect to multiple computers to retrieve a list of user accounts: Invoke-Command -ComputerName SVR01,SVR02 ` -ScriptBlock ` {Get-WMIObject Win32_Useraccount | ` Select Name,SID} Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 25. 25 Scan for Known Malicious Services • The following command would allow you to remotely connect to multiple computers to retrieve a list of servers running the apache service: Invoke-Command -ComputerName SVR01,SVR02 ` -ScriptBlock {Get-Service | ` Where {$_.Name –like “*apache*” | ` Select Name,Status,PSComputerName} Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 26. 26 Scan for Known Malicious Processes • The following command would allow you to remotely connect to multiple computers to retrieve a list of where the evil.exe process is currently running: Invoke-Command -ComputerName SVR01,SVR02 ` -ScriptBlock {Get-Process | ` Where {$_.Name –like “*evil.exe*” | ` Select Name,PSComputerName} Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 27. 27 Kill Known Malicious Processes • The following command would allow you to remotely connect to multiple computers to retrieve a list of where the evil.exe process is currently running, and then kill that process: Invoke-Command -ComputerName SVR01,SVR02 ` -ScriptBlock {Get-Process | ` Where {$_.Name –like “*evil.exe*” | ` Select Name,PSComputerName} | Stop-Process} Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 28. 28 Parse Event Logs for Login Events • The following command would allow you to remotely connect to multiple computers to retrieve a list of where & when the James user account has successfully logged in recently: Invoke-Command -ComputerName SVR01,SVR02 ` -ScriptBlock {Get-WinEvent –FilterHashtable ` @{logname='security'; id=4624} | ` Where {$_.Message -like "*james*"} | ` select timecreated,PSComputerName} Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 29. 29 Next Steps • If you find yourself regularly assessing Microsoft Windows based systems – learn PowerShell 1. Learn the foundations of PowerShell scripting 2. Learn the basic built-in cmdlets Windows provides 3. Learn about additional modules that can be added to a standard Windows environment 4. Write scripts to automate common assessment tasks 5. Experiment with output & reporting in PowerShell 6. Share your scripts with the community Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 30. 30 Further Questions • James Tarala – Principal Consultant & Founder, Enclave Security – E-mail: james.tarala@enclavesecurity.com – Twitter: @isaudit – Website: http://www.auditscripts.com/ • Resources for further study: – AuditScripts.com Audit Resources – SANS SEC 505: Securing Windows & Resisting Malware – Windows PowerShell in Action by Bruce Payette – PowerShell and WMI by Richard Siddaway Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014
  • 31. 31 References • http://windowsitpro.com/powershell/powershell-basics-remote- management • http://www.netcmdlets.com/overview/unix/ • http://www.powershelladmin.com/wiki/SSH_from_PowerShell _using_the_SSH.NET_library • http://blogs.technet.com/b/heyscriptingguy/archive/2012/11/15 /digging-into-powershell-remote-authentication.aspx Enterprise PowerShell for Remote Security Assessments © Enclave Security 2014

Notes de l'éditeur

  1. Enterprise PowerShell for Remote Security Assessments As organizations assess the security of their information systems, the need for automation has become more and more apparent. Not only are organizations attempting to automate their assessments, the need is becoming more pressing to perform assessments centrally against large numbers of enterprise systems. Forensic analysts, incident handlers, penetration testers, and auditors all regularly find themselves in situations where they need to remotely assess a large number of systems through an automated set of tools. Microsoft’s PowerShell scripting language has become the defacto standard for many organizations looking to perform this level of distributed automation. In this presentation James Tarala, of Enclave Security, will describe to students the enterprise capabilities PowerShell offers and show practical examples of how PowerShell can be used to perform large scale Windows security assessments.