Skip to main content

Installing kansa incident response tool

 Kansa is an IR framework.
https://github.com/davehull/Kansa

For enterprise data collection, you need to do this first from the admin system:
Set-NetConnectionProfile -NetworkCategory Private (In private network)
Enable-PSRemoting from powershell on the system where you want to run this tool. This will enable winrm service with port 5985 and 5986.
Check:
netstat -naob | findstr "5985" 
Also allow tcp port 5985 and 5986 for winrm through the network. You can use  GPO. Though winrm is communicating over http and https but authentication will be happened using kerberos in domain environment. 

After downloading it from the github and unzip it, you need to unlock it using powershell. Need powershell v3 or later.
ls -r *.ps1 | Unblock-File

Powershell policy bypass:
Set-ExecutionPolicy AllSigned | RemoteSigned | Unrestricted

From FOR508 course:
.\kansa.ps1 -OutputPath .\Output\ -TargetList .\hostlist -TargetCount 250 -Verbose -Pushbin
-Pushbin is required by those scripts who has dependency of other binary. Kansa will then push that binary to the target systems. -Rmbin to remove that as well.
Those scripts are following:
1. Get-Autorunsc.ps1
2. Get-CertStore.ps1
3. Get-FlsBodyfile.ps1
4. Get-ProcDump.ps1
5. Get-RekalPslist.ps1
If you use the -Pushbin flag then make sure you have copied the above 5 scripts binary (whichever you want) to the .\Modules\bin\ folder.  

Do not do this in production. In production authentication should be kerberos. In lab you can do this to set the auth mode as basic.
winrm set winrm/config/client/auth '@{Basic="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/client  '@{AllowUnencrypted="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'

Fetch artifacts from single machine:
.\kansa.ps1 -OutputPath .\Output\ -Target localhost or $env:COMPUTERNAME -ModulePath .\Modules\ -Verbose -Authentication basic -Credential (Get-Credential)

You need place the Autorunsc.exe tool in the %SystemRoot% folder to execute the script successfully. Once the tool finishes it task you will see a folder named Output_timestamp
The .\Analysis folder contains some powershell scripts to analyze the collected data. For that you need logparser.exe microsoft tool to be installed. Make sure this tool can be called from any location by kansa. Optionally you can add the binary to path environment variable if it is failed to call the binary from anywhere in the system. 
hostlist file must contain one host per line.

If you do not provide hostlist file then the tool will query to AD to fetch the targets. For that you need remote server administration tool to be installed. 

Download RSAT:
https://www.microsoft.com/en-us/download/details.aspx?id=39296

When using AD, you also need to use -TargetCount parameter to limit the query.

Results are converted into tsv format so that it can easily understandable by timeline explorer.

Running modules separately:

Modules\Net\Get-Netstat.ps1

.\Get-Netstat.ps1 | ConvertTo-CSV -Delimiter "`t" -NoTypeInformation | % { $_ -replace "`"" } | Set-Content netstat.tsv 

Distributed kansa + fire and forget:
Please check For508 Advanced IR and TH book number 1 pdf 109 page. If you have less than 150 systems then normal kansa.ps1 will suffice. But if you have more than that then you may need to think of kansa distributed script. 


Avi

Comments

Popular posts from this blog

API hacking lab setup

 Follow the commands to install and configure API hacking lab: 1. Install kali linux and update all the packages.  apt update -y apt upgrade -y or apt dist-upgrade -y or apt full-upgrade -y If you face any problem regarding update, install cloud flare warp in the host machine, then again start updating packages in your kali vm.  2. Install and configure burpsuite professional.  After that open burpsuite and go to Extensions tab. Click on BAppStore. Search for Autorize extension, It will help us to automate authorization testing. Click on Download Jython from the right side. From Jython website click on Jython standalone JAR and save it. Go to Extensios > Extensions settings >  under Core extension settings find out Python environment on the right pane. Select the jython jar file that you just downloaded. Now again go to BAppStore and re-search for Autorize extension. You will see Install option this time after selecting Autorize extension. Install it. You ...

Downloading kape incident response tool for forensic triage

 Kape is a triage collection and post-processing application written by Eric Zimmerman. Remember its just the triage collection tool ok? We will analyze the collection later.  https://github.com/EricZimmerman/KapeFiles Kape download: Kroll Artifact Parser And Extractor (KAPE) | Cyber Risk | Kroll Besides full disk image/acquired disk image, this tool allows us to create smaller triage image where important forensic data is present . In case the scenario is divide and conquer , meaning if you want smaller triage image from big size disk image then you can use this and share with your DFIR team to investigate together. The main reason of using kape is now you don't need to wading or sift through into the full image where 10% actual artifacts are present. Kape will allow you to collect those 10% before taking full image. Now you can analysis those 10% of data.  If you want to learn more, please open for508 workbook and labs section 1-2.pdf file and look for page 28. This is...