rapid7/metasploit-framework — pull request #976 by nullbind (2012-10-28 18:57:06+00:00)
Title: Microsoft SQL Database Link Crawler - SQLi

This module can be used to crawl MS SQL Server database links and deploy metasploit payloads through links configured with sysadmin privileges via SQL injection. If you are attempting to obtain multiple reverse shells using this module we recommend setting the “DisablePayloadHandler” advanced option to “true”, and setting up a multi/handler to run in the background as a job to support multiple incoming shells. If you are interested in deploying payloads to spefic servers this module also supports that functionality via the “DEPLOYLIST” option. Currently, the module is capable of delivering payloads to both 32bit and 64bit Windows systems via powershell memory injection methods based on Matthew Graeber’s work . As a result, the target server must have powershell installed. By default, all of the crawl information is saved to a CSV formatted log file and MSF loot so that the tool can also be used for auditing without deploying payloads. The module supports error, union, and time based SQL injection. However, be aware that the module will not discover SQL injection for you. Below are a few basic examples of how to set the GET_PATH parameter correctly for each type of injection.

Error based syntax:
/account.asp?id=1+and+1=[SQLi];--

Union based syntax
/account.asp?id=1+union+all+select+null,[SQLi],null;--
Note: Union works most reliably if "id=1" does not return any data, i.e. use "id=12345678"

Time based syntax (blind):
/account.asp?id=1;[SQLi];--

Basic video example: http://www.youtube.com/watch?v=eCSxPC4FenQ