Ph4l4nx / Compromised-machine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows

System Information

  • View currently executing processes: Get-Process // to investigate further: Get-Process chrome | Select-Object Id, ProcessName, Path, Company, StartTime | Format-Table

  • List all the executed commands in the system: Get-History

  • Get-ScheduledTask

  • This command returns the list of past malware detections for the local computer: Get-MpThreatDetection

  • List preferences and exclusions of local computer: Get-MpPreference

  • Get the last 100 events from the application log: Get-EventLog -LogName Application -Newest 100

  • Get the security log events generated in the last 24 hours:Get-EventLog -LogName Security -After (Get-Date).AddDays(-1)

  • Get the error level events in the system log: Get-EventLog -LogName System -EntryType Error

  • All SW installed: reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s | findstr "DisplayName" //// Get-CimInstance -ClassName Win32_Product or wmic product get name,version

  • List all USB connected to the host: 1) Get-ItemProperty -ea 0 hklm:\system\currentcontrolset\enum\usbstor** | select FriendlyName,PSChildName

  1. Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR**
  • List all the Disks: Get-PhysicalDisk

  • To obtain the execution-policy: Get-ExecutionPolicy

  • To list all the users: Get-LocalUser

  • Getting all the GP0'S: Get-GPO –all

  • Live memory analysis: https://github.com/ignacioj/WhacAMole

  • Get-PSReadLineOption > type ..\PowerShell\PSReadLine\ConsoleHost_history.txt

  • FW configuration: netsh advfirewall show global

  • List all recently opened documents: openfiles /query (take a time)

  • From cmd: net user & net user 'username'

  • From cmd: lusrmgr -> Local users and groups

Persistence

Lateral Movement

Communications

  • View cached DNS entries: ipconfig /displaydns in Powershell: Get-DnsClientCache

  • Get all connections: Get-NetTCPConnection && Get-NetUDPEndpoint

  • netstat -ab | findstr :3389

  • Get-VpnConnection

Malware

Metadata

  • dir /r in cmd in order to get ADS from files
  • File download source: more < file:Zone.Identifier -> Zone.Identifier is an ADS attribute.
  • Get-Item -LiteralPath 'C:\Users\xxx\Downloads\pepito.txt' -Stream 'Zone.Identifier' | Get-Content
  • gc .\test.txt -Stream Zone.Identifier

SW

Lolbins:

  • Important lolbas to be aware: Wmic.exe, Mshta.exe, Certutil.exe, Hh.exe, Cscript.exe, Regini.exe, Cmd.exe, Rundll32.exe, Schtasks.exe and Shell32.dll

  • Reference: https://lolbas-project.github.io/

Hooking

  • tasklist /m EasyHook32.dll;tasklist /m EasyHook64.dll;tasklist /m EasyLoad32.dll;tasklist /m EasyLoad64.dll;

Triage

Analysis

Blogs

Linux

System Information

  • ps aux
  • arp -a
  • lastlog
  • htop | top
  • pstree & ps -auxwf
  • lsof
  • sudo iptables -L
  • dpkg -l
  • service --status-all
  • sudo systemctl list-units --type=service --state=running --no-legend | awk '{print $1}' | while read -r service; do echo -n "$service: "; ps -p $(systemctl show -p MainPID $service --value) -o user= ; done
  • Monitor linux processes: https://github.com/DominicBreuker/pspy
  • Auditd
  • Sysdig
  • last monitor last connections

Communications

  • watch -n 0 ss -tpn
  • lsof -i
  • netstat -putona

Persistence

  • systemctl -> By service

  • cat ~/.bashrc & ~/.zshrc -> By configuration file/action

  • crontab -l -> Take care of the user context -> By scheduled task

Triage

Analysis

  • Interesting files: /etc/proxychains, /etc/crontab, /etc/passwd, /etc/sudoers, /etc/shadow, /etc/resolv.conf, /etc/network/interfaces & ~/.ssh/config

  • readelf file.elf or file.so -h

  • readelf file.elf or file.so -n

  • cat /proc/pid/maps

  • objdump -s -j .rodata file.so

  • objdump file.so

  • strace -f .elf file

  • strace -f -o strace_out.txt .elf file

  • ldd file

Memory

Logs

  • dmesg -> kernel information logs

/var/log/syslog, /var/log/auth.log, /var/log/kern.log, /var/log/dmesg & /var/log/messages.

Blogs

Android

Triage

General

About

License:GNU General Public License v3.0