135, 593 - Pentesting MSRPC

Support HackTricks

Join HackenProof Discord server to communicate with experienced hackers and bug bounty hunters!

Hacking Insights Engage with content that delves into the thrill and challenges of hacking

Real-Time Hack News Keep up-to-date with fast-paced hacking world through real-time news and insights

Latest Announcements Stay informed with the newest bug bounties launching and crucial platform updates

Join us on Discord and start collaborating with top hackers today!

基本情報

Microsoft Remote Procedure Call (MSRPC) プロトコルは、クライアントサーバーモデルであり、プログラムが別のコンピュータにあるプログラムからサービスを要求することを可能にします。このプロトコルは、ネットワークの詳細を理解することなく機能します。最初はオープンソースソフトウェアから派生し、その後Microsoftによって開発され、著作権が付与されました。

RPCエンドポイントマッパーは、TCPおよびUDPポート135、TCP 139および445のSMB(ヌルまたは認証されたセッションで)、およびTCPポート593のWebサービスを介してアクセスできます。

135/tcp   open     msrpc         Microsoft Windows RPC

MSRPCはどのように機能しますか?

クライアントアプリケーションによって開始されるMSRPCプロセスは、ローカルスタブプロシージャを呼び出し、その後クライアントランタイムライブラリと相互作用して、リクエストをサーバーに準備して送信します。これには、パラメータを標準ネットワークデータ表現形式に変換することが含まれます。サーバーがリモートの場合、トランスポートプロトコルの選択はランタイムライブラリによって決定され、RPCがネットワークスタックを通じて配信されることを保証します。

https://0xffsec.com/handbook/images/msrpc.png

公開されているRPCサービスの特定

TCP、UDP、HTTP、およびSMBを介したRPCサービスの公開は、RPCロケータサービスおよび個々のエンドポイントをクエリすることによって判断できます。rpcdumpなどのツールは、IFID値によって示されるユニークなRPCサービスの特定を容易にし、サービスの詳細と通信バインディングを明らかにします:

D:\rpctools> rpcdump [-p port] <IP>
**IFID**: 5a7b91f8-ff00-11d0-a9b2-00c04fb6e6fc version 1.0
Annotation: Messenger Service
UUID: 00000000-0000-0000-0000-000000000000
Binding: ncadg_ip_udp:<IP>[1028]

RPCロケータサービスへのアクセスは、特定のプロトコルを通じて有効になります:ポート135を介してアクセスするためのncacn_ip_tcpおよびncadg_ip_udp、SMB接続のためのncacn_np、ウェブベースのRPC通信のためのncacn_http。以下のコマンドは、主にポート135に焦点を当てて、MSRPCサービスを監査および対話するためのMetasploitモジュールの利用を示しています:

use auxiliary/scanner/dcerpc/endpoint_mapper
use auxiliary/scanner/dcerpc/hidden
use auxiliary/scanner/dcerpc/management
use auxiliary/scanner/dcerpc/tcp_dcerpc_auditor
rpcdump.py <IP> -p 135

All options except tcp_dcerpc_auditor are specifically designed for targeting MSRPC on port 135.

Notable RPC interfaces

  • IFID: 12345778-1234-abcd-ef00-0123456789ab

  • Named Pipe: \pipe\lsarpc

  • Description: LSAインターフェース、ユーザーを列挙するために使用されます。

  • IFID: 3919286a-b10c-11d0-9ba8-00c04fd92ef5

  • Named Pipe: \pipe\lsarpc

  • Description: LSAディレクトリサービス(DS)インターフェース、ドメインと信頼関係を列挙するために使用されます。

  • IFID: 12345778-1234-abcd-ef00-0123456789ac

  • Named Pipe: \pipe\samr

  • Description: LSA SAMRインターフェース、公開SAMデータベース要素(例:ユーザー名)にアクセスし、アカウントロックアウトポリシーに関係なくユーザーパスワードをブルートフォースするために使用されます。

  • IFID: 1ff70682-0a51-30e8-076d-740be8cee98b

  • Named Pipe: \pipe\atsvc

  • Description: タスクスケジューラ、リモートでコマンドを実行するために使用されます。

  • IFID: 338cd001-2244-31f1-aaaa-900038001003

  • Named Pipe: \pipe\winreg

  • Description: リモートレジストリサービス、システムレジストリにアクセスして変更するために使用されます。

  • IFID: 367abb81-9844-35f1-ad32-98f038001003

  • Named Pipe: \pipe\svcctl

  • Description: サービスコントロールマネージャーおよびサーバーサービス、リモートでサービスを開始および停止し、コマンドを実行するために使用されます。

  • IFID: 4b324fc8-1670-01d3-1278-5a47bf6ee188

  • Named Pipe: \pipe\srvsvc

  • Description: サービスコントロールマネージャーおよびサーバーサービス、リモートでサービスを開始および停止し、コマンドを実行するために使用されます。

  • IFID: 4d9f4ab8-7d1c-11cf-861e-0020af6e7c57

  • Named Pipe: \pipe\epmapper

  • Description: DCOMインターフェース、ブルートフォースパスワードグラインディングおよびWMを介した情報収集に使用されます。

Identifying IP addresses

Using https://github.com/mubix/IOXIDResolver, comes from Airbus research is possible to abuse the ServerAlive2 method inside the IOXIDResolver interface.

This method has been used to get interface information as IPv6 address from the HTB box APT. See here for 0xdf APT writeup, it includes an alternative method using rpcmap.py from Impacket with stringbinding (see above).

Executing a RCE with valid credentials

It is possible to execute remote code on a machine, if the credentials of a valid user are available using dcomexec.py from impacket framework.

Remember to try with the different objects available

  • ShellWindows

  • ShellBrowserWindow

  • MMC20

Port 593

The rpcdump.exe from rpctools can interact with this port.

References

Join HackenProof Discord server to communicate with experienced hackers and bug bounty hunters!

Hacking Insights Engage with content that delves into the thrill and challenges of hacking

Real-Time Hack News Keep up-to-date with fast-paced hacking world through real-time news and insights

Latest Announcements Stay informed with the newest bug bounties launching and crucial platform updates

Join us on Discord and start collaborating with top hackers today!

Support HackTricks

Last updated