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をサポートする
- サブスクリプションプランを確認してください!
- **💬 Discordグループまたはテレグラムグループに参加するか、Twitter 🐦 @hacktricks_liveをフォローしてください。
- HackTricksおよびHackTricks CloudのGitHubリポジトリにPRを提出してハッキングトリックを共有してください。
基本情報
Portmapper は、ネットワークサービスのポートを RPC (Remote Procedure Call) プログラム番号にマッピングするために使用されるサービスです。これは Unix-based systems における重要なコンポーネントとして機能し、これらのシステム間で情報のやり取りを容易にします。Portmapper に関連する port は、実行中の Unix Operating System (OS) の種類やシステム上で利用可能なサービスの詳細など、攻撃者に有用な情報を明らかにする可能性があるため、攻撃者によって頻繁にスキャンされます。さらに、Portmapper は NFS (Network File System)、NIS (Network Information Service)、およびその他の RPC-based services と組み合わせてネットワークサービスを効率的に管理するためによく使用されます。
デフォルトポート: 111/TCP/UDP、Oracle Solaris では 32771
PORT STATE SERVICE
111/tcp open rpcbind
列挙
rpcinfo irked.htb
nmap -sSUC -p111 192.168.10.1
場合によっては何も情報が得られないことがありますが、別の場合では次のような出力が得られます:
.png)
高度な rpcinfo の使用法
rpcinfo -T udp -p <target> を利用して、TCP/111 がフィルタされている場合でも UDP のプログラム一覧を取得し、続けて showmount -e <target> をすぐに実行して、rpcbind に登録された誰でも読み取り可能な NFS エクスポートを確認します。
rpcinfo -T udp -p 10.10.10.10
showmount -e 10.10.10.10
Nmap NSEによる網羅的マッピング
古典的なスキャンに nmap --script=rpcinfo,rpc-grind -p111 <target> を組み合わせて、RPCプログラム番号をブルートフォースします。rpc-grind は portmapper に対して null コールを連続送信し、nmap-rpc データベースを辿って、リモートデーモンが “can’t support version” と返答するたびにサポートされるバージョンを抽出します。これにより rusersd、rquotad、あるいはカスタムデーモンなど、静かに登録されたサービスが明らかになることが多いです。--script-args 'rpc-grind.threads=8' によるマルチスレッド化は大規模ターゲットで高速化し、併用する rpcinfo スクリプトは人間が読めるテーブルを出力してホストのベースラインと差分を取れます。
Shodan
port:111 portmap
RPCBind + NFS
サービス NFS を見つけた場合、ファイルの一覧取得やダウンロード(場合によってはアップロード)を行える可能性があります:
.png)
Read 2049 - Pentesting NFS service to learn more about how to test this protocol.
NIS
Exploring NIS vulnerabilities involves a two-step process, starting with the identification of the service ypbind. The cornerstone of this exploration is uncovering the NIS domain name, without which progress is halted.
.png)
調査は必要なパッケージのインストール(apt-get install nis)から始まります。次に、ypwhich を使ってドメイン名とサーバーの IP で NIS サーバーに問い合わせ、サーバーの存在を確認します。ドメイン名やサーバー IP はセキュリティのため匿名化して扱ってください。
最後の重要なステップは 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 サービスが表示されている場合:
.png)
ボックスのユーザーを列挙できます。方法を学ぶには 1026 - Pentesting Rsusersd を参照してください。
フィルタされた Portmapper ポートのバイパス
nmap scan を行い、NFS ポートが開いていて port 111 がフィルタされているのを発見した場合、これらのポートを直接悪用することは困難です。しかし、simulating a portmapper service locally and creating a tunnel from your machine によりターゲット側へのトンネルを作成すると、標準的なツールを使って悪用が可能になります。この手法は port 111 のフィルタ状態を回避し、NFS サービスへのアクセスを可能にします。詳細な手順は、この記事を参照してください: this link.
練習用ラボ
- これらの手法は Irked HTB machine で練習してください。
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.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をサポートする
- サブスクリプションプランを確認してください!
- **💬 Discordグループまたはテレグラムグループに参加するか、Twitter 🐦 @hacktricks_liveをフォローしてください。
- HackTricksおよびHackTricks CloudのGitHubリポジトリにPRを提出してハッキングトリックを共有してください。


