111/TCP/UDP - Pentesting Portmapper

学习与实践 AWS 黑客技术:HackTricks 培训 AWS 红队专家 (ARTE) 学习与实践 GCP 黑客技术:HackTricks 培训 GCP 红队专家 (GRTE)

支持 HackTricks

基本信息

Portmapper 是一种用于将网络服务端口映射到 RPC(远程过程调用)程序编号的服务。它作为 Unix 系统中的一个关键组件,促进了这些系统之间的信息交换。与 Portmapper 相关的 端口 经常被攻击者扫描,因为它可以揭示有价值的信息。这些信息包括正在运行的 Unix 操作系统 (OS) 的类型以及系统上可用服务的详细信息。此外,Portmapper 通常与 NFS(网络文件系统)NIS(网络信息服务) 和其他 基于 RPC 的服务 一起使用,以有效管理网络服务。

默认端口: 111/TCP/UDP,Oracle Solaris 中的 32771

PORT    STATE SERVICE
111/tcp open  rpcbind

枚举

rpcinfo irked.htb
nmap -sSUC -p111 192.168.10.1

有时它不会给你任何信息,而在其他情况下你会得到这样的内容:

Shodan

  • port:111 portmap

RPCBind + NFS

如果你发现服务 NFS,那么你可能能够列出和下载(也许还可以上传)文件:

阅读 2049 - Pentesting NFS service以了解更多关于如何测试此协议的信息。

NIS

探索 NIS 漏洞涉及一个两步过程,首先识别服务 ypbind。这一探索的基石是揭示 NIS 域名,没有这个进展将会停止。

探索之旅始于安装必要的包(apt-get install nis)。接下来的步骤需要使用 ypwhich 通过域名和服务器 IP 确认 NIS 服务器的存在,确保这些元素为安全而匿名化。

最后一个也是至关重要的步骤涉及 ypcat 命令提取敏感数据,特别是加密的用户密码。这些哈希值一旦使用像 John the Ripper 这样的工具破解,将揭示系统访问和权限的见解。

# 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/hosts

hosts.byname, hosts.byaddr

包含主机名和 IP 详细信息

/etc/passwd

passwd.byname, passwd.byuid

NIS 用户密码文件

/etc/group

group.byname, group.bygid

NIS 组文件

/usr/lib/aliases

mail.aliases

邮件别名详细信息

RPC 用户

如果你发现 rusersd 服务列出如下:

你可以枚举该主机的用户。要了解如何,请阅读 1026 - Pentesting Rsusersd

绕过过滤的 Portmapper 端口

在进行 nmap 扫描 并发现 NFS 端口开放且端口 111 被过滤时,直接利用这些端口是不可行的。然而,通过 在本地模拟一个 portmapper 服务并从你的机器创建一个隧道到目标,利用标准工具进行利用成为可能。这种技术允许绕过端口 111 的过滤状态,从而访问 NFS 服务。有关此方法的详细指导,请参阅 此链接 中的文章。

Shodan

  • Portmap

实践实验室

HackTricks 自动命令

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.xyz/pentesting/pentesting-rpcbind

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}

学习与实践 AWS 黑客技术:HackTricks 培训 AWS 红队专家 (ARTE) 学习与实践 GCP 黑客技术:HackTricks 培训 GCP 红队专家 (GRTE)

支持 HackTricks

Last updated