111/TCP/UDP - Pentesting Portmapper

Tip

AWS हैकिंग सीखें और अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE) Azure हैकिंग सीखें और अभ्यास करें: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks का समर्थन करें

Basic Information

Portmapper एक ऐसी सर्विस है जो नेटवर्क सर्विस पोर्ट्स को RPC (Remote Procedure Call) प्रोग्राम नंबरों से मैप करने के लिए उपयोग की जाती है। यह Unix-based systems में एक महत्वपूर्ण घटक के रूप में कार्य करता है, जो इन सिस्टम्स के बीच जानकारी के आदान-प्रदान की सुविधा प्रदान करता है। Portmapper से जुड़ा port अक्सर attackers द्वारा स्कैन किया जाता है क्योंकि यह महत्वपूर्ण जानकारी उजागर कर सकता है। इस जानकारी में चल रही Unix Operating System (OS) का प्रकार और सिस्टम पर उपलब्ध सेवाओं के बारे में विवरण शामिल हो सकते हैं। इसके अतिरिक्त, Portmapper आमतौर पर NFS (Network File System), NIS (Network Information Service) और अन्य RPC-based services के साथ मिलकर नेटवर्क सेवाओं का प्रबंधन करने के लिए उपयोग होता है।

Default port: 111/TCP/UDP, 32771 in Oracle Solaris

PORT    STATE SERVICE
111/tcp open  rpcbind

सूचीकरण

rpcinfo irked.htb
nmap -sSUC -p111 192.168.10.1

कभी-कभी यह आपको कोई जानकारी नहीं देता, بعض अन्य अवसरों पर आपको इस तरह कुछ मिल सकता है:

उन्नत rpcinfo का उपयोग

rpcinfo -T udp -p <target> का उपयोग करके UDP प्रोग्राम सूची प्राप्त करें, भले ही TCP/111 फ़िल्टर किया गया हो, फिर तुरंत showmount -e <target> चलाकर rpcbind के माध्यम से रजिस्टर किए गए सार्वजनिक रूप से पढ़ने योग्य NFS एक्सपोर्ट्स का पता लगाएँ।

rpcinfo -T udp -p 10.10.10.10
showmount -e 10.10.10.10

Exhaustive mapping with Nmap NSE

क्लासिक स्कैन को nmap --script=rpcinfo,rpc-grind -p111 <target> के साथ जोड़ें ताकि RPC program numbers को brute-force किया जा सके। rpc-grind portmapper पर null calls से हमला करता है और nmap-rpc database को पार करता है, और जब भी remote daemon “can’t support version” के साथ जवाब देता है तो supported versions को निकालता है — यह अक्सर चुपके से रजिस्टर्ड services जैसे rusersd, rquotad या custom daemons को उजागर कर देता है। बड़े targets पर गति बढ़ाने के लिए multi-threading --script-args 'rpc-grind.threads=8' का उपयोग करें जबकि साथ में चलने वाला rpcinfo script human-readable tables प्रिंट करता है जिन्हें आप host baselines के साथ diff कर सकते हैं।

Shodan

  • port:111 portmap

RPCBind + NFS

यदि आपको service NFS मिलता है तो संभवतः आप files को list और download (और शायद upload भी) कर पाएँगे:

इस प्रोटोकॉल का परीक्षण कैसे करें यह जानने के लिए 2049 - Pentesting NFS service पढ़ें।

NIS

NIS vulnerabilities का अन्वेषण दो-स्टेप प्रक्रिया है, जो service ypbind की पहचान से शुरू होता है। इस अन्वेषण की आधारशिला NIS domain name का खुलासा करना है, जिसके बिना आगे बढ़ना रोक जाता है।

अन्वेषण की यात्रा आवश्यक पैकेजों (apt-get install nis) की स्थापना से शुरू होती है। अगले चरण में ypwhich का उपयोग करके NIS server की मौजूदगी की पुष्टि करनी होती है — इसे domain name और server IP के साथ ping करके, और सुरक्षा के लिए इन तत्वों को अनाम रखना सुनिश्चित करें।

अंतिम और महत्वपूर्ण चरण में संवेदनशील डेटा, विशेषकर encrypted user passwords, निकालने के लिए ypcat command का प्रयोग होता है। ये hashes, एक बार John the Ripper जैसे टूल्स से crack हो जाने पर, सिस्टम एक्सेस और privileges के बारे में जानकारी उजागर कर देते हैं।

# Install NIS tools
apt-get install nis
# Ping the NIS server to confirm its presence
ypwhich -d <domain-name> <server-ip>
# Extract user credentials
ypcat –d <domain-name> –h <server-ip> passwd.byname

NIF फाइलें

मास्टर फ़ाइलमैप(स)नोट्स
/etc/hostshosts.byname, hosts.byaddrहोस्टनाम और IP विवरण शामिल हैं
/etc/passwdpasswd.byname, passwd.byuidNIS उपयोगकर्ता पासवर्ड फ़ाइल
/etc/groupgroup.byname, group.bygidNIS समूह फ़ाइल
/usr/lib/aliasesmail.aliasesमेल aliases का विवरण

RPC उपयोगकर्ता

यदि आप rusersd सेवा को इस तरह सूचीबद्ध पाते हैं:

आप बॉक्स के users को enumerate कर सकते हैं। कैसे करने के लिए पढ़ें 1026 - Pentesting Rsusersd.

Filtered Portmapper पोर्ट बायपास

जब आप एक nmap scan करते हैं और open NFS ports मिलते हैं पर port 111 filtered होता है, तो इन ports का direct exploitation संभव नहीं होता। हालांकि, यदि आप locally एक portmapper service simulate करके और अपने machine से target तक एक tunnel बनाते हैं, तो standard tools का उपयोग करके exploitation संभव हो जाता है। यह technique port 111 के filtered state को bypass करने की अनुमति देती है, जिससे NFS services तक पहुँच मिल जाती है। इस method पर विस्तृत मार्गदर्शन के लिए इस article को देखें: this link.

अभ्यास के लिए Labs

  • इन techniques का अभ्यास Irked HTB machine पर करें।

HackTricks Automatic Commands

Protocol_Name: Portmapper    #Protocol Abbreviation if there is one.
Port_Number:  43     #Comma separated if there is more than one.
Protocol_Description: PM or RPCBind        #Protocol Abbreviation Spelled out

Entry_1:
Name: Notes
Description: Notes for PortMapper
Note: |
Portmapper is a service that is utilized for mapping network service ports to RPC (Remote Procedure Call) program numbers. It acts as a critical component in Unix-based systems, facilitating the exchange of information between these systems. The port associated with Portmapper is frequently scanned by attackers as it can reveal valuable information. This information includes the type of Unix Operating System (OS) running and details about the services that are available on the system. Additionally, Portmapper is commonly used in conjunction with NFS (Network File System), NIS (Network Information Service), and other RPC-based services to manage network services effectively.

https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-rpcbind.html

Entry_2:
Name: rpc info
Description: May give netstat-type info
Command: whois -h {IP} -p 43 {Domain_Name} && echo {Domain_Name} | nc -vn {IP} 43

Entry_3:
Name: nmap
Description: May give netstat-type info
Command: nmap -sSUC -p 111 {IP}

संदर्भ

Tip

AWS हैकिंग सीखें और अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE) Azure हैकिंग सीखें और अभ्यास करें: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks का समर्थन करें