做网站类网站费用,北京搬家公司24小时服务电话,wordpress登陆慢,成都网络推广外包公司哪家好0x00前言#xff1a; 昨天刚刚看完小迪老师的sql注入篇的第一章 所以有了新的笔记。 0x01笔记#xff1a; sql注入原理#xff1a;
网站数据传输中#xff0c;接受变量传递的值未进行过滤#xff0c;导致直接带入数据库查询执行的操作。
sql注入对渗透的作用#xff1a;
…0x00前言 昨天刚刚看完小迪老师的sql注入篇的第一章 所以有了新的笔记。 0x01笔记 sql注入原理
网站数据传输中接受变量传递的值未进行过滤导致直接带入数据库查询执行的操作。
sql注入对渗透的作用
获取数据
sql注入特性
攻击方法由数据库类型决定
攻击结果由数据库决定漏洞代码
sql.php
?php
$id$_GET[x];
$sqlselect * from news where id$x;
还没完
?当我们在网页执行访问了
http://127.0.0.1/sql.php?x1
在数据库其实是这样的
$id1
select * from news where id1 注入语句http://127.0.0.1/sql.php?x1 and 11 真
select * from news where id1 and 11
返回正常页面http://127.0.0.1/sql.php?x1 and 12 假
select * from news whsere id1 and 12
返回错误页面and or xor
且 或 非
sql语句中逻辑运算符
and 11 真且真真
or 12 真或假真
and 12 真且假假sql注入拓展深入部分
sql注入能调用数据库作的动作例如文件读写调用执行等php一些sql的函数
mysql_connect(); mysql连接函数
mysql_select_db(); 选择对应数据库
mysql_query(); mysql执行函数sql注入产生的必备条件
1.变量接受 判断变量是否接受了打开一个有id的站修改id看看页面会不会变化如果变化了就代表变量接受。如果没变化就代表变量不接受。2.带入数据库查询执行 判断是否带入数据库查询执行打开一个有id的站修改id看看页面会不会变化如果变化了就代表带入了数据查询执行。如果没变化是没带入数据库查询执行的也就是说页面是不会变动的。3.不存在过滤可尝试绕过题目
1.请从下面站点地址选择可能存在注入的选项BCD1. www.dikesec.com/news.php2. www.dikesec.com/news.php?id13. www.dikesec.com/news.php?id1page24. www.dikesec.com/login.php注入代码前面必须空一个格
2.参数page存在注入请问下面注入测试正确的是AC
A.www.dikesec.com/news.php?id1page1 and 11
B. www.dikesec.com/news.php?page1id1 and 11
C. www.dikesec.com/news.php?page1 and 11 id1www.dikesec.com/news.php?page1id1 如果page是注入点
就要在page后面空一格加注入代码而不是在后面加在我们放入sqlmap进行sql扫描的的时候必须理清楚哪里是注入点如果page是注入点的话我们得这样
www.dikesec.com/news.php?id1page1
这样就可以放到工具里扫了例子
http://www.gdgy33.com/page.php?id150aid3bid1
假设id存在注入我们得移到后面去变成这样子
http://www.gdgy33.com/page.php?bid1aid3id150
不会影响页面的post注入
假设有个表单让你进行注入。因为表单的条件方式都是POST。在表单里输入恶意代码也会产生注入点cookie注入
把恶意代码带到cookie后面。0x02初步: 今天是我们学习sql注入的第一天就先写判断注入的脚本吧。后面慢慢加上去 import requestsimport socketimport timelogo ___-_ _-___ _--^^^#####// \\#####^^^--_ _-^##########// ( ) \\##########^-_ -############// |\^^/| \\############- _/############// (::) \\############\_ /#############(( \\// ))#############\ -###############\\ (oo) //###############- -#################\\ / VV \ //#################- -###################\\/ \//###################- _#/|##########/\######( /\ )######/\##########|\#_ |/ |#/\#/\#/\/ \#/\##\ | | /##/\#/ \/\#/\#/\#| \| |/ V V V \#\| | | |/#/ V V V \| / | | | | \ ( | | | | ) __\ | | | | /__ (vvv(VVV)(VVV)vvv)print(logo)def sql(): global url urlinput([^]Please enter the URL that needs test injection).lower() if url !None: time.sleep(0.5) header{User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36} print([1]GET) print([2]POST) lwdinput([^]Please enter what kind of method you want to ask for) if lwd1: rrequests.get(url,header) statusr.status_code if status 200: print(\033[1;32;40m) print([^]Link stability) print(\033[0m) else: print(\033[1;31;40m) print([~]State code,status) print([^]Response code) print(\033[0m) exit() elif lwd2: rrequests.post(url,header) statusr.status_code if status 200: print(\033[1;32;40m) print([^]Link stability) print(\033[0m) else: print(\033[1;31;40m) print([~]State code, status) print([^]Response code) print(\033[0m) exit() else: print([~]Not Found) exit()sql()def zhuru(): headers{User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36} url1url%20and%2011 url2url%20and%2012 zhusxrequests.get(url,headers).content zhusrequests.get(url1,headers).content zhussrequests.get(url2,headers).content if zhusx zhus and zhusx !zhuss: print([^]Discovery of injection point) else: print([~]No injection point was found) exit()zhuru() 运行截图 转载于:https://www.cnblogs.com/haq5201314/p/8595441.html