فهم مهرب الأرض من شركة ويندوز للهندسة العكسية

ولا تزال هندسة النوافذ العكسية من الانضباط الحرج لكشف مواطن الضعف في البرامجيات، وكشف البرمجيات المضللة، وتحليل بروتوكولات الملكية، وفهم الإرث أو البرامج غير الموثقة.() وهناك اثنان من أكثر الأدوات المستخدمة في النظام الإيكولوجي في ويندوز() [(FLT:0)]([أ)([تعنيهما:

(أنظر إلى (أولي ديبغ

Origins and Philosophy

وقد حظي أولديدبغ، الذي أنشأه أوله يوشوك، بالشعبية في أوائل العقد الأول من القرن الماضي، بوصفه خائناً خفيفاً من الوزن، وسهل الاستعمال من حيث الحشد، وبالرغم من كونه محدوداً بـ 32 عملية تنفيذية، فإنه يظل ملائماً لتحليل تطبيقات النافذة القديمة، والعديد من العينات التي تم جمعها من أجل عام 1986، والبرامجيات التي لا تشمل 64 عملية بناء كاملة.

التركيب والإنشاء الأولي

(ب) تحميل أولليدبغ من موقعه الرسمي (ollydbg.de) والحزمة قابلة للتنفيذ - لا حاجة إليها من غير المسلّم - مما يجعل من السهل نقلها، ولأفضل النتائج، تشغيل أولديبغ على بيئة من الرياح المدارية 32 أو على نظام من نوع 64 مبت يدعم WOW64؛ وتذكر أن عمليات أولديبغ نفسها.

الخطوات الرئيسية للتشكيل بعد إطلاق:

  • Go to ]Options ⁇ Appearance and set fonts and colours to your preference — high contrast schemes help reduce eye strain during long sessions.
  • Under Options ⁇ Debugging Options, enable “Pause on breakpoint” and consider disabling “Ignore INT3” if you plan to use custom breakpoints.
  • Configure the Memory Map] colours to quickly spot executable, writable, or heap regions.
  • إجراء اختبار قابل للتنفيذ (مثلاً، إعداد " عالم الهالوجين " بسيط للتحقق من المفكك وتسجيل المقلاة بشكل صحيح.

ممر عبر الوجه المستخدم

وتتألف واجهة أولليدبغ من عدة سراويل يمكن إعادة ترتيبها عن طريق الجر والغطاء المعطل، وتشمل مخططات التخلف ما يلي:

  • Disassembly window (top left):] shows the disassembled code with addresses, bytes, mnemonics, and comments.
  • Registers window (top right):] Displays CPU register content (EAX, EBX, ECX, EDX, ESP, EBP, EIP, flags) Each register updates live as you step.
  • Dump window (bottom left): Hexadecimal and ASCII view of memory at a selected address. you can change the base address by right —clicking and choose “Go to”.
  • Stack window (bottom right):] shows the current stack frames, return addresses, and local variables.

وهذه المقلاة مترابطة: إذ إن نقرة عنوان في نافذة النفايات تستكمل فوراً المفارقة إذا كانت منطقة الذاكرة تحتوي على رمز.

Essential Breakpoint Types

ويدعم أوليدبغ آليات متعددة لكسر النقاط:

  • نقطة انطلاق (F2): INT3:[F2] Software breakpoint that replaces an instruction byte with 0xCC. simpleple, but detectable by anti-debugging code.
  • Memory breakpoint:] Set on a memory region (executable, write, or read) by right —clicking in the dump or memory map. Useful for catching when a specific data buffer is accessed.
  • Hardware breakpoint:] Invoked via Debug ⁇ hardware breakpoints.]. Uses CPU debug registers (DR0DR3). harder to detect than INT3, but limited to four concur breakpoints.
  • Conditional breakpoint:] An INT3 breakpoint combined with a Win32 message box or a logging condition (e.g., “break when EAX 0”). Accessible by right —clicking a line and selecting “Breakpoint ⁇ Conditional”.

قانون الملاحة مع أوليدبغ

Use the F7] key to step into a call, F8 to step over, and F9 to run until the next breakpoint. The “Run trace” feature (Deb

والقائمة " البحث عن " هي مساعد قوي:

  • Search for ⁇ Command:] Locate a specific assembly mnemonic (e.g., “CALL”) across the entire module.
  • Search for ⁇ Sequence of bytes:] Find patterns in the binary, like a particular string or signature.
  • Search for ⁇ All referenced strings:] Quickly extract all readable ASCII and Unicode strings used by the program.

Plugin Ecosystem

وتعوض قدرة أوليدبغ على إطفاء العقوبة عن عدم تحديثها، وتشمل المزلاجات البارزة ما يلي:

  • OllyDump:] Dump a running process’s memory to disk for static analysis or patching.
  • HideDebugger:] Obscures OllyDbg’s presence to evadebugging checks.
  • OllyScript:] Automate repetitive tasks using a Pythonlike scripting language. For example, you can script search for patterns and setting breakpoints across multiple runs.
  • PhantOm:] Advanced stealingth plugin that fixes many common IsDebuggerPresent and NtQueryInformation PROcess detections.

ولتركيب مضرب، استخلاص ملف " د " في ملف أولدبغ " ، وإعادة تشغيل الخزان.


الماجستير X64dbg: Modern Debugging for 32 —Bit and 64Bit Targets

لماذا (إكس64دبغ) أصبح المعيار

While OllyDbg is a veteran, x‐64dbg is the goto tool for contemporary reverse engineering. It supports both 32‐bit and 64‐bit executables, has an actively maintained opensource codebase (]GitHub repository)

التركيب والبدء

(أ) أن تُحمّل آخر إطلاقات من موقع X64dbg على شبكة الإنترنت ()x64dbg.com) وتشمل هذه المجموعة مركبتين إطلاق منفذتين - `32dbg.exe` لـ 32 مشغلاً من طراز ' x64dbg.exe` لـ 64 مجمّعة، وكلاهما يتشاركان في نفس التشكيلة وملفات الغلي.

وعند البدء في البدء، وضعت هذه الأفضليات الأساسية:

  • Settings ⁇ Preferences ⁇ Events:] check “Breakpoint at system breakpoint” to pause at the entry point instead of the system loader.
  • ]Appearance:] Choose a dark topic or a custom colour scheme under “Opticks” — easier on the eyes for prolonged use.
  • Disassembly:] Enable “Show byte representation” and “Show opcodes” if you want full instruction details visible at all times.
  • Undo function: ] x64dbg tracks changes to memory and registers -- you can roll back a step if you accidentally patch something.

تدفق العمل والوجه

وتنقسم نافذة الـ (X64dbg) إلى لوحات مرفوعة:

  • ]CPU Disassembly:] The main code view, with address, bytes, disassembly, and a column for comments. Right —clicking reveals a context menu rich with analysis commands: “Find references to”, “Find Xrefs”, “Assign to new NOP”, etc.
  • Registers:] shows all general — purpose registers, flags, segment registers, and floating‐point state. Colours indicate changes since the last event - green for modified, red for newly set flags.
  • Dump:] Memory hex editor that can shift between hex, text, and structure modes. Right —click an address and choose “Watch] to immediately monitor a 4‐byte value.
  • Stack:] Similar to OllyDbg, but with nicer formatting and the ability to highlight return addresses and local frames.
  • Graph view (Tab): ] Press G) على وظيفة لفتح رسم بيان تدفق المراقبة، وهذا أمر لا غنى عنه لفهم الهياكل الفرعية، والثغرات، والقفزات المشروطة في لمحة.
  • Symbols & Modules:] Lists all loaded DLLs and their export tables. You can set breakpoints on any exported function by search in the symbols tab.

نقاط الانفصال المتقدمة والتعقب

