ref the art of memory forensics sans 508
play

Ref The Art of Memory Forensics SANS 508 - PowerPoint PPT Presentation

Ref The Art of Memory Forensics SANS 508 .


  1. لاثم Assuming that a process wants to create a new file using the Windows API, the following steps will occur: 1. The process calls CreateFileA (ASCII) or CreateFileW (Unicode) — both are exported by kernel32.dll. 2. The create file APIs lead into ntdll.dll, which subsequently calls into the kernel and reaches the native NtCreateFile function. 3. NtCreateFile will call ObCreateObject to request a new File object type. 4. ObCreateObject calculates the size of _FILE_OBJECT, including the extra space needed for its optional headers. 5. ObCreateObject finds the _OBJECT_TYPE structure for File objects and determines whether to allocate paged or nonpaged memory, as well as the four-byte tag to use. 6. ExAllocatePoolWithTag is called with the appropriate size, memory type, and tag.

  2. Deallocation • هکینامززا pool ربیم،ددرگ executive object رگیدهدافتسا،دوشنکولبهظفاحهبتسیلدازآ ویمدناوتیاربفراصمرگیداددجمصیصختدبای.

  3. Pool Tag Scanning • هبدنیارفادیپندرکاهصیصخت( pool tag scanning یمدنیوگ. allocations ، ) • ردیط tag یمدشاب.هبکمکزیاس pool tag scanning ،عورشوجتسجردهظفاحابراهچتیاب صیصختوعونهظفاحنیاوجتسجیشرافسرتیمدوش. • یاههاریرگیدزینیاربنکسادوجودراد. o لبثمیمناوتیلبمسزالنرکارهکهبزاغآکنیلتسیللاعف process هراشایم،دنکادیپ درک.

  4. Pool Tag Data Used by Existing Volatility Plugins for Windows XP to 7

  5. Pool Tracker Tables • Pool Tracker Table هبرههیارآزاراتخاس _POOL_TRACKER_TABLE هراشایم،دیامنهک Pool Tag درومهدافتساراکبیمدور. یاربره

  6. Pool Tracker

  7. لاثم • volatility_2.6_win64_standalone.exe -f \courseware\WindowsVista_0401.vmem --profile VistaSP1x86 pooltracker -- tags=Proc,Thre,File,Driv

  8. Processes, Handles and Tokens

  9. همدقم • هسهلحرمهیلواکرتشمردیپییوج process دنترابعزانییعتهکنآ: o هچهمانربیاهیدربراکردلاحارجا؟دنتسه o هچیراکماجنایمدنهد(یسرتسدهب،اهلیافیاهدیلکیرتسیجروهریغ)؟ o هچیاهزوجمیتینماارتسدبهدروآ؟دنا • دیابنینچمهدراوملیذاردایمیریگب: o هنوگچ hidden process اهارفشک؟مییامن o هنوگچ process اهارهبیاهباسحیربراکصاخطبترم؟مییامن

  10. Process Object

  11. Process Organization

  12. Analyzing Process Activity • pslist finds and walks the doubly linked list of processes and prints a summary of the data. This method typically cannot show you terminated or hidden processes. • pstree takes the output from pslist and formats it in a tree view, so you can easily see parent and child relationships. • psscan scans for _EPROCESS objects instead of relying on the linked list. This plugin can also find terminated and unlinked (hidden) processes. • psxview locates processes using alternate process listings , so you can then cross reference different sources of information and reveal malicious discrepancies.

  13. Process List

  14. DKOM هلمح

  15. • volatility_2.6_win64_standalone.exe -f WindowsVista_0401.vmem -- profile=VistaSP1x86 pslist

  16. Critical System Processes lsass.exe: The local security authority subsystem process is responsible for: o enforcing the security policy, o verifying passwords, o creating access tokens • it ’ s often the target of code injection because the plaintext password hashes can be found in its private memory space. • one instance of lsass.exe running from the system32 directory. • its parent is winlogon.exe on pre-Vista machines , and wininit.exe on Vista and later systems

  17. Critical System Processes winlogon.exe presents: • the interactive logon prompt, • initiates the screen saver when necessary, • helps load user profiles, • responds to Secure Attention Sequence (SAS) keyboard operations such as CTRL+ALT+DEL. • monitors files and directories for changes on systems that implement Windows File Protection (WFP). • System32

  18. Critical System Processes • explorer.exe o one Windows Explorer process for each logged-on user. o It is responsible for  handling a variety of user interactions such as GUI-based folder navigation,  presenting the start menu o It also has access to sensitive material such as  the documents you open  credentials you use to log in to FTP sites via Windows Explorer.

  19. Critical System Processes • smss.exe • the first real user-mode process that starts during the boot sequence. • It is responsible for creating the sessions that isolate OS services from the various users who may log on via the console or Remote Desktop Protocol (RDP).

  20. Critical System Processes • Idle and System • These are not real processes (in the sense that they have no corresponding executable on disk). • Idle is just a container that the kernel uses to charge CPU time for idle threads. • System serves as the default home for threads that run in kernel mode. Thus, the System process (PID 4) appears to own any sockets or handles to files that kernel modules open.

  21. Critical System Processes • csrss.exe o The client/server runtime subsystem o plays a role in creating and deleting processes and threads. o On systems before Windows 7, this process also served as the broker of commands executed via cmd.exe, so you can extract command history from its memory space. o multiple CSRSS processes because each session gets a dedicated copy; o attempts to exploit the naming convention (csrsss.exe or cssrs.exe). o The real one is located in the system32 directory.

  22. Critical System Processes • services.exe o it manages Windows services and maintains a list of such services in its private memory space. o There should be only one copy of services.exe on a system. • svchost.exe o A clean system has multiple shared host processes running concurrently, each providing a container for DLLs that implement services Process Parent Process Directory Services.exe Winlogon.exe, wininit.exe System32 Svchost.exe Services.exe System32 spoolsv.exe Services.exe SearchIndexer.exe Services.exe

  23. Id Identify fy Rouge Processes • FIRST 2009 vm • Python volatility psscan /samples/exemplar13.vmem • Python volatility pslist /samples/exemplar13.vmem • Python volatility pstree /samples/exemplar13.vmem

  24. اهدلیف Pslist psscan

  25. Graphviz • Dot – Tpng processes.dot > processes.png

  26. DKOM تلبمح فشک • یکیزاجیارنیرتیاهلدمهلمح process زاکنیلتسیلودهفرط DKOM ،مدعلاصتاکی EPROCESS تسا. • ابنتشونهراشایاهرگ Blink راکنیاماجناریذپتسا. Flink و

  27. Alternate Process Listings • pool tag scanning تسا. Process Object Scanning : نامه • Thread scanning : o زااجنآهکره thread thread هتشاد،دشابیممیناوتلابندءایشا process دیابلقادحکی process اهمیراگنب. میدرگبواهنآارهب o رگاکی pool tag اه process رییغت،دهددیابهمه pool tag اریارب rootkit هتسناوتدشاب thread pool اهرییغتدهداتهتخانشدوشن. اریارب • CSRSS handle table : o thread لیخدتسا. process و csrss.exe ردداجیاره o یمناوتردلودج process اهارمیبایب. handle نآرتشیبوجتسجدرکاتتسیلهمه

  28. Alternate Process Listings • PspCid table o نیاکی process یاهلاعفو kernel تساهکهمهءایشا handle table صاخردهظفاح thread اهاررددوخهگنیمدراد. • Session processes o همه SessionProcessLinks هگنیمدراد. session ربراکتساردتسیل process اهارهکرد • Desktop threads o ردنیاراتخاسهمه thread یاهلصتمهبپاتکسدهریخذیمدوش.

  29. Process Cross-View Plugin • volatility_2.6_win64_standalone.exe – f prolaco.vmem psxview – apply-rules

  30. Process Token • context یتینماارنآصخشمیمدیامن.لماشدراوملیذتسا: Process Token ،ردعقاو o process ارارجایمدننک. SID ناربراکایییاههورگهک o یاهزوجمیفلتخم( privileges )هکهزاجاارجااردنراد. • هکینامزلنرکیمدهاوخمیمصتدریگبهککی API یصاخ process هبکیءیشیسرتسددبایبای process token هدافتسایمدنک. اریناوخارف،دنکزاهدادنورد • نیاراتخاسیرایسبزایاهلرتنکیتینماطوبرمهب process ارلامعِایمدیامن.

  31. Live Response: Accessing Tokens

  32. Ext xtracting and Translating SID IDs in Memory • Known SIDs o S-1-5 (NT Authority) o S-1-5-32-544 (Administrators) o S-1-5-80 (Service SIDs) S-1-5-21-4010035002-774237572-2085959976-1000 SID The identifier The revision A relative The local computer or level (version authority value identifier that domain identifier of the SID represents any specification) user or group

  33. getsids plug-in

  34. Example • volatility_2.6_win64_standalone.exe --profile=VistaSP2x86 -f \courseware\WindowsVista_0401.vmem getsids • volatility_2.6_win64_standalone.exe --profile=VistaSP2x86 -f \courseware\WindowsVista_0401.vmem getsids -p 832 • volatility_2.6_win64_standalone.exe --profile=VistaSP2x86 -f \courseware\WindowsVista_0401.vmem printkey -K "Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-3357474304-2915131210-3987339850- 1000"

  35. • https://support.microsoft.com/en-us/help/243330/well-known-security- identifiers-in-windows-operating-systems

  36. Process Handles • process ای kernel object تسادننام،لیافدیلک،یرتسیجر Handle یعاجراهبهنومنزابزا thread . • ابشرامشولیلحتءایشایصاخهک process ردنامزهیهتریوصتهباهنآیسرتسدادیپ،هدرکهب یدادعتزاجیاتنیشاتکفیممیسر: o هچ process یلیافیصاخاریمهدناوخاییم؟هتشون o هچ process یهبدیلکیرتسیجریسرتسدادیپ؟هدرک o هچ process یمتسیسلیافهاررودارهتشاگن؟تسا

  37. Handles-File

  38. Handles – Registry ry key

  39. Process Memory ry In Internals • هچرگایاضفلنرکیارب process اهتاعلبطایدیفمارردرایتخارارقیم،دهد _EPROCESS ، process هبدوخصیصختیم،دهدیواحتاعلبطایدیفمتسا. هظفاحیلصاهک • نیاتاعلبطالماشدراوملیذ،تساامادودحمهباهنآیمندوش: o all content processed by the application o mapped files o shared libraries o Passwords o credit card transactions o private structures for e-mail, documents, and chat logs

  40. Process Memory ry

  41. Address Space Layout • Dynamic linked libraries (DLLs) o This area represents (DLLs) that were loaded into the address space. • Environment variables o This range of memory stores the process ’ environment variables, such as its executable paths, temporary directories, home folders, and so on. • Process Environment Block (PEB) o An extremely useful structure that tells you where to find several of the other items in this list, including the DLLs, heaps, and environment variables. o It also contains the process ’ command line arguments, its current working directory, and its standard handles

  42. Address Space Layout • Process heaps o Where you can find a majority of the dynamic input that the process receives. o For example, variable-length text that you type into e-mail or documents is often placed on the heap, as is data sent or received over network sockets. • Thread stacks o Each thread has a dedicated range of process memory set aside for its runtime stack. o This is where you can find function arguments, return addresses (allowing you to reconstruct call history), and local variables. • Mapped files and application data o Mapped files represent content from files on disk, which could be configuration data, documents, and so on. o Application data is anything the process needs to perform its intended duties.

  43. Address Space Layout • Executable o The process executable contains the primary body of code and read/write variables for the application. o This data may be compressed or encrypted on disk, but once loaded into memory, it unpacks, enabling you to dump plain-text code back to disk.

  44. Exploring Process Memory

  45. Example • volatility_2.6_win64_standalone.exe -f \courseware\WindowsVista_0401.vmem --profile=VistaSP2x86 procdump -- dump-dir=outDir • volatility_2.6_win64_standalone.exe -f \courseware\laqma.vmem procdump -p 1180 --dump-dir=outDir • volatility_2.6_win64_standalone.exe -f \courseware\laqma.vmem memdump - p 1180 --dump-dir=outDir

  46. Process Environment Block (PEB) • رهراتخاس _EProcess یواحیوضعهبمان PEB تسا. • PEB لماشتاعلبطالیذتسا: o ریسملماکهبلیافییارجا Process o طخنامرفهک process ارزاغآیمدیامن. o The current working directory o هراشارگهب Process ’ s heap o Standard handles o هسکنیلتسیلودهفرطهکیواحریسملماکهب DLL یاهیراذگرابهدشتسا.

  47. PEB PEB یا هداد راتخاس • راتخاسهدادیا PEB یارادیاهدلیفریزتسا: o BeingDebugged  نیادلیفنایبیمدنکهکایآ process مهنونکاردلاحگابیدندشتسا.  نیادلیفدنناممچرپزمرقتسارگالاعفدشابوچیهیرگابیدردمتسیسردلاحارجاشابند. o ImageBaseAddress  سردآهظفاح plugin: procdump process هکیئاجلیافییارجایلصایراذگرابهدشتسا.( ) o Ldr  هبراتخاس _PEB_LDR_DATA هراشایمدنکهکیواحیتایئزجهرابرد DLL یاهیراذگرابهدشرد process تسا.

  48. PEB PEB یا هداد راتخاس o ProcessParameters  هبراتخاس _RTL_PROCESS_PARAMETERS هراشایمدیامن. o ProcessHeap  process هبروطکیتاموتاداجیایمدوش. Process هکردماگنهنیزاغآیهد HEAP یلصا o NumberOfHeaps  دادعت heap دراداماابیناوخارف process کی process heap یاهکی .هبروطشیپضرفره heap مهارفیمدوش. HeapCreate ناکماداجیادادعتیرتشیب o ProcessHeaps  هیارآیازاهراشااهرگهب ProcessHeap هراشایم process heap یاه .نیلوایدوروردتسیلهب دیامن.

  49. راتخاس _PEB_LDR_DATA • InLoadOrderModuleList o کنیلیتسیلهکاهلوژاماریهدنامزاسیمدیامنهبیبیترتهکردسسورپیراذگرابمیدوش.زا اجنآهکلیافییارجاسسورپهشیمهیاربیراذگرابنیلوایم،دشابیدورونآردیاضفآسرد نیلواتسا. • InMemoryOrderModuleList o کنیلیتسیلهکاهلوژامارهبیبیترتهکردهظفاحیزاجمسسورپرهاظیم،دنوشزاسیهدنام یمدنک. • InInitializationOrderModuleList o کنیلیتسیلهکاهلوژامارهبیبیترتهکعباتنآیناوخارفهدشیراذگرابیمدنک.

  50. لیلحت فادها • یبایزابطخنامرفوریسمسسورپ o یسرربیعبانمردهظفاحسسورپهکیتاعلبطاارهرابردهکنآهنوگچسسورپیناوخارفهدشو یاهلیافنآاجکربیورکسیدرارق،دنرادردرایتخارارقیمدهد. • لیلحت heap o هچهدادییاهربیور heap هریخذیمدنوش • یسرربیاهریغتمیطیحم o فشکهداوناخییاهزااهرازفادبهکیاهریغتمدیدجداجیایمدننک.

  51. لیلحت فادها • فشکیتشپرداب handle یاهدرادناتسا o نییعتهکنآایآیدوروویجورخکیسسورپزاقیرطتکوسهاررودهکبشهبمجاهم redirect هدشتسا. • شرامش DLL اه o یهاگآزاهوحنیریگدر DLL یاهیراذگرابهدشطسوتسسورپردمتسیس،لماعونینچمه API ییاههکیاربتسیلندرکاهنآهدافتساهدشتسا.نینچمهفشکهناخباتکیاهنپناهو unlinked

  52. لیلحت فادها • جارختسایاهلیاف PE زاهظفاح o یاهلیاف dump یمدندرگویاربلیلحتاتسیاهدامآیمدنوش. PE زاهظفاح • فشکقیرزتدک o ردنیاشخبراهچعونقیرزتدکیسرربیمدوشوهکنیاهنوگچدرومیپییوجرارقریگد.

  53. یطیحم یاهریغتم • یاهریغتمیطیحمسسورپردهتشرییاههکاب NULL همتاخیم،دنباییهدنامزاسیمدنوش. • رگایمجاهمنیااهریغتمارلرتنک،دنکیمدناوتثعابیارجادنیارفداهندبطسوتهمانربشدنو. • نیاربانبدیابابهوحنلرتنکیورویاهکوکشمانشآمیوش.

  54. یطیحم یاهریغتم هدودحم و ءاشنم

  55. • یتسیلزاعاوناهدادییاههکردکیریغتمیطیحمدوجو،درادهبحرشلیذتسا: o یاهریسم( Path )هبهمانربیاهییارجا o PATHEXT Extension یاهتبسنهدادهدشهبهمانربییارجا( ) o یاهریسمهبیاهیروتکریادتقوم o یاهریسمهبتادنتسم،ربراکهقباس،تنرتنیاردلوفهدادهمانرب o یاهمان،یربراکمانرتویپماکومانهنماد o ....

  56. یطیحم یاهریغتم یور رب تلبمح • ودعونهلمحربیوریاهریغتمیطیحمدنترابعزا: o رییغتریغتم PATH o رییغتریغتم PATHEXT • لاثم: • ریغتم explorer.exe رییغتهدرک PATH رد • ربراکربیور calc اریناوخارفهدرکتسا. Start->Run روتسد

  57. یطیحم یاهریغتم یور رب تلبمح • ریغتم PATHEXT لماشتسیلییاهدنوسپتساهکرگاربراکیدنوسپارصخشم،دنکنسوتط متسیسابنآاهدنوسپوجتسجیمدوش. • لبثمهکینامزربراکروتسد calc.exe وردتیاهن calc.com دعب calc ارپیاتیم،دنکادتباهبلابند calc.bat یمددرگ. • ابرییغتقوفمتسیسادتباهبلابند calc.zzz یمددرگودکداهندبارارجایمدنک. • ردنیاطیارشدکداهندبرداهتنا calc.exe ارارجایمدنکوردتیاهنربراکهجوتمیمندوش.

  58. plugin • Envars • volatility_2.6_win64_standalone.exe -f \courseware\coreflood.vmem -- profile=WinXPSP3x86 envars -p 1724

  59. Dynamic Link Libraries (DLLs) • DLL اهیواحدکویعبانمدنتسههکنیبنیدنچسسورپهبکارتشاهتشاذگیمدنوش. • threat actor اهجیاریم،دنشاباریزهبعبانمفلتخممتسیسسرتسدی DLL اهردنیباهرازفادبو دنراد: o Thread اه o Handle اه o هظفاح process

  60. DLL اه لیلحت DLL اهدیابهبدراوملیذهجوتمییامن: هبماگنهلیلحت • List discrepancies : o نامجاهمشلبتیمدننکهک DLL ناشیاهارابعطقلاصتاراتخاسهدادارفزاکیایدنچتسیل ایابهرابودیسیوندلیفمانایریسمردراتخاسهدادارفناهنپدنیامن. • Unexpected name paths o زا DLL اهابیاهمانکوکشماییاهمانانشآانردیاهلحمدرادناتساریغدیابعلطممیشاب. o دننام C:\Windows\system32\ sys \kernel32.dll

  61. DLL اه لیلحت • Context DLL Usage ws2_32.dll networking crypt32.dll cryptography hnetcfg.dll firewall maintenance pstorec.dll access to protected storage • نیاربانبدیابهبلحمیریگراکب DLL هجوتدومن. • اهنآهبییاهنتکوکشمدنتسیناماهبیدربراکهکیاربنآردرظنهتفرگیم،دنوشیابدهجوتدومن.

  62. DLL اه یراذگراب هوحن • Dynamic linking o هبناونعیئزجزانیتورنیزاغآیهد،سسورپره DLL ردلیافییارجاهبتروصکیتاموتارد یاضفسردآسسورپیراذگرابیمددرگ. • Dependencies o DLL یاه import DLL اهیارادلوادج ،دنتسهنیاربانبهکینامزیراذگرابیم،دندرگهمه هفاضایاهکهبنآدامتعا،دنرادزینهبیاضفسردآسسورپیراذگرابیمدنوش.

  63. DLL اه یراذگراب هوحن • Run-time dynamic linking (RTDL) o DLL یاربیراذگرابیناوخارف LDRLoadDLL هبهارمهمان LoadLibrary ای Thread یمدناوت دیامن. o نیادنیارفهباشمکنیلندرکایوپتساهبزجهکنآیدرزا IAT طوبرمهبسسورپیقاب DLL رد یمندنام. • Injections o DLL اهیمدنناوتهبتروصیرابجاردسسورپدصقمقیرزتدنوش.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend