苏霍辛嘅末日; 下一步係乜嘢?

苏霍辛嘅末日; 下一步係乜嘢?

PHP Suhosin

好多年了, 我熱心地使用 苏霍辛 與Apache2或PHP - fpm Nginx Web服務器上嘅 PHP5嘅任何實現一起,以抵禦SQL注入同其他常見嘅Web攻擊. 講真., Php5係如此災難性, 在其核心安全性方面, 同它的功能同糢塊,我從來冇設想使用它,冇任何重大嘅硬化,Suhosin提供.

由於Php5已折舊,我嘅遺產程序都消失晒, 我只剩幾個PHP7嘅實現,冇可用嘅Suhosin補丁.

雖然, 在技術上仍然有可能把Suhosin添加到Php 7.0 和 7.1 (前阿爾法=不用于生產), 公平地說,該項目早已消失,Php7已經證明,它 可能會好麻煩 就好似佢係它的前身. 当我考慮喺WAF同 PHP7嘅核心安全性中加入一個新內容時, 呢啲係一些我附帶嘅解決方案:

禁用壞或不必要的功能

PHP內部構建嘅好多危險函數具有潛在危險性,默認情況下應在"php.ini"內禁用. 你可以使用以下命令搵到配置文件,並透過vi或nano禁用函數.

php -i | grep "php.ini"

請注意: 如果你同時運行各種版本嘅 PHP,抑或該程序係作為其他第三方應用程序嘅一部分安裝嘅, 咁機會好高,你有多個'php.ini'安裝,它不清楚哪一個係由網絡服務器加載. 請確保您正在編輯正確的版本 (php - v。).

在"php"文件末尾添加.ini行, 確保保存文件, 並重新啟動Web服務器. 你可以瞭解每個 PHP函數 在此地址. 作為測量嘅動作, 你可能需要一個一個地添加它們,以確保它不會對您的應用程序產生負面影響.

disable_functions = popen, eval, leak, exec, shell_exec, curl_exec, curl_multi_exec, parse_ini_file, mysql_connect, system, phpinfo, escapeshellarg, escapeshellcmd, passthru, symlink, show_source, mail, sendmail, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, pfsockopen, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid

禁用寄存器全局同base64

註冊全局係 PHP嘅函數,它允許把URL嘅輸入數組轉換為代碼內嘅變量. 因此, 任何潛在嘅易受攻擊嘅代碼可能被攻擊者利用,攻擊者可以使用 HTTP GET或POST請求傳遞惡意陣列.

透過添加"php"末尾嘅以下行,可以輕鬆禁用註冊全局.ini". 唔好忘記重新啟動Web服務器以執行更改.

register_globals = Off

就好似註冊全局一樣, Base64係另一個經常不必要嘅功能,打開門進入惡意後門. 你可以透過將以下行添加到"php"嘅末尾嚟永久禁用Base64解碼器.ini".

base64_decode = Off
Post Disclaimer

The views, information, or opinions expressed are solely those of the author and do not necessarily represent those of his employer or the organizations with which he is affiliated.

The information contained in this post is for general information purposes only. The information is provided by Farhad Mofidi and while he strives to keep the information current and accurate, he does not make any representations or warranties of any kind, express or implied, regarding the completeness, accuracy, reliability, suitability or availability of the website. Farhad makes no representations or warranties. or any information, products or related graphics contained in any Post for any purpose.

Also, AI may be employed as a tool to provide suggestions and improve some of the contents or sentences. The ideas, thoughts, opinions, and final products are original and human-made by the author.

 

Leave a Reply

Your email address will not be published. Required fields are marked *