الفحص بـ Nuclei

جارٍ التحميل…

01 / ملخص الدرس

الفحص بـ Nuclei

Nuclei: أداة فحص أوتوماتيك للـ web بتشتغل بـ templates مكتوبة بـ YAML، إزاي تحدّثها وتشغّلها وتفلتر بالـ severity و tags، وتقرا الـ JSON output وتفلتره بـ Python.

02 / شرح الدرس مكتوبًا

نص شرح المعلم والكود الذي كتبه ونتيجة تشغيله، بنفس ترتيب الدرس.

Nmap NSE كويس، بس بطيء شوية ومجموعة الـ scripts محدودة. للـ web فيه أداة أحدث وأسرع وأشهر دلوقتي: Nuclei.

Nuclei أداة من ProjectDiscovery. بتشتغل بحاجة اسمها templates. كل template ملف YAML بيوصف إزاي تكتشف ثَغْرة معيّنة: ابعت الـ request الفلاني، ولو لقيت الرد ده يبقى vulnerable. فيه آلاف templates جاهزة من المجتمع.

الاستخدام بسيط. الأول nuclei dash update dash templates علشان تنزّل أحدث نسخة. بعدين nuclei dash u وبعده الـ target. وتقدر تفلتر: dash severity علشان تجيب الـ critical والـ high بس، أو dash tags علشان نوع معيّن.

كل finding ليه severity. info: معلومة بس، مش ثَغْرة. low و medium و high و critical. أول حاجة تعملها في النتيجة: ركّز على الـ critical والـ high، وسيب الـ info لحد ما تخلّص المهم.

نصيحة مهمة زي كل الأدوات: Nuclei بيبعت requests حقيقية للهدف. على موقع كبير ممكن يعمل حِمل، فظبّط الـ rate بـ dash rate dash limit، وما تشغّلوش على production من غير إذن مكتوب. Nuclei بيطلّع النتيجة JSON، وهنا حفظناها ومختصرناها في list. كل finding فيه الـ template dash id والـ severity والـ URL اللي اتطابق، وبنطبعهم كلهم. نشغّل… أربع findings، فيهم info وفيهم خطير.

main.py
# Saved output of: nuclei -u http://TARGET -json  (shortened, one finding per line)
findings = [
    {"template-id": "apache-detect", "severity": "info", "matched": "http://TARGET"},
    {"template-id": "CVE-2021-41773", "severity": "high", "matched": "http://TARGET/cgi-bin/"},
    {"template-id": "tech-detect", "severity": "info", "matched": "http://TARGET"},
    {"template-id": "CVE-2021-42013", "severity": "critical", "matched": "http://TARGET/cgi-bin/"},
]

for f in findings:
    print(f"{f['severity']:9} {f['template-id']:18} {f['matched']}")

المخرجات

info      apache-detect      http://TARGET
high      CVE-2021-41773     http://TARGET/cgi-bin/
info      tech-detect        http://TARGET
critical  CVE-2021-42013     http://TARGET/cgi-bin/

دورك: ركّز على المهم. اطبع الـ findings اللي الـ severity بتاعها high أو critical بس، وسيب الـ info وأي حاجة تانية.

تمرين

keep = {"high", "critical"} وبعدين جُوّه الـ loop: if f["severity"] not in keep: continue

الحل: نشغّل… اتنين بس، الـ high والـ critical.

main.py
# Saved output of: nuclei -u http://TARGET -json  (shortened, one finding per line)
findings = [
    {"template-id": "apache-detect", "severity": "info", "matched": "http://TARGET"},
    {"template-id": "CVE-2021-41773", "severity": "high", "matched": "http://TARGET/cgi-bin/"},
    {"template-id": "tech-detect", "severity": "info", "matched": "http://TARGET"},
    {"template-id": "CVE-2021-42013", "severity": "critical", "matched": "http://TARGET/cgi-bin/"},
]

keep = {"high", "critical"}
for f in findings:
    if f["severity"] not in keep:
        continue
    print(f"{f['severity']:9} {f['template-id']:18} {f['matched']}")

المخرجات

high      CVE-2021-41773     http://TARGET/cgi-bin/
critical  CVE-2021-42013     http://TARGET/cgi-bin/

Nuclei ممتاز للثغرات المعروفة بالـ templates. الدرس الجاي أداة متخصصة في الـ web servers بالذات، قديمة بس لسه مفيدة: Nikto. يلا بينا.

03 / دروس المسار (16)
  1. 01يعني إيه ثغرة؟ ومن الـ Recon للـ Vulnerabilities
  2. 02CVE و CWE: أسماء الثغرات
  3. 03الخطورة: CVSS و EPSS و KEV
  4. 04البحث في NVD
  5. 05Exploit-DB و searchsploit
  6. 06GitHub و Metasploit
  7. 07الفحص بـ Nmap NSE
  8. 08الفحص بـ Nucleiانت هنا
  9. 09الفحص بـ Nikto
  10. 10الفحص بـ OpenVAS
  11. 11فحص بصلاحيات ومن غيرها
  12. 12تجميع وتنظيم النتايج
  13. 13False Positives والتأكد اليدوي
  14. 14ترتيب الأولويات
  15. 15أتمتة الفحص بـ Python
  16. 16مراجعة شاملة