Prise d'information locale

WinPEAS

A l’instar de LinPEAS pour Linux, il existe un script permettant d’énumerer les vulnérabilités présentes sur un système Windows.

Commandes Windows interessantes

Information utilisateurs

Informations génériques sur l’utilisateur et le domaine

whoami /all
net user <username>
net user
net user /domain
net user <username> /domain
net group /domain

Lister les fichiers accessible pour l’utilisateur

tree /a /f

Information système

systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"System Type" /C:"OS Version"

Fichiers intéressants

# Récupération des extensions interessantes
Get-ChildItem -Path C:\Users\ -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx,*.kdbx,*.ps1 -File -Recurse -ErrorAction SilentlyContinue

# Récupération des dossiers Git
Get-ChildItem -Path C:\ -Force -Recurse -Directory -Filter .git -ErrorAction SilentlyContinue | ForEach-Object FullName 
# Pour des résultats plus détaillés :
# https://gist.github.com/jdhitsolutions/ba3295167ccc997b7714e1f2a2777405

# Récupérer l'historique Powershell
cat (Get-PSReadlineOption).HistorySavePath
# Le chemin est normalement toujours dans le chemin
# C:\Users\<user>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\
# en CMD il est possible de faire
type C:\Users\<USER>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\*

Lister les tâches

tasklist
tasklist /SVC

Lister les tâches planifiées

schtasks /query /fo LIST /v

Lister les services

Get-Service | Where-Object {$_.Status -eq "Running"}

Cela peut amener à obtenir une méthode d’élévation de privilège.

Configuration réseau

ipconfig /all
route print
netstat -ano
netsh advfirewall show currentprofile

Logiciels installés

wmic product get name, version, vendor
wmic qfe get Caption, Description, HotFixID, InstalledOn

Autres

accesschk.exe -uws "Everyone" "C:\Program Files"
Get-ChildItem "C:\Program Files" -Recurse | Get-ACL | ?{$_.AccessToString -match "Everyone\sAllow\s\sModify"}

mountvol

driverquery /v /fo csv | ConvertFrom-CSV | Select-Object 'Display Name', 'Start Mode', Path
Get-WmiObject Win32_PnPSignedDriver | Select-Object DeviceName, DriverVersion, Manufacturer | Where-Object {$_.DeviceName -like "*VMware*"}

# SUID like, if "AlwaysInstallElevated" equal 1, all installer are privilegied
reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer
reg query HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer