5985,5986 - Pentesting WinRM
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-7ebaebfa37dac753bd916c91429befb49dfd6309%252Fimage%2520%28380%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6cb17359&sv=1)
Join HackenProof Discord server to communicate with experienced hackers and bug bounty hunters!
Hacking Insights Engage with content that delves into the thrill and challenges of hacking
Real-Time Hack News Keep up-to-date with fast-paced hacking world through real-time news and insights
Latest Announcements Stay informed with the newest bug bounties launching and crucial platform updates
Join us on Discord and start collaborating with top hackers today!
WinRM
Windows Remote Management (WinRM) inasisitizwa kama protokali na Microsoft inayowezesha usimamizi wa mbali wa mifumo ya Windows kupitia HTTP(S), ikitumia SOAP katika mchakato. Kimsingi inasukumwa na WMI, ikijitokeza kama kiolesura cha HTTP kwa shughuli za WMI.
Uwepo wa WinRM kwenye mashine unaruhusu usimamizi wa mbali kwa urahisi kupitia PowerShell, kama vile SSH inavyofanya kwa mifumo mingine ya uendeshaji. Ili kubaini ikiwa WinRM inafanya kazi, inashauriwa kuangalia ufunguzi wa bandari maalum:
5985/tcp (HTTP)
5986/tcp (HTTPS)
Bandari iliyo wazi kutoka kwenye orodha hapo juu inaashiria kuwa WinRM imewekwa, hivyo kuruhusu majaribio ya kuanzisha kikao cha mbali.
Kuanzisha Kikao cha WinRM
Ili kuunda PowerShell kwa WinRM, cmdlet ya Microsoft Enable-PSRemoting
inakuja katika hatua, ikiseti kompyuta kukubali amri za PowerShell za mbali. Kwa ufikiaji wa juu wa PowerShell, amri zifuatazo zinaweza kutekelezwa ili kuwezesha kazi hii na kutaja mwenyeji yeyote kama wa kuaminika:
Hii mbinu inahusisha kuongeza wildcard kwenye usanidi wa trustedhosts
, hatua ambayo inahitaji kuzingatia kwa makini kutokana na athari zake. Pia inabainishwa kwamba kubadilisha aina ya mtandao kutoka "Public" hadi "Work" huenda ikawa muhimu kwenye mashine ya mshambuliaji.
Zaidi ya hayo, WinRM inaweza kuzinduliwa kwa mbali kwa kutumia amri ya wmic
, kama inavyoonyeshwa hapa:
Hii mbinu inaruhusu kuweka WinRM kwa mbali, ikiongeza ufanisi katika kusimamia mashine za Windows kutoka mbali.
Thibitisha ikiwa imewekwa
Ili kuthibitisha usanidi wa mashine yako ya shambulio, amri ya Test-WSMan
inatumika kuangalia ikiwa lengo lina WinRM imewekwa ipasavyo. Kwa kutekeleza amri hii, unapaswa kutarajia kupokea maelezo kuhusu toleo la itifaki na wsmid, ikionyesha usanidi uliofanikiwa. Hapa chini kuna mifano inayoonyesha matokeo yanayotarajiwa kwa lengo lililo na usanidi dhidi ya lile lisilo na usanidi:
Kwa lengo ambalo limewekwa ipasavyo, matokeo yataonekana kama ifuatavyo:
Majibu yanapaswa kuwa na habari kuhusu toleo la itifaki na wsmid, ikionyesha kwamba WinRM imewekwa vizuri.
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-d3fce77f93d92cd0daa7fb3e636cfceac16c2d31%252Fimage%2520%28582%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=da721d9f&sv=1)
Kwa upande mwingine, kwa lengo sio lililowekwa kwa WinRM, matokeo yatakuwa hakuna habari kama hizo za kina, ikionyesha ukosefu wa usanidi mzuri wa WinRM.
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-5186924e40066b6f81cae867851f6daafe064da0%252Fimage%2520%28458%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=5fb23d6c&sv=1)
Teua amri
Ili kutekeleza ipconfig
kwa mbali kwenye mashine ya lengo na kuona matokeo yake fanya:
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-0d1d720922eaffcc0079b11bf634202cdc8af410%252Fimage%2520%28151%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=a84264e1&sv=1)
Unaweza pia kutekeleza amri ya console yako ya PS ya sasa kupitia Invoke-Command. Fikiria kwamba una kazi inayoitwa enumeration kwenye kompyuta yako na unataka kuitekeleza kwenye kompyuta ya mbali, unaweza kufanya:
Teua Skripti
Pata reverse-shell
Pata kikao cha PS
Ili kupata shell ya PowerShell ya mwingiliano tumia Enter-PSSession
:
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-d3d51f20cde9de805c167dec8378026abf17333e%252Fimage%2520%281009%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=9279f378&sv=1)
Kikao kitaendesha katika mchakato mpya (wsmprovhost) ndani ya "mhasiriwa"
Kulazimisha WinRM Kufunguka
Ili kutumia PS Remoting na WinRM lakini kompyuta haijasanidiwa, unaweza kuifungua kwa:
Saving and Restoring sessions
Hii haitafanya kazi ikiwa lugha ime punguzia kwenye kompyuta ya mbali.
Ndani ya kikao hiki unaweza kupakia skripti za PS kwa kutumia Invoke-Command
Errors
Ikiwa unapata kosa lifuatalo:
enter-pssession : Kuunganisha na seva ya mbali 10.10.10.175 kumeshindikana na ujumbe wa kosa ufuatao : Mteja wa WinRM haiwezi kushughulikia ombi. Ikiwa mpango wa uthibitishaji ni tofauti na Kerberos, au ikiwa kompyuta ya mteja haijajiunga na eneo, basi usafiri wa HTTPS lazima utumike au mashine ya marudio lazima iongezwe kwenye mipangilio ya TrustedHosts. Tumia winrm.cmd kuunda mipangilio ya TrustedHosts. Kumbuka kwamba kompyuta katika orodha ya TrustedHosts zinaweza kutothibitishwa. Unaweza kupata maelezo zaidi kuhusu hilo kwa kuendesha amri ifuatayo: winrm help config. Kwa maelezo zaidi, angalia mada ya msaada ya about_Remote_Troubleshooting.
Jaribu kwenye mteja (habari kutoka hapa):
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-7ebaebfa37dac753bd916c91429befb49dfd6309%252Fimage%2520%28380%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6cb17359&sv=1)
Jiunge na HackenProof Discord server ili kuwasiliana na hackers wenye uzoefu na wawindaji wa bug bounty!
Uelewa wa Hacking Shiriki na maudhui yanayochunguza msisimko na changamoto za hacking
Habari za Hack kwa Wakati Halisi Endelea kuwa na habari kuhusu ulimwengu wa hacking kwa kupitia habari na uelewa wa wakati halisi
Matangazo Mapya Baki na habari kuhusu bug bounties mpya zinazozinduliwa na masasisho muhimu ya jukwaa
Jiunge nasi kwenye Discord na uanze kushirikiana na hackers bora leo!
WinRM connection in linux
Brute Force
Kuwa makini, brute-forcing winrm kunaweza kuzuia watumiaji.
Kutumia evil-winrm
Soma nyaraka zake kwenye github: https://github.com/Hackplayers/evil-winrm
Ili kutumia evil-winrm kuungana na anwani ya IPv6, tengeneza kipengee ndani ya /etc/hosts kuweka jina la kikoa kwa anwani ya IPv6 na uungane na kikoa hicho.
Pita hash na evil-winrm
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-937cc6771c5267730a5e18e6637acca4ba1be502%252Fimage%2520%28680%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=8100d286&sv=1)
Kutumia mashine ya PS-docker
Kutumia skripti ya ruby
Msimbo umetolewa hapa: https://alamot.github.io/winrm_shell/
Shodan
port:5985 Microsoft-HTTPAPI
Marejeo
HackTricks Amri za Otomatiki
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-7ebaebfa37dac753bd916c91429befb49dfd6309%252Fimage%2520%28380%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6cb17359&sv=1)
Jiunge na HackenProof Discord server ili kuwasiliana na hackers wenye uzoefu na wawindaji wa makosa!
Maoni ya Udukuzi Shiriki na maudhui yanayochunguza msisimko na changamoto za udukuzi
Habari za Udukuzi za Wakati Halisi Endelea kuwa na habari kuhusu ulimwengu wa udukuzi kwa kupitia habari na maoni ya wakati halisi
Matangazo Mapya Baki na habari kuhusu makosa mapya yanayoanzishwa na masasisho muhimu ya jukwaa
Jiunge nasi kwenye Discord na uanze kushirikiana na hackers bora leo!
Jifunze na fanya mazoezi ya Udukuzi wa AWS:HackTricks Training AWS Red Team Expert (ARTE)
Jifunze na fanya mazoezi ya Udukuzi wa GCP:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated