hacktricks/network-services-pentesting/pentesting-rdp.md

156 lines
8 KiB
Markdown
Raw Normal View History

# 3389 - Kupima Usalama wa RDP
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze AWS hacking kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-01-03 10:42:55 +00:00
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA USAJILI**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za kuhack kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>
<figure><img src="../.gitbook/assets/image (14).png" alt=""><figcaption></figcaption></figure>
**Mazingira yanayopatikana mara moja kwa upimaji wa udhaifu & kupenyeza**. Tekeleza pentest kamili kutoka mahali popote na zana & vipengele zaidi ya 20 vinavyoanzia uchunguzi hadi ripoti. Hatuchukui nafasi ya wapima usalama - tunatengeneza zana za desturi, moduli za ugunduzi & uchomaji ili kuwarudishia muda wa kuchimba kwa kina, kufungua mabakuli, na kufurahi.
2024-01-11 13:23:18 +00:00
{% embed url="https://pentest-tools.com/" %}
2024-02-11 02:13:58 +00:00
## Taarifa Msingi
2022-04-28 16:01:33 +00:00
Iliyoundwa na Microsoft, **Itifaki ya Desktop ya Mbali** (**RDP**) imeundwa kuruhusu uhusiano wa interface ya picha kati ya kompyuta kupitia mtandao. Ili kuanzisha uhusiano kama huo, programu ya mteja wa **RDP** hutumiwa na mtumiaji, na kwa wakati huo huo, kompyuta ya mbali inahitajika kuendesha programu ya **RDP** ya seva. Hii inaruhusu kudhibiti na kupata kwa urahisi mazingira ya desktop ya kompyuta ya mbali, ikileta interface yake kwa kifaa cha mtumiaji kwa karibu.
**Bandari ya msingi:** 3389
2022-05-01 13:25:53 +00:00
```
PORT STATE SERVICE
3389/tcp open ms-wbt-server
```
2024-02-11 02:13:58 +00:00
## Uchambuzi
2024-02-11 02:13:58 +00:00
### Kiotomatiki
{% code overflow="wrap" %}
```bash
2022-10-03 20:20:19 +00:00
nmap --script "rdp-enum-encryption or rdp-vuln-ms12-020 or rdp-ntlm-info" -p 3389 -T4 <IP>
```
{% endcode %}
Inachunguza usimbaji wa data uliopo na udhaifu wa DoS (bila kusababisha DoS kwa huduma) na kupata habari za NTLM Windows (toleo).
2022-10-03 20:20:19 +00:00
### [Brute force](../generic-methodologies-and-resources/brute-force.md#rdp)
**Jihadhari, unaweza kufunga akaunti**
2022-10-03 20:20:19 +00:00
### **Password Spraying**
**Jihadhari, unaweza kufunga akaunti**
```bash
2022-10-03 20:20:19 +00:00
# https://github.com/galkan/crowbar
crowbar -b rdp -s 192.168.220.142/32 -U users.txt -c 'password123'
# hydra
hydra -L usernames.txt -p 'password123' 192.168.2.143 rdp
```
### Unganisha na sifa/hash inayojulikana
```bash
2022-10-03 20:20:19 +00:00
rdesktop -u <username> <IP>
rdesktop -d <domain> -u <username> -p <password> <IP>
xfreerdp [/d:domain] /u:<username> /p:<password> /v:<IP>
xfreerdp [/d:domain] /u:<username> /pth:<hash> /v:<IP> #Pass the hash
```
### Angalia sifa zilizojulikana dhidi ya huduma za RDP
rdp\_check.py kutoka impacket inakuwezesha kuangalia ikiwa baadhi ya sifa ni halali kwa huduma ya RDP:
```bash
2022-10-03 20:20:19 +00:00
rdp_check <domain>/<name>:<password>@<IP>
```
<figure><img src="../.gitbook/assets/image (14).png" alt=""><figcaption></figcaption></figure>
**Mipangilio inapatikana mara moja kwa tathmini ya udhaifu & upenyezaji**. Tekeleza pentest kamili kutoka popote uendapo na zana na vipengele zaidi ya 20 vinavyoanzia uchunguzi hadi ripoti. Hatuchukui nafasi ya wapimaji wa pentest - tunatengeneza zana za desturi, ugunduzi & moduli za uchexploitation ili kuwapa muda wa kuchimba kwa kina, kufungua makompyuta, na kufurahia.
{% embed url="https://pentest-tools.com/" %}
## **Mashambulizi**
### Wizi wa Kikao
Kwa **ruhusa za SYSTEM** unaweza kupata kikao cha **RDP kilichofunguliwa na mtumiaji yeyote** bila haja ya kujua nywila ya mmiliki.
**Pata vikao vilivyofunguliwa:**
2022-05-01 13:25:53 +00:00
```
query user
```
2024-02-11 02:13:58 +00:00
**Upatikanaji wa kikao kilichochaguliwa**
```bash
tscon <ID> /dest:<SESSIONNAME>
```
2024-02-11 02:13:58 +00:00
Sasa utakuwa ndani ya kikao cha RDP kilichochaguliwa na utalazimika kujifanya kuwa mtumiaji kwa kutumia zana na vipengele vya Windows pekee.
**Muhimu**: Unapopata ufikiaji wa vikao vya RDP vilivyopo utamfukuza mtumiaji aliyekuwa akitumia.
Unaweza kupata nywila kutoka kwa mchakato wa kudumpi, lakini njia hii ni haraka sana na itakuruhusu kuingiliana na desktopi za vitu vya mtumiaji (nywila kwenye notepad bila kuokolewa kwenye diski, vikao vingine vya RDP vilivyofunguliwa kwenye mashine nyingine...)
2022-05-01 13:25:53 +00:00
#### **Mimikatz**
2024-02-11 02:13:58 +00:00
Unaweza pia kutumia mimikatz kufanya hivi:
```bash
ts::sessions #Get sessions
ts::remote /id:2 #Connect to the session
```
### Vipindi vya Sticky-keys & Utilman
Kwa kuchanganya mbinu hii na **stickykeys** au **utilman utaweza kufikia CMD ya utawala na kikao chochote cha RDP wakati wowote**
Unaweza kutafuta RDP ambazo tayari zimeingiliwa na moja ya mbinu hizi kwa kutumia: [https://github.com/linuz/Sticky-Keys-Slayer](https://github.com/linuz/Sticky-Keys-Slayer)
### Uingizaji wa Mchakato wa RDP
2022-10-03 20:20:19 +00:00
Ikiwa mtu kutoka kwenye uwanja tofauti au mwenye **mamlaka bora anajisajili kupitia RDP** kwenye PC ambapo **wewe ni Msimamizi**, unaweza **kuingiza** ishara yako katika **mchakato wake wa kikao cha RDP** na kufanya kazi kama yeye:
2022-08-16 00:18:24 +00:00
{% content-ref url="../windows-hardening/active-directory-methodology/rdp-sessions-abuse.md" %}
[rdp-sessions-abuse.md](../windows-hardening/active-directory-methodology/rdp-sessions-abuse.md)
{% endcontent-ref %}
2024-02-11 02:13:58 +00:00
### Kuongeza Mtumiaji kwenye Kikundi cha RDP
```bash
net localgroup "Remote Desktop Users" UserLoginName /add
```
2024-02-11 02:13:58 +00:00
## Zana za Kiotomatiki
* [**AutoRDPwn**](https://github.com/JoelGMSec/AutoRDPwn)
2022-10-03 20:20:19 +00:00
**AutoRDPwn** ni mfumo wa baada ya uchimbaji ulioandikwa kwa Powershell, ulioundwa kimsingi kwa ajili ya kiotomatiki cha shambulio la **Shadow** kwenye kompyuta za Microsoft Windows. Udhaifu huu (uliouorodheshwa kama kipengele na Microsoft) huruhusu mshambuliaji wa mbali **kuona desktop ya mwathiriwa wake bila idhini yake**, na hata kuudhibiti kwa mahitaji, kwa kutumia zana zilizojengwa kwenye mfumo wa uendeshaji yenyewe.
2022-10-03 20:20:19 +00:00
* [**EvilRDP**](https://github.com/skelsec/evilrdp)
* Udhibiti wa panya na kibodi kiotomatiki kutoka kwenye mstari wa amri
* Udhibiti wa ubao wa kunakili kiotomatiki kutoka kwenye mstari wa amri
* Kuchochea proxi ya SOCKS kutoka kwa mteja ambayo inaelekeza mawasiliano ya mtandao kwenye lengo kupitia RDP
* Kutekeleza amri za SHELL na PowerShell za kiholela kwenye lengo bila kupakia faili
* Pakia na pakua faili kwenye/ kutoka kwenye lengo hata wakati uhamishaji wa faili umezimwa kwenye lengo
2021-08-12 13:26:30 +00:00
2024-02-11 02:13:58 +00:00
## Amri za Kiotomatiki za HackTricks
2022-05-01 13:25:53 +00:00
```
2021-08-12 13:26:30 +00:00
Protocol_Name: RDP #Protocol Abbreviation if there is one.
Port_Number: 3389 #Comma separated if there is more than one.
Protocol_Description: Remote Desktop Protocol #Protocol Abbreviation Spelled out
2021-08-15 17:55:52 +00:00
Entry_1:
2024-02-11 02:13:58 +00:00
Name: Notes
Description: Notes for RDP
Note: |
Developed by Microsoft, the Remote Desktop Protocol (RDP) is designed to enable a graphical interface connection between computers over a network. To establish such a connection, RDP client software is utilized by the user, and concurrently, the remote computer is required to operate RDP server software. This setup allows for the seamless control and access of a distant computer's desktop environment, essentially bringing its interface to the user's local device.
2021-08-15 17:55:52 +00:00
2024-02-11 02:13:58 +00:00
https://book.hacktricks.xyz/pentesting/pentesting-rdp
2021-08-15 17:55:52 +00:00
Entry_2:
2024-02-11 02:13:58 +00:00
Name: Nmap
Description: Nmap with RDP Scripts
Command: nmap --script "rdp-enum-encryption or rdp-vuln-ms12-020 or rdp-ntlm-info" -p 3389 -T4 {IP}
2021-08-12 13:26:30 +00:00
```
<figure><img src="../.gitbook/assets/image (14).png" alt=""><figcaption></figcaption></figure>
**Mipangilio inapatikana mara moja kwa tathmini ya udhaifu na upenyezaji**. Tekeleza pentest kamili kutoka popote ukiwa na zana na vipengele zaidi ya 20 vinavyoanzia uchunguzi hadi ripoti. Hatuchukui nafasi ya wapimaji wa pentest - tuna