
مختبر Flask تعليمي يحاكي تجاوز المصادقة CVE-2026-76460، مع أوضاع الثغرة والآمن والمشدد بالإضافة إلى نص استغلال PoC وأداة اختبار الاختراق.
يوضح هذا المشروع سيناريو محاكاة لتجاوز المصادقة مستوحى من CVE-2026-76460. المختبر تعليمي وآمن عن قصد: فهو عبارة عن واجهة Flask API محلية تحاكي السلوك الثغرة والسلوك المُصحَّح دون استهداف أنظمة حقيقية.
يوضح التطبيق كيف يمكن كشف واجهة إدارة ذات صلاحيات دون ضوابط مصادقة، وكيف تمنع التنفيذات الآمنة الوصول غير المُصادَق عليه.
flowchart LR
Client[Local client or test harness] --> Entry[app.py]
Entry --> Factory[security_lab.factory]
Factory --> Mode{Lab mode}
Mode -->|vulnerable| Open[Management users endpoint\nallows anonymous access]
Mode -->|secure| Bearer[Bearer token validation]
Mode -->|secure-strict| Admin[Bearer token + admin role]
Bearer --> Result[200 or 401 response]
Admin --> Result2[200, 401, or 403 response]
Open --> Result3[200 response with warning]
Factory --> Audit[Audit logger]
Audit --> Log[audit.log].
├── app.py # entry point for the local lab
├── build.sh # creates the venv, installs dependencies, and runs checks
├── run.sh # starts the vulnerable app locally
├── pyproject.toml # project metadata and tool configuration
├── gunicorn.conf.py # deployment configuration for a production-style server
├── src/
│ └── security_lab/
│ ├── __init__.py
│ ├── config.py # lab settings and valid tokens
│ ├── audit.py # file-based audit logger
│ └── factory.py # Flask routes and auth logic
├── tests/
│ └── test_api.py # regression tests for vulnerable and secure modes
├── exploit.py # proof-of-concept route attack script
├── pentest_harness.py # CLI verification helper
├── BUILD_GUIDE.md # build and OS details
├── WALKTHROUGH.md # step-by-step lab walkthrough
├── SECURITY_REPORT.md # summary of the mock vulnerability and fix
├── CONTRIBUTING.md # contribution workflow
├── LICENSE # MIT license
├── requirements.txt # pinned dependencies
├── .env.example # sample environment configuration
└── .github/workflows/
└── python-tests.yml # CI validation for push and pull requests
chmod +x build.sh run.sh
./build.sh
./run.sh
ثم اختبره باستخدام:
curl -i http://127.0.0.1:5000/api/management/users
$ curl -i http://127.0.0.1:5000/api/management/users
HTTP/1.1 200 OK
Content-Type: application/json
{
"users": [
{"id": 1, "username": "admin", "role": "super-admin"},
{"id": 2, "username": "operator", "role": "operator"}
],
"warning": "unauthenticated access allowed"
}
source .venv/bin/activate
python exploit.py --host 127.0.0.1 --port 5000
source .venv/bin/activate
python pentest_harness.py --mode vulnerable
python pentest_harness.py --mode secure
python pentest_harness.py --mode secure-strict
/api/management/users.403.make lint
make test
كل عملية push وطلب سحب يستهدف main يشغّل Ruff ومجموعة اختبارات pytest على إصدارات Python المدعومة. يتم إنشاء إصدار عن طريق دفع وسم إصدار بعد نجاح تلك الفحوصات:
git tag v0.1.0
git push origin v0.1.0
ينشئ سير عمل الوسم إصدار GitHub مع ملاحظات إصدار مُولَّدة. الإصدارات مخصصة لمصدر المختبر التعليمي والتوثيق؛ لا تقم بتغليف مواد استغلال حقيقية لأنظمة مستهدفة.
هذه بيئة مختبر خاضعة للتحكم للاختبار والتعلم والبحث الدفاعي فقط. يجب عدم استخدامها ضد أنظمة حقيقية دون تصريح.