界: Environment
このセクションには、ソース コード以外のものでも、作成中の製品のセキュリティにとって重要なものがすべて含まれています。この分野が対象とする問題は、ソース コードに直接関係しないため、この分野の他の部分と分けました。
PHP Misconfiguration: register_globals Enabled
Abstract
すべての環境、GET、POST、cookie、およびサーバー変数をグローバルに登録するために PHP を設定すると、予期せぬ動作を引き起こす可能性があり、攻撃者に攻撃の機会を与えてしまうことになります。
Explanation
register_globals
オプションが有効に設定されていると、PHP によってすべての EGPCS (環境、GET、POST、cookie、サーバー) 変数がグローバルに登録されるため、任意の PHP プログラムの任意のスコープにおいてこれらの変数にアクセスできます。このオプションを使用すると、プログラマは依存している値の出所を知らないままプログラムを記述してしまいやすくなります。その結果、悪意のない環境においては予期せぬ動作を引き起こす可能性があります。また、悪意のある環境においては攻撃者に攻撃の機会を与えてしまう可能性があります。register_globals
がもたらす可能性のあるセキュリティ上の脅威を受け、このオプションは PHP 4.2.0 ではデフォルトで無効に設定されています。また、PHP 6 では廃止予定であるか削除済みです。例 1: 次のコードは、クロスサイト スクリプト攻撃に対して脆弱です。プログラマは、
$username
の値はサーバーで制御されているセッションに由来していると想定しますが、攻撃者は代わりにリクエスト パラメーターとして $username
に悪意ある値を指定できます。register_globals
が有効に設定されている場合、攻撃者が送信した悪意ある値はこのコードによって生成された動的な HTML コンテンツに含められます。
<?php
if (isset($username)) {
echo "Hello <b>$username</b>";
} else {
echo "Hello <b>Guest</b><br />";
echo "Would you like to login?";
}
?>
References
[1] M. Achour et al. PHP Manual
[2] Artur Maj Securing PHP
[3] Standards Mapping - Common Weakness Enumeration CWE ID 473
[4] Standards Mapping - OWASP API 2023 API8 Security Misconfiguration
[5] Standards Mapping - OWASP Mobile 2014 M1 Weak Server Side Controls
[6] Standards Mapping - OWASP Top 10 2004 A10 Insecure Configuration Management
[7] Standards Mapping - OWASP Top 10 2010 A6 Security Misconfiguration
[8] Standards Mapping - OWASP Top 10 2013 A5 Security Misconfiguration
[9] Standards Mapping - OWASP Top 10 2017 A6 Security Misconfiguration
[10] Standards Mapping - OWASP Top 10 2021 A05 Security Misconfiguration
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.10
[12] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.10
[13] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.10
[14] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.10
[15] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.10
[16] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0.1 Requirement 6.2.4
[18] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[19] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[20] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
[21] Standards Mapping - Web Application Security Consortium Version 2.00 Application Misconfiguration (WASC-15)
desc.php.php_misconfiguration_register_globals