X64dbg extends breakpoint functionity beyond OllyDbg:

  • Breakpoint with conditions and hit counts:] Right —click a line ⁇ “Breakpoint” ⁇ “Edit” You can add a condition like `EAX 0x12345678' and a log message to the breakpoint log window.
  • Memory breakpoint on range:] Click “Memory Map” tab, select a region, and choose “Set memory breakpoint on access” or “on write” This is essential for tracking when a buffer is overwritten.
  • Hardware breakpoint via menu:] Navigate to Debug ⁇ hardware Breakpoints] to set up to four DRx breakpoints on read/write/execute.
  • Trace recording:] Enable Debug ⁇ Trace Record]]] to capture each instruction executed. later you can “Search for” patterns in the recorded trace — extremely useful for finding where a particular memory location is modified.

التستر والتلقائية في X64dbg

ومن بين السمات التي تنطوي عليها هذه المادة، دعمها الكبير في الكتابة:

  • Python scripting: ] The built-in Python plugin allows you to write complex functioning. For example, you can script logging all `CreateFileW ' calls with their arguments. A simple script might look like:
  • x64dbgpy:] A more extensive Python binding that gives full control: read/write memory, disassemble arbitrary bytes, manage breakpoints, and more.
  • Built-in command bar:] At the bottom of the window, you can type commands like `bp kernel32.VirtualProtect`, `dump @rsp ' or `set cond eax=5 ' , this makes quick actions possible without navigating menus.

الرمز والتكامل على مستوى المصدر

(ب) استخدام الرموز Symbols] tab to load public symbols (.pdb files) from Microsoft’s symbol server or your project. With symbols loaded, x64dbg can show function names and line numbers from the original source — bridging the gap between assembly and high-level code. Also, the [FT symbol]


مقارنة بين أولديدبغ و x64dbg: متى يستخدم كل واحد

وكلاهما قوي، ولكن أفضل حالات استخدامهما تختلف:

  • Legacy 32‐bit software:] If you are working on old applications, malformed PE files, orpacked 32‐bit binaries that drop to ring 0, OllyDbg’s grown plugin ecosystem (especially Hidebugger and OllyDump) can still be more reliable. Some older plugins like “OllyFlow"
  • 64] aims‐bit targets:] x64dbg is the only choice for 64 —bit native debugging. OllyDbg cannot even open a 64‐bit executable.
  • Scripting needs:] x64dbg’s Python integration is far more versatile than OllyScript. If your project requires parsing custom data structures or automating entire debugging sessions, x64dbg wins.
  • Memory patching:] Both allow patching, but x64dbg has a builtin “Patch” window that register all modifications and can generate a patch file file.
  • Learning curve:] OllyDbg has a shallower learning curve for beginners because of its simpler interface and fewer blues. However, x64dbg’s documentation and community are more active, so the initial investment pays quickly.

Many experienced reversers keep ]both] installed: OllyDbg for quick triage on 32‐bit samples and x64dbg for everything else.


مشروع هندسة معكوسة عملية: تعقب مسار بسيط

ولدعم المفاهيم، سنسير من خلال تحليل " مضرب " نموذجي - برنامج صغير يطلب كلمة سر، وسنستخدم ×64 كيلوغراما لهذا المشروع، ولكن نفس الخطوات تنطبق على أوليدبغ (مع اختلاف طفيف في مستوى التنفيذ).

الخطوة 1: استطلاعات الرأي

وقبل أن يطلق الخائن، يُنفذ ويُلاحظ سلوكه، ويُظهر عادة له رقماً له صندوق تحرير وزر " شيك " ، ويدخل كلمة سر مغرور مثل " الاختبار " لرؤية رسالة الخطأ ( " كلمة السر الخطأ " ).

الآن افتحي الخط قابل للتنفيذ في X64dbg. Note the entry point -- usually a call to `GetModuleHandleA ' or `WinMain ' . Scroll through the disassembly to find the string “Wrong password!” Press Ctrl+F and search for that string (or use]

.text:00401234 push offset aWrongPassword ; "Wrong password!"
.text:00401239 call ds:MessageBoxA

وعلى الأرجح أن هناك، فوق تلك الدفعة، قفزة مشروطة (مثلاً، " جين " أو " ج " ) تقرر ما هي الرسالة التي ستُعرض، وتضع نقطة انفصال على تلك التعليمة القفزية.

الخطوة 2: التحليل الديناميكي

Press F9] to run the application. Enter your dummy password and read “Check”. The debugger breaks at the jump instruction. Examine the flags: if the zero flag is set (ZF=1) the jump might go to the success message; if ZF=0, it goes to failure. Now look at the preceding `CMP ' or `TEST '

