In today's increasingly prosperous commercial Internet, website security has always been a hot topic. Information leakage and property losses caused by security vulnerabilities are also undesirable. Currently, websites using PHP as the back-end language dominate. Today we will use PHP to talk about security precautions.
Common ways to invade the system: command injection, cross-site scripting, file inclusion, code injection, SQL injection, XPath injection, HTTP response splitting, file management, file upload, variable override, dynamic function
Session security: httponly settings, domain settings, path settings, cookie duration, secure settings, session fixed, CSRF
Encryption: passwords are stored in clear text, passwords are weakly encrypted, and passwords are stored where attackers can access them File
Authentication and authorization: user authentication, unauthenticated calls to functions or files, password hardcoding
Random functions: rand(), mt_srand and mt_rand()
Special characters and multi-byte encoding: Multi-byte encoding
PHP dangerous functions: buffer overflow, session_destroy() deletion file vulnerability, unset()-zend_hash_del_key_or_index vulnerability
Information leakage: phpinfo
PHP environment: open_basedir settings, allow_url_fopen settings, allow_url_include settings, safe_mode_exec_dir settings, magic_quote_apc settings, register_globals settings, safe_mode settings, session_usee_trans_sid settings, displiay_errors settings, expose_php settings
XSS injection point: HTML element , element attribute value, URL query, CSS attribute value, Javascript variable
Related reading;
php safe URL string base64 encoding and Decoding example code
php Security filter function example code
for you Introducing 5 PHP security measures_PHP tutorial
The above is the detailed content of Common PHP security issues and how to deal with them. For more information, please follow other related articles on the PHP Chinese website!