
أتمتة المهام المتكررة للاختبار بالتغذية العشوائية (Fuzzing).
أعيد كتابة الأداة بالكامل في الوقت الحالي. سيكون التركيز على تطبيقات لينكس التفاعلية التي تأخذ مدخلات فقط من stdin كبداية. محاولة استخدام وظائف Driller و Fuzzer من Shellphish.
autoPwn في حالته الحالية سيقوم بهذا بشكل محدود. ما عليك سوى تشغيل autoPwn ./binary ثم اختيار خيار البدء.
نظرًا لجميع مشاكل التبعية هنا، أسهل طريقة لتشغيل autoPwn هي استخدام بناء Docker. ملاحظة: يمكنك إزالة عبارة --security-opt و --cap-add، لكن بعض جوانب الفازنغ قد لا تعمل.
$ sudo docker pull bannsec/autoPwn
$ sudo docker run -it -v $PWD:/mount --security-opt="apparmor=unconfined" --cap-add=SYS_PTRACE -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ bannsec/autopwn
في بناء Docker، يجب أن يكون كل شيء جاهزًا. يمكنك ببساطة تشغيل الأداة باستخدام:
$ autoPwn ./file
تحاول autoPwn جعل تجميع المصدر لمشروع فازنغ أسهل. للمساعدة في ذلك، تم إنشاء autoPwnCompile. فقط وجّهها إلى الكود المصدري الخاص بك، وأعطها الخيارات وستخرج ملفًا تنفيذيًا جاهزًا للفازنغ.
usage: autoPwnCompile [-h] [--file FILE] [--ASAN | --MSAN] [--UBSAN]
[--fuzzer FUZZER]
Compile source to binaries for use in autoPwn.
optional arguments:
-h, --help show this help message and exit
--file FILE Single file to compile.
--ASAN Enable ASAN (default off)
--MSAN Enable MSAN (default off)
--UBSAN Enable UBSAN (default off)
--fuzzer FUZZER (optional) What fuzzer to compile for. Options are:
['AFL']. Default is AFL.
ما يلي من الإصدار القديم من autoPwn..
autoPwn هو اسم طموح لسكريبت بسيط. أثناء العمل مع الفازنغ و afl-fuzz، لاحظت أنني أقوم بنفس المهام مرارًا وتكرارًا. مع وضع ذلك في الاعتبار، أردت إنشاء سكريبت يحقق ما يلي:
حتى الآن، السكريبت قادر على تحقيق أول 5 نقاط. الجزء 6 تخميني ويجري تطويره الآن. سيعتمد على محرك التنفيذ الرمزي angr لإنشاء مسارات أولية ممكنة. عندئذ، يمكن للسكريبت نظريًا أتمتة مهام الفازنغ البسيطة بالكامل.
لنلق نظرة على تحدي TUCTF مؤخرًا يسمى "WoO2". على الرغم من أنه لا يجد بالضرورة الاستغلال المطلوب، إلا أنه يوضح كيف يمكن استخدام autoPwn لتبسيط اكتشاف المسار.
إليك تشغيل أساسي للبرنامج:
$ ./e67eb287f23011a40ef5bd5c2ad2f48ca97834cf
Welcome! I don't think we're in Kansas anymore.
We're about to head off on an adventure!
Select some animals you want to bring along.
Menu Options:
1: Bring a lion
2: Bring a tiger
3: Bring a bear
4: Delete Animal
5: Exit
Enter your choice:
1
Choose the type of lion you want:
1: Congo Lion
2: Barbary Lion
1
Enter name of lion:
Test
Menu Options:
1: Bring a lion
2: Bring a tiger
3: Bring a bear
4: Delete Animal
5: Exit
Enter your choice:
5
لننشئ حالة اختبار إدخال بسيطة:
$ cat in/1
1
1
Test
5
الآن يمكننا بدء الفازر بسهولة:
$ autoPwn
Setting up fuzz configuration
Target Binary (full or relative path): e67eb287f23011a40ef5bd5c2ad2f48ca97834cf
Command line args:
Number of cores (default: 8):
Test Case Dir (default: 'in/'):
Test Case Dir (default: 'out/'):
Max memory (default: 200): 4096
Starting fuzz
autoPwn> s
status check tool for afl-fuzz by <[email protected]>
Individual fuzzers
==================
>>> SESSION007 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION000 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION002 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION006 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION004 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION001 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION005 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
>>> SESSION003 (0 days, 0 hrs) <<<
cycle 1, lifetime speed 1 execs/sec, path 0/1 (0%)
pending 1/1, coverage 0.15%, no crashes yet
Summary stats
=============
Fuzzers alive : 8
Total run time : 0 days, 0 hours
Total execs : 0 million
Cumulative speed : 8 execs/sec
Pending paths : 8 faves, 8 total
Pending per fuzzer : 1 faves, 1 total (on average)
Crashes found : 0 locally unique
autoPwn> h
autoPwn
s == fuzzer (s)tatus
e == collect (e)xploits
a == collect (a)ll paths
m == (m)inimize corpus
q == (q)uit
ما حدث هنا هو أن السكريبت أنشأ بعض القيم الافتراضية (بما في ذلك تحديد عدد النوى المتاحة). قمنا بتغيير قيمة افتراضية واحدة بسبب الحاجة إلى ذاكرة إضافية لتشغيل هذا في QEMU. أنشأ autoPwn ملف تهيئة ثم أعطاه إلى afl-utils (https://github.com/rc0r/afl-utils). في ملف التهيئة، قام أيضًا بإعداد تقارب وحدة المعالجة المركزية (CPU affinities)، بحيث يكون الفازنغ مثاليًا افتراضيًا.
عند هذه النقطة، جهاز الكمبيوتر الخاص بك يعمل بجد في الفازنغ. ومع ذلك، أحد الجوانب الرئيسية للفازنغ هو تصغير المجموعة (corpus). مع وضع ذلك في الاعتبار، يقوم autoPwn بمراقبة مثيل afl-fuzz لمراقبة وقت اكتمال سلسلة من الطفرات. عندما يحدث ذلك، سيتوقف عن الفازنغ (غير مثالي، لكنه جيد الآن)، ويصغر المجموعة، ثم يعيد تشغيل الفازنغ. يفعل ذلك دون أي تدخل بشري حتى تتمكن من التشغيل والنسيان.
في وقت ما قد ترغب في إلقاء نظرة على المسارات التي وجدها afl. بتنفيذ الأمر "a"، سيقوم autoPwn بنسخ جميع المسارات المعروفة، وتصغير المجموعة ثم تصغير الحالات نفسها وتوفيرها في دليل إخراج.