hacktricks/network-services-pentesting/pentesting-web/put-method-webdav.md

14 KiB
Raw Blame History

WebDav


Trickestを使用して、世界で最も高度なコミュニティツールによって強化されたワークフローを簡単に構築し、自動化します。
今すぐアクセスを取得:

{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}

☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥

アクティブなWebDavを持つHTTPサーバーは、おそらくファイルの更新、削除、移動、コピーができるサーバーです。時には有効な資格情報通常はHTTPベーシック認証で確認が必要です。

WebサーバーからいくつかのWebシェルをアップロードして実行し、サーバーを制御します。
通常、WebDavサーバーに接続するには、有効な資格情報が必要です:WebDavブルートフォース(基本認証)。

他の一般的な設定は、Webサーバーによって実行されるファイルの拡張子ファイルのアップロードを禁止することです。これをバイパスする方法を確認する必要があります。

  • 実行可能な拡張子を持つファイルをアップロードします(おそらく禁止されていない場合)。
  • 実行可能な拡張子を持たないファイル(.txtなどアップロードし、ファイルを実行可能な拡張子名前を変更(移動)してみてください。
  • 実行可能な拡張子を持たないファイル(.txtなどアップロードし、ファイルを実行可能な拡張子コピー(移動)してみてください。

DavTest

Davtestは、さまざまな拡張子を持つ複数のファイルをアップロードし、拡張子が実行されるかどうかチェックします。

davtest [-auth user:password] -move -sendbd auto -url http://<IP> #Uplaod .txt files and try to move it to other extensions
davtest [-auth user:password] -sendbd auto -url http://<IP> #Try to upload every extension

出力サンプル:

これは、.txt.html 拡張子が実行されていることを意味しません。これは、これらのファイルにウェブを通じてアクセスできることを意味します。

Cadaver

このツールを使用して、WebDav サーバーに接続し、アップロード移動削除などの操作を手動で実行できます。

cadaver <IP>

PUTリクエスト

A PUT request is an HTTP method used to update or create a resource on a server. It is commonly used in web development and web services. The PUT method is idempotent, meaning that multiple identical requests will have the same effect as a single request.

PUTリクエストは、サーバー上のリソースを更新または作成するために使用されるHTTPメソッドです。これは、ウェブ開発やウェブサービスで一般的に使用されます。PUTメソッドは冪等性を持ちます。つまり、複数の同一のリクエストは、単一のリクエストと同じ効果を持ちます。

To make a PUT request, the client sends an HTTP request to the server with the desired resource URI and includes the updated or new data in the request body. The server then processes the request and updates or creates the resource accordingly.

PUTリクエストを行うには、クライアントは目的のリソースURIを含んだHTTPリクエストをサーバーに送信し、リクエストボディに更新または新しいデータを含めます。サーバーはその後、リクエストを処理し、リソースを更新または作成します。

It is important to note that the PUT method should only be used for safe and idempotent operations. It should not have any side effects on the server or the resource. If a PUT request is not idempotent, it can lead to unintended consequences or data corruption.

重要な点として、PUTメソッドは安全で冪等な操作にのみ使用するべきです。サーバーやリソースに副作用を持つべきではありません。PUTリクエストが冪等でない場合、意図しない結果やデータの破損を引き起こす可能性があります。

In addition, the server should properly handle authentication and authorization to ensure that only authorized clients can perform PUT requests. This helps prevent unauthorized modifications to resources.

さらに、サーバーは認証と承認を適切に処理する必要があります。これにより、認可されていないクライアントがPUTリクエストを実行することを防ぎ、リソースへの不正な変更を防ぎます。

Overall, the PUT method is a powerful tool for updating or creating resources on a server, but it should be used with caution and in accordance with best practices to ensure the security and integrity of the system.

全体的に、PUTメソッドはサーバー上のリソースを更新または作成するための強力なツールですが、システムのセキュリティと整合性を確保するために、注意してベストプラクティスに従って使用する必要があります。

curl -T 'shell.txt' 'http://$ip'

MOVE リクエスト

The MOVE request is used in WebDAV to move a resource from one location to another. It is similar to the HTTP PUT method, but instead of creating a new resource, it moves an existing resource to a new location.

MOVE リクエストは、WebDAV でリソースを1つの場所から別の場所に移動するために使用されます。これは HTTP PUT メソッドと似ていますが、新しいリソースを作成する代わりに、既存のリソースを新しい場所に移動します。

The MOVE request is sent with the following syntax:

MOVE リクエストは、次の構文で送信されます:

MOVE /source-resource HTTP/1.1
Host: example.com
Destination: /destination-resource

The source-resource is the URL of the resource that needs to be moved, and the destination-resource is the URL of the new location where the resource should be moved to.

source-resource は移動する必要のあるリソースの URL であり、destination-resource はリソースを移動する新しい場所の URL です。

The server responds with a 200 OK status code if the move is successful. If the resource cannot be moved, the server may respond with a 409 Conflict status code.

サーバーは、移動が成功した場合に 200 OK ステータスコードで応答します。リソースを移動できない場合、サーバーは 409 Conflict ステータスコードで応答する場合があります。

The MOVE request can be used by an attacker to move sensitive files to a location where they can be accessed by unauthorized users. It can also be used to overwrite existing files, causing data loss or disruption of services.

MOVE リクエストは、攻撃者が機密ファイルを権限のないユーザーがアクセスできる場所に移動するために使用されることがあります。また、既存のファイルを上書きしてデータの損失やサービスの中断を引き起こすこともあります。

curl -X MOVE --header 'Destination:http://$ip/shell.php' 'http://$ip/shell.txt'


Trickestを使用して、世界で最も高度なコミュニティツールによって強化されたワークフローを簡単に構築し、自動化することができます。
今すぐアクセスを取得:

{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}

IIS5/6 WebDavの脆弱性

この脆弱性は非常に興味深いです。WebDavは、拡張子**.aspのファイルのアップロード名前の変更許可しません**。しかし、名前の末尾に**";.txt"を追加することで、この制限をバイパスすることができ、ファイルは.aspファイルとして実行されます(".txt"の代わりに".html"を使用することもできますが、";"を忘れないでください**)。

その後、シェルを".txtファイル"としてアップロードし、それを".asp;.txtファイル"にコピー/移動します。Webサーバーを介してそのファイルにアクセスすると、それが実行されますcadaverは移動アクションが機能しなかったと言いますが、実際には機能しています

資格情報の投稿

WebdavがApacheサーバーを使用している場合、Apacheの設定されたサイトを確認する必要があります。一般的には
/etc/apache2/sites-enabled/000-default

その中には、次のようなものが見つかるかもしれません:

ServerAdmin webmaster@localhost
Alias /webdav /var/www/webdav
<Directory /var/www/webdav>
DAV On
AuthType Digest
AuthName "webdav"
AuthUserFile /etc/apache2/users.password
Require valid-user

以下のように、webdavサーバーの有効な資格情報を持つファイルがあります:

/etc/apache2/users.password

この種のファイルの中には、ユーザー名とパスワードのハッシュが含まれています。これらは、WebDAVサーバーがユーザーを認証するために使用している資格情報です。

これらをクラックするか、何らかの理由でWebDAVサーバーにアクセスしたい場合には、追加することもできます。

htpasswd /etc/apache2/users.password <USERNAME> #You will be prompted for the password

新しい資格情報が機能しているかどうかを確認するには、次の操作を行うことができます:

wget --user <USERNAME> --ask-password http://domain/path/to/webdav/ -O - -q
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥


Trickestを使用して、世界で最も高度なコミュニティツールによって強化されたワークフローを簡単に構築および自動化します。
今すぐアクセスを取得:

{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}