簡體   English   中英

防止“ ssi_function = something”繞過正常的控制流程

[英]Prevent “ssi_function=something” from bypassing normal control flow

如果您熟悉SMF,則通常使用它的服務器端方法包括:

//foo.php at http://example/foo.php
<?php
require('./SSI.php'); //assuming we're at SMF's root

//...
?>

但它隱藏在未經訓練的眼睛在訪問http://example/foo.php?ssi_function=something 會導致ssi_something里面被稱為SSI.php ,有效地繞過foo.php的正常行為。

我可以在require之前添加此代碼,但是可以避免重定向:

if(isset($_GET['ssi_function']))
{
    unset($_GET['ssi_function']);
    return header('Location: ?' . http_build_query($_GET));
}

我已經在GitHub上發布了一個問題 ,但是我還需要其他哪些選擇來應對這種麻煩?

如您所述,這是SMF中與實現有關的行為。 在這種情況下,您無需進行重定向,因為$_GET超全局變量是可變的,只需刪除ssi_function參數就足夠了。

該錯誤已在#4038中修復。

@@ -177,6 +177,9 @@
 // Have the ability to easily add functions to SSI.
 call_integration_hook('integrate_SSI');

+// Ignore a call to ssi_* functions if we are not using SSI.php
+if (empty($modSettings['allow_ssi_functions_anywhere']) && isset($_GET['ssi_function']) && basename($_SERVER['PHP_SELF']) !== 'SSI.php')
+   unset($_GET['ssi_function']);
 // Call a function passed by GET.
 if (isset($_GET['ssi_function']) && function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest']))
 {

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM