当前位置:网站首页>Quick reference table of PHP security configuration maintained by OWASP
Quick reference table of PHP security configuration maintained by OWASP
2022-06-24 06:14:00 【User 1685462】
Introduce
The purpose of this page is to help those configurations PHP And running it web The server's people ensure its security .
Below you will find information about php.ini Correct configuration information of the file .
php.ini
Some of the following settings need to be adapted to your system , especially session.save_path, session.cookie_path ( for example : /var/www/mysite), and session.cookie_domain ( for example :ExampleSite.com).
You should also run PHP 7.2 Or higher . If you are running a version of PHP 7.0 and PHP 7.1 , You will use slightly different values in the following places ( Look at the inline comments ). Last , see PHP file To get information about php.ini Reference to each value in the configuration file .
You can do it in a ready-made php.ini A copy of the following configuration was found in the file here .
PHP Error handling
expose_php = Off error_reporting = E_ALL display_errors = Off display_startup_errors = Off log_errors = On error_log = /valid_path/PHP-logs/php_error.log ignore_repeated_errors = Off
Please note that : You need to be in a production environment display_errors Set to Off, At the same time, it's best to get into the good habit of checking these logs often .
PHP General settings
doc_root = /path/DocumentRoot/PHP-scripts/ open_basedir = /path/DocumentRoot/PHP-scripts/ include_path = /path/PHP-pear/ extension_dir = /path/PHP-extensions/ mime_magic.magicfile = /path/PHP-magic.mime allow_url_fopen = Off allow_url_include = Off variables_order = "GPCS" allow_webdav_methods = Off session.gc_maxlifetime = 600
allow_url_* It's easy to happen LFI also RFI Complete vulnerability .
PHP Upload file processing
file_uploads = On upload_tmp_dir = /path/PHP-uploads/ upload_max_filesize = 2M max_file_uploads = 2
If your app doesn't use file upload , In other words, the only way for users to input and upload is to submit through the form without document attachments , file_uploads Should be set to Off.
PHP Executable processing
enable_dl = Off disable_functions = system, exec, shell_exec, passthru, phpinfo, show_source, highlight_file, popen, proc_open, fopen_with_path, dbmopen, dbase_open, putenv, move_uploaded_file, chdir, mkdir, rmdir, chmod, rename, filepro, filepro_rowcount, filepro_retrieve, posix_mkfifo # Please check out :http://ir.php.net/features.safe-mode disable_classes =
Above is PHP There are dangerous methods and classes in .. You should disable methods and classes that will not be used .
PHP session Handle
Session There are some important values in the settings , take session.name Changing to a new one is a good exercise .
session.save_path = /path/PHP-session/ session.name = myPHPSESSID session.auto_start = Off session.use_trans_sid = 0 session.cookie_domain = full.qualified.domain.name #session.cookie_path = /application/path/ session.use_strict_mode = 1 session.use_cookies = 1 session.use_only_cookies = 1 session.cookie_lifetime = 14400 # 4 Hours session.cookie_secure = 1 session.cookie_httponly = 1 session.cookie_samesite = Strict session.cache_expire = 30 session.sid_length = 256 session.sid_bits_per_character = 6 # PHP 7.2+ session.hash_function = 1 # PHP 7.0-7.1 session.hash_bits_per_character = 6 # PHP 7.0-7.1
Check for more potential safety hazards
session.referer_check = /application/path memory_limit = 50M post_max_size = 20M max_execution_time = 60 report_memleaks = On track_errors = Off html_errors = Off
边栏推荐
- Optimized the search function of broken websites
- Multi objective Optimization Practice Based on esmm model -- shopping mall
- Analysis of official template of wechat personnel recruitment management system (II)
- "Adobe international certification" design white must understand the color theory, absolutely full of dry goods
- Tencent cloud harbor private warehouse deployment practice
- Idea2020 latest activation tutorial, continuously updated
- Neighbor vote: use proximity voting to optimize monocular 3D target detection (ACM mm2021)
- Groovy script engine practice in complex and changeable scenarios
- ServiceStack. Source code analysis of redis (connection and connection pool)
- Get the short video! Batch download of Kwai video (with source code)
猜你喜欢

ServiceStack. Source code analysis of redis (connection and connection pool)

Technology is a double-edged sword, which needs to be well kept

A cigarette of time to talk with you about how novices transform from functional testing to advanced automated testing

What is the difference between a white box test and a black box test

One line of keyboard
![[fault announcement] one stored procedure brings down the entire database](/img/7c/e5adda73a077fe4b8f04b59d1e0e1e.jpg)
[fault announcement] one stored procedure brings down the entire database

Solution to the 39th weekly game of acwing
随机推荐
Interpretation of Cocos creator source code: siblingindex and zindex
Use of SAP QM inspection points
A plate processing device of network separator which can adapt to different line port positions
Double non students, self-taught programming, counter attack Baidu one year after graduation!
How to use ffmpeg one frame H264 to decode yuv420p in audio and video development?
Analysis of official template of micro build low code (I)
Feign request return value inverse sequence localdatetime exception record
ServiceStack. Source code analysis of redis (connection and connection pool)
Install and use juicefs storage on Tencent cloud
Talk about the story behind search engines
Basic concepts of complex networks
Discussion on NFT Technology
How is a Clickhouse query completed?
Excellent tech sharing | research and application of Tencent excellent map in weak surveillance target location
Increase the dynamic port range to solve TCPIP alarm
CLB unable to access / access timeout troubleshooting
NoClassDefFoundError and classnotfoundexception exceptions
Script updates CLB type ingress Certificate in tke cluster
Tencent security release data security compliance capability map
How to solve the enterprise network security problem in the mixed and multi cloud era?