1 730
09 أكتوبر 2025, 15:53
#include <stdio.h> #include <string.h> int main() { char buf[32]; printf("Enter pass: "); scanf("%31s", buf); if (strcmp(buf, "1234") == 0) { printf("Access granted\n"); } else { printf("Access denied\n"); } return 0; }مرحله به مرحله: فایل رو کامپایل کنید مثلا gcc test.c -o test.exe و یه نسخه کپی نگه دارید با strings test.exe نگاه کنید ببینید رشتهها مثل Enter pass: Access granted کجا هستن اینا کمک میکنن موقعیت منطقی برنامه رو حدس بزنید فایل رو توی IDA یا Ghidra باز کنید دنبال رشتههای بالا بگردید Search _ Strings و از اونجا به تابع مربوط برید معمولا رشتهها به راحتی به توابع استفاده شون لینک میشن توی دیس اسمبل دنبال strcmp یا strncmp یا هر تابع مقایسه رشتهای باشید نزدیک این فراخوانیها معمولا شرط تصمیمگیرنده cmp + jz / jne / je / jne هست نقطهای که بعد از cmp یه JE یا JNE میبینید همونجا تصمیم گیرنده است اگه شرط برقرار باشه برنامه به شاخه موفقیت میره وگرنه پیام رد میشه نکات: دنبال cmp eax, 0 یا مقایسه بازگشتی strcmp(...) == 0 باشید رشتهها بهترین نقطه شروع برای مسیردهی در باینری هستن همه اینا استاتیکه هنوز برنامه رو اجرا نکردید تمرین: خودتون کد بالا رو کامپایل کنید و توی IDA/Ghidra مسیر از رشته _ تابع cmp _ jump رو دنبال کنید Finding the license or password Check condition What are we doing? We want to find the parts of the program that check the license password, understand what functions are used and where exactly the program decides to allow or deny Simple program example for practice C :
#include <stdio.h> #include <string.h> int main() { char buf[32]; printf("Enter pass: "); scanf("%31s", buf); if (strcmp(buf, "1234") == 0) { printf("Access granted\n"); } else { printf("Access denied\n"); } return 0; }Step by step : Compile the file, e.g. gcc test.c -o test.exe and keep a copy Look at strings test.exe and see where strings like Enter pass : Access granted are. These will help you guess the logical position of the program Open the file in IDA or Ghidra and search for the above strings. Search Strings and from there go to the corresponding function. Usually strings are easily linked to the functions they use. Look for strcmp or strncmp or any string comparison function in the disassembler. Near these calls there is usually a decision-maker condition cmp + jz / jne / je / jne The point where you see a JE or JNE after cmp is the decision-maker. If the condition is true, the program goes to the success branch, otherwise the message is rejected. Tips : Look for cmp eax, 0 or the recursive comparison strcmp(...) == 0 Be Strings are the best starting point for routing in binary This is all static you haven't run the program yet Exercise : Compile the above code yourself and follow the path from string cmp function jump in IDA/Ghidra

نستخدم ملفات تعريف الارتباط لتحسين تجربة التصفح لديك.
بالنقر على «قبول الكل»، فإنك توافق على سياسة استخدام ملفات تعريف الارتباط.