8.5 KiB
143,993 - Kupima IMAP
Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)!
Njia nyingine za kusaidia HackTricks:
- Ikiwa unataka kuona kampuni yako ikitangazwa kwenye HackTricks au kupakua HackTricks kwa PDF Angalia MIPANGO YA USAJILI!
- Pata swag rasmi ya PEASS & HackTricks
- Gundua Familia ya PEASS, mkusanyiko wetu wa NFTs ya kipekee
- Jiunge na 💬 Kikundi cha Discord au kikundi cha telegram au tufuate kwenye Twitter 🐦 @carlospolopm.
- Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwa HackTricks na HackTricks Cloud repos za github.
Kikundi cha Usalama cha Kujitahidi
{% embed url="https://discord.gg/tryhardsecurity" %}
Itifaki ya Kufikia Ujumbe wa Mtandao
Itifaki ya Kufikia Ujumbe wa Mtandao (IMAP) imeundwa kwa lengo la kuruhusu watumiaji kufikia ujumbe wao wa barua pepe kutoka mahali popote, hasa kupitia muunganisho wa Mtandao. Kimsingi, barua pepe zinabaki kwenye server badala ya kupakuliwa na kuhifadhiwa kwenye kifaa cha mtu binafsi. Hii inamaanisha kwamba wakati barua pepe inapofikiwa au kusomwa, inafanywa moja kwa moja kutoka kwenye server. Uwezo huu unaruhusu urahisi wa kuangalia barua pepe kutoka kwenye vifaa vingi, kuhakikisha kwamba hakuna ujumbe unaopotea bila kujali kifaa kilichotumika.
Kwa chaguo-msingi, itifaki ya IMAP hufanya kazi kwenye bandari mbili:
- Bandari 143 - hii ni bandari isiyo salama ya IMAP ya chaguo-msingi
- Bandari 993 - hii ndio bandari unayohitaji kutumia ikiwa unataka kuunganisha kwa kutumia IMAP kwa usalama
PORT STATE SERVICE REASON
143/tcp open imap syn-ack
Kunasa Bango
nc -nv <IP> 143
openssl s_client -connect <IP>:993 -quiet
NTLM Auth - Kufichua Taarifa
Ikiwa server inaunga mkono NTLM auth (Windows) unaweza kupata taarifa nyeti (toleo):
root@kali: telnet example.com 143
* OK The Microsoft Exchange IMAP4 service is ready.
>> a1 AUTHENTICATE NTLM
+
>> TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=
+ TlRMTVNTUAACAAAACgAKADgAAAAFgooCBqqVKFrKPCMAAAAAAAAAAEgASABCAAAABgOAJQAAAA9JAEkAUwAwADEAAgAKAEkASQBTADAAMQABAAoASQBJAFMAMAAxAAQACgBJAEkAUwAwADEAAwAKAEkASQBTADAAMQAHAAgAHwMI0VPy1QEAAAAA
Au automatize hii na nmap plugin imap-ntlm-info.nse
IMAP Bruteforce
Sintaksia
Mifano ya Amri za IMAP kutoka hapa:
Login
A1 LOGIN username password
Values can be quoted to enclose spaces and special characters. A " must then be escape with a \
A1 LOGIN "username" "password"
List Folders/Mailboxes
A1 LIST "" *
A1 LIST INBOX *
A1 LIST "Archive" *
Create new Folder/Mailbox
A1 CREATE INBOX.Archive.2012
A1 CREATE "To Read"
Delete Folder/Mailbox
A1 DELETE INBOX.Archive.2012
A1 DELETE "To Read"
Rename Folder/Mailbox
A1 RENAME "INBOX.One" "INBOX.Two"
List Subscribed Mailboxes
A1 LSUB "" *
Status of Mailbox (There are more flags than the ones listed)
A1 STATUS INBOX (MESSAGES UNSEEN RECENT)
Select a mailbox
A1 SELECT INBOX
List messages
A1 FETCH 1:* (FLAGS)
A1 UID FETCH 1:* (FLAGS)
Retrieve Message Content
A1 FETCH 2 body[text]
A1 FETCH 2 all
A1 UID FETCH 102 (UID RFC822.SIZE BODY.PEEK[])
Close Mailbox
A1 CLOSE
Logout
A1 LOGOUT
Mabadiliko
apt install evolution
CURL
Uvumbuzi wa msingi unawezekana na CURL, lakini nyaraka zina maelezo machache hivyo ni vyema kuangalia chanzo kwa maelezo sahihi.
- Orodha ya sanduku la barua (amri ya imap `LIST "" "*")
curl -k 'imaps://1.2.3.4/' --user user:pass
- Kupanga ujumbe kwenye sanduku la barua (amri ya imap
SELECT INBOX
na kishaSEARCH ALL
)
curl -k 'imaps://1.2.3.4/INBOX?ALL' --user user:pass
Matokeo ya utafutaji huu ni orodha ya viashiria vya ujumbe.
Pia niwezekano wa kutoa vigezo vya utafutaji vya kina zaidi. k.m. kutafuta rasimu zenye nenosiri kwenye mwili wa barua:
curl -k 'imaps://1.2.3.4/Drafts?TEXT password' --user user:pass
- Kupakua ujumbe (amri ya imap
SELECT Drafts
na kishaFETCH 1 BODY[]
)
curl -k 'imaps://1.2.3.4/Drafts;MAILINDEX=1' --user user:pass
Mail index itakuwa index ile ile itakayorudishwa kutoka kwa operesheni ya utafutaji.
Pia niwezekano kutumia UID
(kitambulisho cha kipekee) kufikia ujumbe, hata hivyo ni chaguo duni kwani amri ya utafutaji inahitaji kuandaliwa kwa mkono. K.m.
curl -k 'imaps://1.2.3.4/INBOX' -X 'UID SEARCH ALL' --user user:pass
curl -k 'imaps://1.2.3.4/INBOX;UID=1' --user user:pass
Pia, inawezekana kupakua sehemu tu ya ujumbe, kwa mfano mada na mtumaji wa ujumbe wa kwanza 5 ( -v
inahitajika kuona mada na mtumaji):
$ curl -k 'imaps://1.2.3.4/INBOX' -X 'FETCH 1:5 BODY[HEADER.FIELDS (SUBJECT FROM)]' --user user:pass -v 2>&1 | grep '^<'
Ingawa, ni safi zaidi kuandika kitanzi kidogo:
for m in {1..5}; do
echo $m
curl "imap://1.2.3.4/INBOX;MAILINDEX=$m;SECTION=HEADER.FIELDS%20(SUBJECT%20FROM)" --user user:pass
done
Shodan
port:143 UWEZO
port:993 UWEZO
Kikundi cha Usalama wa Kujaribu Kwa Bidii
{% embed url="https://discord.gg/tryhardsecurity" %}
Amri za Kiotomatiki za HackTricks
Protocol_Name: IMAP #Protocol Abbreviation if there is one.
Port_Number: 143,993 #Comma separated if there is more than one.
Protocol_Description: Internet Message Access Protocol #Protocol Abbreviation Spelled out
Entry_1:
Name: Notes
Description: Notes for WHOIS
Note: |
The Internet Message Access Protocol (IMAP) is designed for the purpose of enabling users to access their email messages from any location, primarily through an Internet connection. In essence, emails are retained on a server rather than being downloaded and stored on an individual's personal device. This means that when an email is accessed or read, it is done directly from the server. This capability allows for the convenience of checking emails from multiple devices, ensuring that no messages are missed regardless of the device used.
https://book.hacktricks.xyz/pentesting/pentesting-imap
Entry_2:
Name: Banner Grab
Description: Banner Grab 143
Command: nc -nv {IP} 143
Entry_3:
Name: Secure Banner Grab
Description: Banner Grab 993
Command: openssl s_client -connect {IP}:993 -quiet
Entry_4:
Name: consolesless mfs enumeration
Description: IMAP enumeration without the need to run msfconsole
Note: sourced from https://github.com/carlospolop/legion
Command: msfconsole -q -x 'use auxiliary/scanner/imap/imap_version; set RHOSTS {IP}; set RPORT 143; run; exit'
Jifunze AWS hacking kutoka sifuri hadi shujaa na htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)!
Njia nyingine za kusaidia HackTricks:
- Ikiwa unataka kuona kampuni yako ikitangazwa kwenye HackTricks au kupakua HackTricks kwa PDF Angalia MIPANGO YA KUJIUNGA!
- Pata bidhaa rasmi za PEASS & HackTricks
- Gundua Familia ya PEASS, mkusanyiko wetu wa NFTs ya kipekee
- Jiunge na 💬 Kikundi cha Discord au kikundi cha telegram au tufuate kwenye Twitter 🐦 @carlospolopm.
- Shiriki mbinu zako za kuhack kwa kuwasilisha PRs kwa HackTricks na HackTricks Cloud repos za github.