FortiGate Hardening & Audit Lab

← All projects← كل المشاريع
// Security · FortiGate Hardening// الأمن · تحصين FortiGate

FortiGate Hardening & Audit Lab

A hands-on EVE-NG lab simulating a small-business network behind a FortiGate NGFW. It starts deliberately vulnerable, gets hardened step by step, then the hardening is proven, not just claimed, with an automated verification script and a self-built Mini-SIEM that detects and alerts on live attacks.مختبر عملي مبني على EVE-NG يحاكي شبكة شركة صغيرة خلف جدار حماية FortiGate. يبدأ المختبر بثغرات حقيقية مقصودة، ثم يتم تحصينه خطوة بخطوة، وأخيرًا يتم إثبات التحصين فعليًا (لا بالكلام فقط) عبر سكربت تحقق آلي، ونظام Mini-SIEM مبني يدويًا يكتشف الهجمات الحية وينبه عنها.

100%100%Hardening scoreنسبة التحصين
5/55/5Automated checksالفحوصات الآلية
Detectedتم الاكتشافLive SIEM alertتنبيه SIEM حي
55Nodes in the labعدد الأجهزة
// overview// نظرة عامة

Break it, harden it, then prove itاخترقه، حصّنه، ثم أثبت التحصين

FortiGate NGFW segmenting a WAN (attacker) zone from an internal LAN hosting a Windows Server target, a Kali attack box, and syslog-01, a dedicated node later rebuilt into a centralized logging & Mini-SIEM server.جدار حماية FortiGate يفصل بين منطقة WAN (المهاجم) والشبكة الداخلية LAN التي تحتوي على سيرفر Windows كهدف، وجهاز Kali للهجوم، وجهاز syslog-01 الذي تم تطويره لاحقًا ليكون سيرفر تسجيل مركزي ونظام Mini-SIEM.

Platformالمنصة
EVE-NG
Firewallجدار الحماية
FortiGate NGFW
Firmwareالنسخة
FortiOS 8.0.1
Zonesالمناطق
WAN (attacker) · LANWAN (المهاجم) · LAN
LAN hostsأجهزة LAN
Windows Server target, Kali attack box, syslog-01سيرفر Windows (الهدف)، وجهاز Kali للهجوم، وsyslog-01
Verificationالتحقق
Python script (lab_report.py) + Mini-SIEMسكربت Python ‏(lab_report.py) مع Mini-SIEM
// topology// الطوبولوجيا

Lab topologyمخطط المختبر

Lab topology diagram
Full EVE-NG network layout for the lab.مخطط الشبكة الكامل للمختبر في EVE-NG.
// before hardening// قبل التحصين

Vulnerabilities foundالثغرات المكتشفة

Default configuration: unencrypted admin access, a weak local password, and no logging. All of it was exploited to gain full SYSTEM-level remote code execution on the internal server.إعدادات افتراضية غير محصنة: وصول إداري غير مشفر، كلمة مرور ضعيفة، وعدم وجود أي تسجيل للأحداث — كلها تم استغلالها للحصول على تنفيذ أوامر عن بعد بصلاحيات SYSTEM الكاملة على السيرفر الداخلي.

Unencrypted HTTP admin login page
Unencrypted admin login: the admin GUI is reachable over plain HTTP, so credentials travel in clear text.تسجيل دخول غير مشفر: واجهة الإدارة متاحة عبر HTTP العادي — بيانات الدخول تنتقل بدون تشفير.
NetExec cracking weak SMB password
Weak password cracked: NetExec brute-forces SMB and authenticates with a weak password (Pwn3d!), with SMB signing disabled.تم كسر كلمة مرور ضعيفة: أداة NetExec تنجح في تخمين كلمة مرور ضعيفة عبر SMB (Pwn3d!) مع تعطيل SMB signing.
Remote code execution as NT AUTHORITY SYSTEM
Full RCE: cracked credentials used to execute commands remotely as nt authority\system, a full compromise.تنفيذ أوامر كامل: استخدام بيانات الدخول المسروقة لتنفيذ أوامر عن بعد بصلاحية nt authority\system — اختراق كامل للسيرفر.
// after: network// بعد: الشبكة

Network hardeningتحصين الشبكة

Firewall policy rebuilt around least privilege: only required services allowed, everything else blocked and logged, with full visibility into traffic.تم إعادة بناء سياسة جدار الحماية على مبدأ أقل الصلاحيات: فقط الخدمات المطلوبة مسموحة، وكل ما عداها محظور ويُسجَّل، مع رؤية كاملة على حركة المرور.

Cross-zone ping blocked
ICMP blocked: ping from WAN to LAN now fails, with 100% packet loss as expected.حظر ICMP: الـ ping من WAN إلى LAN يفشل الآن بالكامل، كما هو متوقع.
Nmap shows only allowed ports
Port exposure reduced: the Nmap scan now shows only the explicitly allowed service(s), everything else filtered.تقليل المنافذ المكشوفة: فحص Nmap الآن لا يظهر إلا الخدمات المسموحة فقط — كل شيء آخر مرشّح (filtered).
Forward traffic log populated
Logging enabled: the Forward Traffic log now records every session, where it was empty by default.تفعيل التسجيل: سجل Forward Traffic أصبح يسجل كل جلسة — كان فارغًا تمامًا في الوضع الافتراضي.
Old exploit path blocked
Exploit path closed: the original attack path used to gain access is no longer usable.إغلاق مسار الاستغلال: مسار الهجوم الأصلي الذي تم استخدامه للوصول لم يعد ممكنًا.
// after: identity// بعد: الهوية

Identity & access hardeningتحصين الهوية والوصول

Password rotated to a strong value, SMB signing enforced, and MFA enabled on the admin account. This closes the credential-based attack path while legitimate access keeps working.تم تغيير كلمة المرور لأخرى قوية، وفرض SMB signing، وتفعيل المصادقة الثنائية (MFA) على حساب الإدارة — لإغلاق ثغرة بيانات الدخول مع بقاء الوصول الشرعي يعمل بشكل طبيعي.

MFA / 2FA enabled on admin account
MFA enabled: two-factor authentication is now required for admin login.تفعيل المصادقة الثنائية: أصبحت المصادقة الثنائية مطلوبة لتسجيل دخول الإدارة.
Additional hardening setting applied
Additional hardening: a supplementary identity and access control applied during the hardening pass.إجراء تحصين إضافي: إجراء إضافي لحماية الهوية والوصول ضمن مرحلة التحصين.
Old password rejected after identity hardening
Old credentials rejected: the previously cracked password now fails, with SMB signing enforced (signing:True).رفض بيانات الدخول القديمة: كلمة المرور المسروقة سابقًا لم تعد تعمل — تم فرض SMB signing (signing:True).
Legitimate access still works with the new strong password
Legitimate access preserved: the new strong password still authenticates, so the hardening did not break legitimate use.بقاء الوصول الشرعي: كلمة المرور الجديدة القوية لا تزال تعمل بنجاح — التحصين لم يكسر الاستخدام الشرعي.
// after: remote access// بعد: الوصول عن بعد

Secure remote access (VPN)الوصول عن بعد الآمن (VPN)

Instead of exposing management directly to the internet, a dialup L2TP-over-IPsec VPN tunnel was configured so admins can reach the network securely without opening WAN ports.بدلاً من كشف إدارة الجهاز مباشرة على الإنترنت، تم إعداد نفق VPN من نوع L2TP over IPsec ليتمكن المسؤولون من الوصول للشبكة بأمان بدون فتح منافذ على WAN.

VPN tunnel configured in the FortiGate GUI
VPN tunnel created: a dialup L2TP/IPsec tunnel bound to the WAN interface, ready for remote admin access.إنشاء نفق VPN: نفق L2TP/IPsec مرتبط بواجهة WAN، جاهز للوصول الإداري عن بعد.
VPN phase1/phase2 configuration detail
Tunnel detail: Phase 1 and Phase 2 IPsec parameters (AES-256, SHA, DH groups) verified via CLI.تفاصيل إعدادات النفق: معاملات IPsec للمرحلتين الأولى والثانية (AES-256, SHA, DH) تم التحقق منها عبر CLI.
// after: wan access// بعد: الوصول من WAN

WAN management access blockedحظر الإدارة من WAN

Direct administrative access from the WAN interface is now completely blocked. The only way in is through the VPN tunnel above.الوصول الإداري المباشر من واجهة WAN أصبح محظورًا بالكامل — المسار الوحيد المتاح هو عبر نفق VPN أعلاه.

WAN admin access blocked
Connection blocked: opening the admin GUI directly on the WAN IP times out, with no response at all.الاتصال محظور: محاولة فتح واجهة الإدارة مباشرة عبر IP الخاص بـ WAN تنتهي بمهلة زمنية — بدون أي استجابة.
// proof// الإثبات

Automated verificationالتحقق الآلي

A custom Python script (lab_report.py) re-runs every attack and access check automatically and generates an HTML scorecard, so the hardening is proven objectively, not just described.سكربت بايثون مخصص (lab_report.py) يعيد تشغيل كل اختبارات الاختراق والوصول تلقائيًا، ويولّد تقرير HTML حي بالنتائج — ليكون التحصين مثبتًا فعليًا لا موصوفًا فقط.

Automated report top, 100% score
Scorecard: hardening score 100%, 5/5 tests passed.بطاقة النتائج: نسبة التحصين 100% — نجاح 5 من 5 اختبارات.
Automated report middle, port scan and old password tests
Detailed results: the port scan and old-password re-attack tests are both HARDENED.النتائج التفصيلية: اختبار فحص المنافذ وإعادة محاولة كلمة المرور القديمة — كلاهما محصّن (HARDENED).
Automated report bottom, new password and WAN access tests
Final checks: legitimate access with the new password still succeeds, and direct WAN admin access stays blocked.الفحوصات الأخيرة: الوصول الشرعي بكلمة المرور الجديدة لا يزال ناجحًا، والوصول المباشر من WAN يبقى محظورًا.
// added capability// قدرة إضافية

Mini-SIEM: live threat detectionMini-SIEM: كشف التهديدات الحي

A previously idle lab node was turned into a centralized logging and detection server. FortiGate forwards syslog over rsyslog, a Python detection engine scans new events every 5 minutes via cron, and a daily HTML report summarizes the day’s traffic and alerts. A real SMB brute-force scan against the server was detected and alerted on.تم تحويل جهاز كان غير مستخدم في المختبر إلى سيرفر تسجيل مركزي وكشف تهديدات: FortiGate يرسل سجلاته عبر rsyslog، ومحرك كشف مبني بلغة بايثون يفحص الأحداث الجديدة كل 5 دقائق عبر cron، وتقرير HTML يومي يلخّص حركة المرور والتنبيهات. تم اكتشاف محاولة فحص SMB حقيقية (brute-force) ضد السيرفر والتنبيه عنها بنجاح.

SIEM daily report top, alert triggered
Alert triggered: an SMB_BRUTE_FORCE_SUSPECT alert was raised after an SMB port scan exceeded the detection threshold.تم إطلاق التنبيه: تنبيه SMB_BRUTE_FORCE_SUSPECT تم إطلاقه بعد تجاوز فحص منفذ SMB للحد المسموح.
SIEM daily report bottom, top source IPs and ports
Daily traffic summary: top source IPs and destination ports collected automatically from centralized logs.ملخص الحركة اليومي: أعلى عناوين IP المصدر والمنافذ المستهدفة تم جمعها تلقائيًا من السجلات المركزية.
// takeaways// الخلاصة

What this project showsما يُظهره هذا المشروع

  • Hardening a FortiGate with least-privilege policy and full logging.تحصين FortiGate بسياسة أقل صلاحيات وتسجيل كامل.
  • Closing credential attacks with strong passwords, SMB signing and MFA.إغلاق هجمات بيانات الدخول بكلمات مرور قوية وSMB signing وMFA.
  • Replacing exposed management with an L2TP/IPsec VPN.استبدال الإدارة المكشوفة بنفق L2TP/IPsec VPN.
  • Proving controls with an automated verification script.إثبات الضوابط بسكربت تحقق آلي.
  • Building a small syslog and detection pipeline with rsyslog, Python and cron.بناء مسار صغير للسجلات والكشف بـ rsyslog وPython وcron.
FortiGate NGFWFortiOS 8.0.1EVE-NGKali LinuxNetExecNmapWindows ServerL2TP/IPsecMFArsyslogPythoncron

Want the details behind this project?تريد تفاصيل أكثر عن هذا المشروع؟

I’m happy to walk through the design, the configs and what I would change in production.يسعدني شرح التصميم والإعدادات وما الذي سأغيّره في بيئة الإنتاج.