الفحص بـ Nuclei
Nuclei: أداة فحص أوتوماتيك للـ web بتشتغل بـ templates مكتوبة بـ YAML، إزاي تحدّثها وتشغّلها وتفلتر بالـ severity و tags، وتقرا الـ JSON output وتفلتره بـ Python.
نص شرح المعلم والكود الذي كتبه ونتيجة تشغيله، بنفس ترتيب الدرس.
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 وفيهم خطير.
# 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.
# 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)
- 01يعني إيه ثغرة؟ ومن الـ Recon للـ Vulnerabilities
- 02CVE و CWE: أسماء الثغرات
- 03الخطورة: CVSS و EPSS و KEV
- 04البحث في NVD
- 05Exploit-DB و searchsploit
- 06GitHub و Metasploit
- 07الفحص بـ Nmap NSE
- 08الفحص بـ Nucleiانت هنا
- 09الفحص بـ Nikto
- 10الفحص بـ OpenVAS
- 11فحص بصلاحيات ومن غيرها
- 12تجميع وتنظيم النتايج
- 13False Positives والتأكد اليدوي
- 14ترتيب الأولويات
- 15أتمتة الفحص بـ Python
- 16مراجعة شاملة