وإذا كانت المقارنة مجرد " نداء " بسيط، فيمكنك تحديد موقع المكالمة إلى " الغطاس " ورؤية حججها في نافذة الكسر، والحججتان هما المؤشران - أحدهما إلى مدخلك، والآخر إلى كلمة السر الصحيحة، ويعقّب العنوان الثاني ويختار " الفول في الدام " لرؤية كلمة السر في الذاكرة، أو، من الأفضل، أن يضع نقطة انفصال على " كلمة المرور " .

الخطوة 3: دفع المُلح

ومن الأهداف المشتركة للكسر أن تجتاز عملية التحقق من كلمة السر بالكامل، وفي القفزة المشروطة التي تؤدي إلى الرسالة الخاطئة، يمكنك تغيير الأوبرا، وتفضل أن تغلق خط القفز وتختار " التجمع " ، يستعاض عن عبارة " 0x00401234 " بعبارة " يُفتح الباب " ، وبعد التصحيح، يُظهر الاختراق الصحيح، ويختار " الاختراق الكامل " .

الخطوة 4: اختراق الحل

لو كنت تقوم بتحليل مئات من ثنائيات مماثلة يمكنك أن تجهز الشقة، فكتاب (بيتون) في (إكس 64دبغ) يمكنه أن يجد كل الإشارات إلى خط الخطأ، ويحدد أقرب قفزة مشروطة، ويستبدلها بجهاز (ن.ب.أ.م.م.م.م.م.م.م.م.م.م.م.م.


Handling Anti-Debugging Techniques

وهناك العديد من البرامج التجارية أو برامج البرمجيات التي تستخدم مضادات الديبوغل لردع التحليل، وهناك خدع مشتركة وكيفية تجاوزها مع أوليدبغ و x64dbg.

  • IsDebuggerPresent (kernel32! IsDebuggerPresent): ] The simplest check — call the API and if EAX=0, the debugger is present. Set a breakpoint on the API, and when hit, modify EAX to 0.
  • NtQueryInformationProcess (ntdll!NtQueryInformationProcess): ] More sophisticated. Patch the return value (the ProcessDebugFlags or Process DebugPort) by setting a breakpoint and modifying the structure returned.
  • Timing checks:] Code measures the time between two instructions and comparisons it with a threshold. Stepping through with a debugger introduces delay. Use equipment breakpoints and avoid stepping over time-sensitive code, or use the “Run to selection” feature to jump past the timing check.
  • INT3 detection:] Some programs scan their own code for 0xCC bytes. To evade, use equipment breakpoints exclusively ( but only four are possible). Alternatively, use x64dbg’s “Hide Debugger” plugin (builtin) and set the “Stealth options under

تحقيق أفضل تدفق عملك

إن الهندسة العكسية عملية دقيقة - وهي مسألة مكاسب الإنتاجية، والنظر في هذه النصائح:

  • استخدموا جهازاً مُخصصاً للتصوير في الهواء، وأديروا أدوات التزييف داخل آلة تصوير في "ويندوز"
  • Integrate with static analysis tools:] Complement dynamic debugging with IDA Pro, Ghidra, or Binary Ninja. Export symbols from a static disassembly and import them into x64dbg for easier navigation.
  • Comment heavily:] Both debuggers support add comments to lines of code. Use them to document your understanding of routines, arguments, and return values.
  • Log everything:] Use the logging windows in x64dbg to record breakpoint hits, register values, and memory modifications. later you can grep the log to find patterns -- for example, all calls to `WriteFile ' with handle values.
  • Leverage external resources:] websites like Woodmann.com]] archive many OllyDbg plugins and tutorials. For x64dbg, the official GitHub wiki and the ReversingLabs blog are excellent references.

خاتمة

ولا يزال الـ (أولي ديبغ) و(X64dbg) لا غنى عنه لهندسة ويندوز العكسية، فقاعدة الـ (أوللي ديبغ) التي تتسم بسلطة ونضجها تخدم بشكل جيد مشاريع الـ 32 ذات نطاق متطور، بينما يمكن أن تؤدي هياكل البرمجيات الحديثة التي تعمل بها (X64) والتي تفكك بقوة إلى جعلها أداة للاختيار للتحليل المعاصر.