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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
cve-2019-11043 — CVE-2019-11043 PHPリモートコード実行 | Kitploit
ツール/GitHubGitHub/shadow-horse/cve-2019-11043
脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテスト学習と教育ラボと実践
GitHubshadow-horse/cve-2019-11043

cve-2019-11043

CVE-2019-11043 PHPリモートコード実行

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

人気

すべて見る →

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

すべてのツールを探索

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

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

PHP リモートコード実行脆弱性 (CVE-2019-11043)

1. 背景

9月26日、PHP公式が脆弱性の通告を発表し、Nginx + php-fpmを使用するサーバーが特定の設定下でリモートコード実行の脆弱性を持つことを指摘しました。この設定は広く使用されており、影響は大きいです。

脆弱性のPoCは10月22日に公開され、国内のセキュリティメディアが速やかに警告を発しました。

2. 脆弱性の説明

Nginxのfastcgi_split_path_infoは、%0aを含むリクエストを処理する際に、改行文字\nに遭遇するとPATH_INFOが空になります。一方、php-fpmはPATH_INFOが空の場合に論理的な欠陥があります。攻撃者は巧妙に構築し悪用することで、リモートコード実行を引き起こす可能性があります。

Nginx + php-fpmのサーバーで、以下の設定を使用している場合、リモートコード実行の脆弱性が存在する可能性があります。

root@kitploit:~
 location ~ [^/]\.php(/|$) {

    fastcgi_split_path_info ^(.+?\.php)(/.*)$;

    fastcgi_param PATH_INFO       $fastcgi_path_info;

    fastcgi_pass   php:9000;

    ...
}

3. 解決策

通常の業務に影響を与えない場合、Nginx設定ファイルから以下の設定を削除してください。

root@kitploit:~
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO       $fastcgi_path_info;

4. GitHubで公開されたPoC

GitHub: https://github.com/neex/phuip-fpizdam

このPoCはFastCGI変数_fcgi_data_segの最適化を利用しています。この最適化はPHP7のみに存在するため、公開されたexploitはPHP7でのみ有効です。PHP5環境では別のexploitが必要です。

5. 脆弱性の再現

1. NGINX+PHP-FPM (php7) の設定

環境を構成し、nginx + php-fpmを構築して、動作が有効であることを確認します。

  1. php7をダウンロードし、解凍してディレクトリに入る

    root@kitploit:~
     wget -c http://cn2.php.net/distributions/php-7.2.4.tar.gz
     tar -xzvf php-7.2.4.tar.gz
    
  2. 圧縮、sslなどの関連依存パッケージをインストール

    root@kitploit:~
     yum install -y libxml2*
     yum install -y openssl*
     yum install -y libcurl*
     yum install -y libjpeg*
     yum install -y libpng*
     yum install -y freetype*
     yum install -y libmcrypt*
    
  3. configure でソースコードをコンパイル

    root@kitploit:~
     ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo
    
     make & make install
    
  4. php-fpmの設定(複数のPHPを設定する場合は、ポート9000を9001に変更可能)

    root@kitploit:~
     php-fpm設定ファイルを変更:
     $ cd /usr/local/php/etc
     $ cp php-fpm.conf.default php-fpm.conf
     $ vi php-fpm.conf
     pid = run/php-fpm.pid の前のセミコロンを削除
     $ cd php-fpm.d
     $ cp www.conf.default www.conf  (ポート変更)
     $ vi www.conf
     userとgroupのユーザーをroot以外に変更
    
  5. ./php-fpm

2. 脆弱性のあるPHPパースの設定

nginx.confに以下の設定を追加:

root@kitploit:~
location ~ [^/]\.php(/|$) {
        root /opt/apache/www;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO  $fastcgi_path_info;
        fastcgi_pass   127.0.0.1:9001;
        include     fastcgi_params;
     }

nginxを再起動

  1. Goをインストールし、PoCコードをコンパイル

    root@kitploit:~
     go get github.com/neex/phuip-fpizdam (ファイルはGoのsrcディレクトリにダウンロードされます)
    
     go build github.com/neex/phuip-fpizdam (フルパスで、カレントディレクトリに実行ファイルが生成されます)
    
  2. PoCを実行

    root@kitploit:~
     ./phuip-fpizdam http://website.com/index.php
     ./phuip-fpizdam http://website.com/index.php?a=command
    

[残念ながら、環境設定に問題があり、検証に失敗しました]

root@kitploit:~
	2019/10/29 01:13:19 Detect() returned error: no qsl candidates found, invulnerable or something wrong

4. docker統合検証環境

元リンク:https://github.com/vulhub/vulhub/tree/master/php/CVE-2019-11043

  1. このdockerプロジェクトファイルをダウンロード

  2. docker-compose up -d でdockerコンテナを実行

  3. プログラムを実行し、実行成功を表示。脆弱性を利用してコマンド"id"をエコーバック

  4. dockerサービスを停止 docker ps docker stop id

ツールをダウンロード