도구
로그인
한국어

코드 배우기보안지키미

PowerShell 기록이 꺼져 있음

참고W09윈도우 PC·서버

공격자가 돌린 PowerShell 명령이 기록에 남도록 스크립트 블록 기록을 켜요.

무엇이 위험한가

요즘 공격은 파일 없이 PowerShell 명령만으로 움직이는 일이 많아요. 기록이 없으면 무엇을 했는지 나중에 알 수 없어요.

참고 항목이에요. 막아 주지는 않고, 뚫렸을 때 흔적을 남겨요.

확인 방법

윈도우 PowerShell(관리자)

Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -ErrorAction SilentlyContinue

EnableScriptBlockLogging 이 1 이면 켜진 거예요. 아무것도 안 나오면 꺼진 거예요.

고치는 방법

윈도우 PowerShell(관리자)

New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name EnableScriptBlockLogging -Value 1 -Type DWord
wevtutil sl Microsoft-Windows-PowerShell/Operational /ms:104857600

마지막 줄은 기록 크기를 100MB 로 늘려 오래 남게 해요. 그룹 정책으로는 컴퓨터 구성 → 관리 템플릿 → Windows 구성 요소 → Windows PowerShell 에서 스크립트 블록 로깅을 켜요.

막는 방법

  • 기록을 다른 서버로 모아 두면 공격자가 지워도 남아요.

고친 뒤 다시 확인

윈도우 PowerShell(관리자)

Get-WinEvent -LogName 'Microsoft-Windows-PowerShell/Operational' -MaxEvents 20 | Where-Object Id -eq 4104

4104 번 이벤트가 보이면 기록되고 있는 거예요.

내려받은 점검 파일을 다시 돌려 이 항목이 통과로 나오는지 봐요.

보안지키미 첫 쪽