Download - James Windows10 elevator action final-jp
![Page 1: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/1.jpg)
James Forshaw @tiraniddo 1
![Page 2: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/2.jpg)
James Forshaw @tiraniddo
「お約束の」バックグランドスライド
2
● GoogleのProject Zeroの研究者 ● Windowsを専門に扱う
○ 特にローカルの権限昇格 ● 嫌いな論理的脆弱性に出っくわしたことが無い
![Page 3: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/3.jpg)
James Forshaw @tiraniddo
本日話そうと思っていること ● Windowsにおける権限昇格
○ ユーザ・モードとカーネル・モードの知識が混在したバグの狩場 ● 脆弱性を攻撃するのに使える楽しいトリック
○ マイクロソフト社の多くの人が気づいてさえいないような ● 主に論理的脆弱性、メモリコラプションは気にしない
3
あのWindowsを獲れ
![Page 4: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/4.jpg)
James Forshaw @tiraniddo
Windows ローカル攻撃の図式
4
カーネル
システム
ユーザ
サンドボックス
![Page 5: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/5.jpg)
James Forshaw @tiraniddo
Windows ローカル攻撃の図式
5
カーネル
システム
ユーザ
サンドボックス
![Page 6: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/6.jpg)
James Forshaw @tiraniddo
Windows ローカル攻撃の図式
6
カーネル
システム
ユーザ
サンドボックス
![Page 7: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/7.jpg)
James Forshaw @tiraniddo 7
権限昇格のバグを狩る
![Page 8: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/8.jpg)
James Forshaw @tiraniddo
ローカルのシステム脆弱性は死んだ!
8
![Page 9: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/9.jpg)
James Forshaw @tiraniddo
Windows カーネルアタックの可能性
9
システムコール カーネルに約400 WIN32Kに約1000
![Page 10: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/10.jpg)
James Forshaw @tiraniddo
システムサービスとドライバ
10
Windows 7 SP1
Windows 8.1 Windows 10
サービス 150 169 196
ドライバ 238 253 291
7 8 10
![Page 11: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/11.jpg)
James Forshaw @tiraniddo
サービス権限レベル
11
Windows 7 SP1
Windows 8.1 Windows 10
Local System 53.69% 56.89% 61.14%
Local Service 32.21% 31.14% 28.50% Network Service 14.09% 11.98% 10.36%
7 8 10
![Page 12: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/12.jpg)
James Forshaw @tiraniddo
サービス起動モード
12
Windows 7 Windows 8.1 Windows 10
自動 30.07% 26.19% 24.10%
無効 5.23% 3.57% 2.05%
手動 53.59% 43.45% 42.56%
自動(遅延開始) 11.11% 26.79% 31.28%
7 8 10
![Page 13: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/13.jpg)
James Forshaw @tiraniddo
サービスのためのコマンドライン引数?
13
サービスのための任意の引数
![Page 14: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/14.jpg)
James Forshaw @tiraniddo
引数を使うのは誰?
14
ここで使われている
![Page 15: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/15.jpg)
James Forshaw @tiraniddo
例:Mozillaのメンテナンスサービス
/***Mainentrypointwhenrunningasaservice.*/voidWINAPISvcMain(DWORDargc,LPWSTR*argv){//...ExecuteServiceCommand(argc,argv);}
15
![Page 16: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/16.jpg)
James Forshaw @tiraniddo
多くのセキュリティ問題
16
![Page 17: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/17.jpg)
James Forshaw @tiraniddo
簡単なC#のテストプログラム
classProgram{staticvoidMain(string[]args){if(args.Length<1){Console.WriteLine("Usage:ServiceNameargs");Environment.Exit(1);}ServiceControllerservice=newServiceController(args[0]);if(service.Status==ServiceControllerStatus.Stopped){service.Start(args);}}}
17
![Page 18: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/18.jpg)
James Forshaw @tiraniddo
RPCサービスの検出
18
![Page 19: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/19.jpg)
James Forshaw @tiraniddo
露出したCOMサービスの検出
19
Menu: Registry > Local Services
![Page 20: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/20.jpg)
James Forshaw @tiraniddo
デバイスドライバ
![Page 21: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/21.jpg)
James Forshaw @tiraniddo
アクセス可能なデバイスオブジェクト
21
7 8 10
Windows 7 Windows 8.1 Windows 10
読取り・書込み 64 54 52
読み取りのみ 6 6 5
![Page 22: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/22.jpg)
James Forshaw @tiraniddo
デバイス名を開く
\Device\Harddisk1\SomeNameNTアーキテクチャの ネイティブパス
![Page 23: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/23.jpg)
James Forshaw @tiraniddo
デバイス名を開く
\Device\Harddisk1\SomeName
\Device\Harddisk1 \SomeNameデバイスパス
NTアーキテクチャの ネイティブパス
デバイス名前空間へのパス
![Page 24: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/24.jpg)
James Forshaw @tiraniddo
デバイス名を開く
\Device\Harddisk1\SomeName
\Device\Harddisk1 \SomeNameデバイスパス
NTアーキテクチャの ネイティブパス
デバイス名前空間へのパス
ハードディスク ドライバ
ファイルハンドラを作成
![Page 25: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/25.jpg)
James Forshaw @tiraniddo
デバイス名前空間を保護する
● それで、何が問題? ○ デバイスパスのセキュリティはデフォルトではカーネルによって保護される
○ 名前空間はカーネルによって保護されない ● もし、ドライバが、自らチェックして適切なフラグを立てなければ保護の無い状態になる
![Page 26: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/26.jpg)
James Forshaw @tiraniddo
脆弱なコードのパターン
NTSTATUSDriverEntry(DRIVER_OBJECT*DriverObject,...){//脆弱な可能性があるIoCreateDevice(DriverObject,0,Name,FILE_DEVICE_UNKNOWN,0,TRUE,&DeviceObject);//デバイスの名前空間が保護されているIoCreateDevice(DriverObject,0,Name,FILE_DEVICE_UNKNOWN,FILE_DEVICE_SECURE_OPEN,TRUE,&DeviceObject);//名前にもかかわらず、脆弱なままIoCreateDeviceSecure(DriverObject,0,Name,FILE_DEVICE_UNKNOWN,0,TRUE,SecuritySddl,NULL,&DeviceObject);}
26
![Page 27: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/27.jpg)
James Forshaw @tiraniddo
例:Windows ソケット
● LinuxやOS Xでは、ソケットはシステムコールとして実装 ● Windowsでは Ancillary Functionドライバ(AFD) 内に実装 ● \Device\Afd を通じて情報をやり取り ● しかし、デバイスの名前空間は \Device\Afd\Endpoint に命令を投げることで開かなくてはならない
● 名前空間にはセキュリティが無い (>_<) ● その後の操作は DeviceIoControl を通じて行う
![Page 28: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/28.jpg)
James Forshaw @tiraniddo
ネイティブソケット
BOOLConnectSocket(HANDLEhSocket,u_shortsrcport,constSOCKADDR_IN&inaddr){//hSocketisopenedfile\Device\Afd\EndpointConnectDatadata={0};data.sin_family=AF_INET;data.sin_port=htons(srcport);data.inaddr=inaddr;DWORDdwSize;returnDeviceIoControl(hSocket,0x00012007,&data,sizeof(data),nullptr,0,&dwSize,nullptr);}
![Page 29: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/29.jpg)
James Forshaw @tiraniddo
登録されたあらゆるIPエンドポイントと通信
● たとえば SMB あるいは DCE/RPC
29
https://code.google.com/p/google-security-research/issues/detail?id=222
![Page 30: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/30.jpg)
James Forshaw @tiraniddo
何を探すべき? ● 最適な場所はハンドラの中で次のものを探すこと:
○ IRP_MJ_DEVICE_CONTROL ○ IRP_MJ_FILE_SYSTEM_CONTROL ○ Classic IOCTL bugs
● コントロールコードはデバイスハンドルが呼び出すのに必要な権限を符号化しており、また、情報を投げるためのパラメータを含んでいる
30
デバイスタイプ ビット 30 - 16
必要な アクセス
15-14
ファンクション コード 12-2
転送の タイプ
1-0
METHOD_BUFFERED 0
METHOD_IN_DIRECT 1
METHOD_OUT_DIRECT 2
METHOD_NEITHER 3
FILE_ANY_ACCESS 0
FILE_READ_ACCESS 1
FILE_WRITE_ACCESS 2
![Page 31: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/31.jpg)
James Forshaw @tiraniddo
IOCTL の例
31
Online decoder: https://www.osronline.com/article.cfm?article=229
![Page 32: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/32.jpg)
James Forshaw @tiraniddo
DosDevice によるドライブ探索
32
\??\C:\SomePath
ユーザ毎の デバイスマップ
プロセス毎の デバイスマップ
グローバルな デバイスマップ??
仮想デバイスマップ?? \Device\XYZ\SomePath
![Page 33: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/33.jpg)
James Forshaw @tiraniddo
プロセス毎のデバイスマップ
constintProcessDeviceMap=23;structPROCESS_DEVICEMAP_INFORMATION{HANDLEDirectoryHandle;};boolSetProcessDeviceMap(HANDLEhDir){PROCESS_DEVICEMAP_INFORMATIONDeviceMap={hDir};NTSTATUSstatus=NtSetInformationProcess(GetCurrentProcess(),ProcessDeviceMap,&DeviceMap,sizeof(DeviceMap));returnstatus==0;}
33
![Page 34: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/34.jpg)
James Forshaw @tiraniddo
プロセス毎のデバイスマップを使用
NTSTATUSDoDeviceIoControl(DRIVER_OBJECT*Driver,PIRPIrp){//脆弱な可能性があるPIO_STACK_LOCATIONstack_loc=...;if(stack_loc->DeviceIoControl.IoControlCode==IOCTL_SOMETHING){UNICODE_STRINGname=L"\\??\\C:";UNICODE_STRINGtarget=L"\\Device\\Target":IoCreateSymbolicLink(&name,&target);}}HANDLEhDir;UNICODE_STRINGname=L"\\GLOBAL??";NtOpenDirectoryObject(&hDir,DIRECTORY_TRAVERSE,&ObjAttr);SetProcessDeviceMap(hDir);
34
https://code.google.com/p/google-security-research/issues/detail?id=538
![Page 35: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/35.jpg)
James Forshaw @tiraniddo
攻撃の手段は・・・
● MS15-111 においてプロセス毎のデバイスマップがサンドボックスから取り除かれた
if(ProcessInformationClass==ProcessDeviceMap){if(RtlIsSandboxedToken(NULL)){returnSTATUS_ACCESS_DENIED;}returnObSetDeviceMap(ProcessHandle,DirectoryHandle);}
35
![Page 36: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/36.jpg)
James Forshaw @tiraniddo
ユーザ毎のデバイスマップ
36
![Page 37: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/37.jpg)
James Forshaw @tiraniddo
なりすましとデバイスマップ
● 特権サービスがユーザに成りすますときは、ユーザもまたデバイスマップに成りすます。
● C:シンボリックリンクをユーザ毎のデバイスマップのディレクトリにドロップすることで、成りすましている間はC: の配下で動くサービスをコントロールできる。
● MS15-038 の前は、このDLLロードを狙ったプロセス内で行うことで実現できた。 ○ デバイスマップの成りすましを無効化する新しいオブジェクト属性
OBJ_IGNORE_IMPERSONATED_DEVICEMAP を追加することで修正された。
● しかし、まだ使える。たとえば、なりすまし中のプロセス作成は依然として脆弱。
● 「保護された」設定を読み込むことも同様に脆弱。 ● オリジナルのDLLバージョンはダウンロード可能
https://code.google.com/p/google-security-research/issues/detail?id=240
37
![Page 38: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/38.jpg)
James Forshaw @tiraniddo
プロセス監視を使う
● プロセス監視はファイル作成イベントにおけるなりすましの過程をログに残す。
● これを使って、何か有用なものを開くときにユーザに成りすましているシステムサービスが無いかを探す(DLLはおそらくダメ)。
38
この値を見る
![Page 39: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/39.jpg)
James Forshaw @tiraniddo
興味深いオブジェクト属性のフラグ
39
フラグ名 値 解説
OBJ_CASE_INSENSITIVE 0x0040 システムが大文字小文字を識別するように設定された場合に興味深い(デフォルトはNO)
OBJ_OPENLINK 0x0100 Opens a “link” オブジェクトを開く。レジストリキーのシンボリックリンクを開くことに使用。
OBJ_KERNEL_HANDLE 0x0200 カーネルモードで設定されなかったら、ハンドルを現行のプロセスに対してさらす。
OBJ_FORCE_ACCESS_CHECK 0x0400 カーネルモードで設定されなかったら、リソースをセキュリティチェック無しで開く。
OBJ_IGNORE_IMPERSONATED_DEVICEMAP 0x0800 なりすまされたデバイスマップを無視する。
![Page 40: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/40.jpg)
James Forshaw @tiraniddo
デフォルトのACLとオーナー
● ファイルもしくはオブジェクトの権限は下記の3つのうちの1つに依存 ○ 自らのコンテナ(ディレクトリなど)から受け継いだ権限 ○ 現在有効なトークンにおけるデフォルト権限 ○ カーネル システム コールに渡されたセキュリティ記述子
40
デフォルト Group
デフォルト DACL
デフォルトOwner
整合性レベルも トークンから受け継がれる
![Page 41: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/41.jpg)
James Forshaw @tiraniddo
もし DeviceMap が存在しなかったら?
NTSTATUSSeGetTokenDeviceMap(TOKEN*token,DEVICE_MAP**device_map){if(!token->LogonSession->pDeviceMap){swprintf_s(&SourceString,L"\\Sessions\\0\\DosDevices\\%08x-%08x",token->AuthenticationId.HighPart,token->AuthenticationId.LowPart);InitializeObjectAttributes(&ObjectAttributes,SourceString,OBJ_KERNEL_HANDLE,...);ZwCreateDirectoryObject(&DirectoryHandle,DIRECTORY_ALL_ACCESS,&ObjectAttributes);ObSetDirectoryDeviceMap(&token->LogonSession,DirectoryHandle);}*device_map=token->LogonSession->pDeviceMap;}
41
![Page 42: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/42.jpg)
James Forshaw @tiraniddo
デフォルトセキュリティ
● 実行過程における必要に基づいて作成されたデバイスマップ ディレクトリは、それゆえに、呼び出したものの権限を得る。 ○ Owner セット ○ デフォルト DACL
● つまり、デバイスマップにアクセスできる。 ● このことを、限られた方法ながら、プロセス毎のデバイスを失ったことの埋め合わせに使用できる。
● また、レジストリ・キーやファイルなどの他のさまざまなリソースにも使える
1. トークン(S4Uから等)を初期化されていないデバイスマップとともに受け取る
2. トークンに成りすまし、デバイスマップにアクセスして作成する 3. ユーザに成りすましながら、リソースを開いたりカーネル関数を呼び出す
42
![Page 43: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/43.jpg)
James Forshaw @tiraniddo
Win32 の自動リダイレクト
43
● Win32 API はネイティブAPIを呼び出したときに特定のファイル名をリダイレクトする ○ COM1 -> \??\COM1 ○ NUL -> \??\NUL ○ などなど
● システムサービスはほとんど保護しない。 ● もし、なりすまし中に呼び出された場合、完全なパスをコントロールしていなくてもファイルアクセスをリダイレクトできる
● 例: ○ もし、サービスがc:\somepath\yourfile を開いた場合、他のファイルへリダイレクトできる
○ 設定情報へ悪用が可能
![Page 44: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/44.jpg)
James Forshaw @tiraniddo
パスの正規化
● パスの正規化はWindowsとLinux・OSXでまったく異なる ● LinuxやOSXではパスはそのままでカーネルに渡される
○ カーネルがパスの正規化に責任を持つ ○ 「. 」と「.. 」ディレクトリは本物のディレクトリエントリ
● Windowsでは、絶対パスでカーネルに渡されなくてはならない ○ 相対パスのコンポーネントはユーザモードで取り除かれる ○ 現行のディレクトリが処理される ○ 「. 」と「.. 」 はシミュレートされたディレクトリ
44
![Page 45: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/45.jpg)
James Forshaw @tiraniddo
パスの正規化
45
A B C
Path Linux/OSX Windows
A/B/C Valid Valid
A/B/C/../../B Valid Valid
A/B/D/../C Invalid Valid
A/B/D”/../C Invalid Valid
constchar*path="c:\\my\\app.exe\"\\..\\..\\windows\\notepad.exe";if(CheckSig(path)){snprintf(cmdline,"\"%s\"arg",path);CreateProcess(NULL,cmdline,...);}
![Page 46: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/46.jpg)
James Forshaw @tiraniddo
NTFS の無効な文字
46
![Page 47: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/47.jpg)
James Forshaw @tiraniddo
オブジェクトマネージャの無効な文字
47
![Page 48: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/48.jpg)
James Forshaw @tiraniddo
Windows カーネルは文字列を数えた数を使用
48
長さをバイトで指定
![Page 49: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/49.jpg)
James Forshaw @tiraniddo
Windows カーネルは文字列を数えた数を使用
49
NULL 終端!
![Page 50: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/50.jpg)
James Forshaw @tiraniddo
ディレクトリにおける交互データ・ストリーム
50
![Page 51: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/51.jpg)
James Forshaw @tiraniddo
UAC 自動昇格ディレクトリチェック
51
c:\windows\ c:\windows\tracing\ app.exe app.exe
許可 禁止
![Page 52: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/52.jpg)
James Forshaw @tiraniddo
フォルダにおける権限
52
c:\windows\ c:\windows\tracing\ app.exe app.exe
ALLOWED BANNED
![Page 53: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/53.jpg)
James Forshaw @tiraniddo
AiCheckSecureApplicationDirectory バイパス
53
● ファイルをセキュアなパスで書き込めることが必要 ● どうすれば C:\Windows に対して C:\Windows に書き込まずに書き込める?
c:\windows\ malicious.exe
許可
c:\windows\ ????
許可?
![Page 54: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/54.jpg)
James Forshaw @tiraniddo
NTFS の交互データ・ストリームだ!
54
c:\windows\ tracing:malicious.exe
ALLOWED ● 生成されて名づけられたストリームに対するディレクトリにおけるFILE_WRITE_DATA/FILE_ADD_FILE の権限があれば良い。
● このバグはWindows 10で修正されているが、Windows 8.1以下ではそのまま。
![Page 55: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/55.jpg)
James Forshaw @tiraniddo
Windows シンボリックリンク
55
Windows NT 3.1 – 1993年7月27日 オブジェクトマネージャシ ンボリックリンクレジストリキー シンボリックリンク
Windows 2000 – 2000年2月17日 NTFS マウント ポイントと ディレクトリ ジャンクション
Windows Vista – 2006年11月30日 NTFS シンボリックリンク
![Page 56: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/56.jpg)
James Forshaw @tiraniddo
「サンドボックス」における対策
56
NTFS マウント ポイント
レジストリキー シンボリックリンク
オブジェクト マネージャ シンボリックリンク
禁止
限定
限定
![Page 57: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/57.jpg)
James Forshaw @tiraniddo
奇妙なデフォルト権限
● C:\Windows\Temp と C:\ProgramData は、標準ユーザに新規ファイルの作成を許可。
● その権限を誤って使っているプログラムを見つけたら、それらを攻撃するために新しいファイルもしくはシンボリックリンクをつくることができる。
● ファイルの削除は必ずしも可能である必要は無い。無論、見つけ出す価値はある。
57
![Page 58: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/58.jpg)
James Forshaw @tiraniddo 58
ラップアップ
![Page 59: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/59.jpg)
James Forshaw @tiraniddo
便利なツール (私のチョイス)
59
● SysInternals ○ Process Explorer ○ Process Monitor ○ WinObj
● WinDBG ● Rohitab API Monitor (http://www.rohitab.com/apimonitor) ● RPCView (http://www.rpcview.org/) ● OleView.NET (https://github.com/tyranid/oleviewdotnet) ● Sandbox Analysis Tools (
https://github.com/google/sandbox-attacksurface-analysis-tools ● IDA Pro
![Page 60: James Windows10 elevator action final-jp](https://reader034.vdocuments.pub/reader034/viewer/2022042520/589f7fc11a28abf0638b51c1/html5/thumbnails/60.jpg)
James Forshaw @tiraniddo
質問あります?
60