MDstable
NoteSnippetChecklistPlaybook

Event Logs Windows

Analyser les journaux d'événements Windows pour le diagnostic et la sécurité

snippetintermediate 2025-05-10 4 min read
windowseventlogsecurityauditwevtutilpowershell

Event IDs critiques à surveiller

Authentification et accès

Event IDCanalDescription
4624SecurityConnexion réussie
4625SecurityÉchec de connexion
4634SecurityDéconnexion
4648SecurityConnexion avec credentials explicites
4672SecurityConnexion avec privilèges spéciaux
4768SecurityDemande ticket Kerberos (TGT)
4769SecurityDemande ticket de service Kerberos
4776SecurityValidation credentials NTLM

Comptes et groupes

Event IDDescription
4720Compte utilisateur créé
4722Compte activé
4723Tentative de changement de mot de passe
4724Mot de passe réinitialisé par admin
4725Compte désactivé
4726Compte supprimé
4732Membre ajouté à un groupe local
4756Membre ajouté à un groupe universel

Système et services

Event IDCanalDescription
7034SystemService s'est arrêté de façon inattendue
7036SystemService démarré/arrêté
7045SystemNouveau service installé
1102SecurityJournal de sécurité effacé (ALERTE)
4698SecurityTâche planifiée créée
4702SecurityTâche planifiée modifiée

Requêtes PowerShell

powershell
# Échecs de connexion des dernières 24h
Get-WinEvent -FilterHashtable @{
LogName = 'Security'
Id = 4625
StartTime = (Get-Date).AddHours(-24)
} | Select-Object TimeCreated,
@{N='User'; E={$_.Properties[5].Value}},
@{N='Source IP';E={$_.Properties[19].Value}},
@{N='Reason'; E={$_.Properties[8].Value}}
# Connexions réussies (hors comptes machine $)
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624} -MaxEvents 100 |
Where-Object { $_.Properties[5].Value -notlike '*$' } |
Select-Object TimeCreated,
@{N='User'; E={$_.Properties[5].Value}},
@{N='LogonType';E={$_.Properties[8].Value}},
@{N='Source IP';E={$_.Properties[18].Value}}
# Services installés (potentiel malware)
Get-WinEvent -FilterHashtable @{LogName='System'; Id=7045} |
Select-Object TimeCreated,
@{N='ServiceName';E={$_.Properties[0].Value}},
@{N='ImagePath'; E={$_.Properties[1].Value}}
# Journal effacé — alerte critique
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=1102} |
Select-Object TimeCreated, Message

wevtutil — CLI

powershell
# Lister les journaux disponibles
wevtutil el | Select-String "Security|System|Application"
# Infos sur un journal
wevtutil gl Security
# Requête simple
wevtutil qe Security /q:"*[System[EventID=4625]]" /f:text /c:10
# Requête XPath avec filtre date
wevtutil qe Security /q:"*[System[EventID=4625 and TimeCreated[@SystemTime>='2025-05-01T00:00:00']]]" /f:text
# Exporter un journal
wevtutil epl Security C:\Logs\security-backup.evtx
# Effacer un journal (admin requis)
wevtutil cl Application

Requêtes XPath dans l'Event Viewer

xml
<!-- Tous les échecs de connexion sur les 7 derniers jours -->
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[EventID=4625 and TimeCreated[timediff(@SystemTime) &lt;= 604800000]]]
</Select>
</Query>
</QueryList>
<!-- Services créés ou modifiés -->
<QueryList>
<Query Id="0" Path="System">
<Select Path="System">*[System[EventID=7045 or EventID=7040]]</Select>
</Query>
</QueryList>

Logon Types

TypeNomDescription
2InteractiveConnexion console locale
3NetworkAccès réseau (partage, RPC...)
4BatchTâche planifiée
5ServiceService Windows
7UnlockDéverrouillage de session
8NetworkClearRéseau avec mot de passe en clair (WDigest)
10RemoteInteractiveBureau à distance (RDP)
11CachedInteractiveConnexion locale avec cache de creds

Centralisation des logs

powershell
# Windows Event Forwarding (WEF) — configurer un collector
winrm quickconfig -q
# Sur les sources, configurer la subscription
# (via GPO ou wecutil)
wecutil cs subscription.xml
# Vérifier les subscriptions actives
wecutil es
wecutil gs "Nom-Subscription"
💡 Tip —

L'Event ID 1102 (journal de sécurité effacé) est un indicateur de compromission majeur. Le monitorer en temps réel via un SIEM. Sur un DC, également surveiller 4756 (ajout à un groupe privilégié) et 4768/4769 (Kerberoasting).

OPS·BRAIN v1.09 notes · SysAdminlocal