PHP Code Audit

Source: Internet
Author: User

Preface

The content of this article will continue to enrich and enrich, the early stage will increase some of the previous loopholes to reproduce the process to enrich their actual code audit experience, later if you can dig out new loopholes, it is better.

Code Audit SQL injection: BlueCMSv1.6 SP1

Common output functions

Echo: Outputs a string or variable, but cannot output an array
Print_r: Output An array
Var_dump: Outputs the structure of a variable that contains ordinary variables, arrays, objects

Gets all variables, functions, constants, classes of the current process

Get_defined_vars (void): Returns a multi-bit array of the currently available list of variables, including environment variables, server variables, and user-defined variables

$GLOBALS: Returns all global variables

Get_defined_functions: Gets all defined functions, including intrinsic functions and user-defined functions.

The ==> output user-defined function method is:

$hhh=get_defined_functions(); Var_dump ($hhh[' user ']);

Get_defined_constants (void): Returns all available constants, including system constants and user-defined constants

Get_declared_classes (void): Returns all available classes, including system classes and user-defined classes

Get_include_files (): Returns an array of all the contained file paths

What you need to know about hyper-global variables

$GLOBALS: Referencing all variables available in the global scope

$_server: Saving information about the header, path, and location of the script

$_request

$_post

$_get

$_files

_env

$_cookie

$_session

The most important element of access in $_server

Element/code Describe
$_server[' Php_self '] Returns the file name of the current execution script
$_server[' Gateway_interface '] Returns the version of the CGI specification used by the server
$_server[' Server_addr '] Returns the IP address of the server on which the current run script resides
$_server[' server_name '] Returns the hostname of the server on which the current run script resides (for example, www.w3school.com.cn)
$_server[' Server_software '] Returns the server identification string (such as apache/2.2.24)
$_server[' Server_protocol '] Returns the name and version of the communication protocol when the page is requested (for example: "http/1.0")
$_server[' Request_method '] Returns the request method used by the access page (such as Post)
$_server[' Request_time '] Returns the timestamp at the start of the request (for example, 1577687494)
$_server[' query_string '] Returns the query string, if this page is accessed through a query string
$_server[' Http_accept '] Returns the request header from the current request
$_server[' Http_accept_charset '] Returns the Accept_charset header from the current request (for example, utf-8,iso-8859-1)
$_server[' Http_host '] Returns the Host header from the current request
$_server[' Http_referer '] Returns the full URL of the current page (unreliable, because not all user agents are supported)
$_server[' HTTPS '] Whether the script is queried through the secure HTTP protocol
$_server[' REMOTE_ADDR '] Returns the IP address of the user who browsed the current page
$_server[' Remote_host '] Returns the host name of the user who browsed the current page
$_server[' Remote_port '] Returns the port number used to connect to the WEB server on the user's machine
$_server[' Script_filename '] Returns the absolute path of the current execution script
$_server[' Server_admin '] This value indicates the Server_admin parameter in the Apache server configuration file
$_server[' Server_port '] The port used by the WEB server. The default value is "80"
$_server[' Server_signature '] Returns the server version and the virtual host name
$_server[' path_translated '] The base path of the file system (not the document root) where the current script resides
$_server[' Script_name '] Returns the path of the current script
$_server[' Script_uri '] Returns the URI of the current page

Reference:

PHP Code Audit Link: https://pan.baidu.com/s/1dGiP1Mp Password: ibs0

PHP Code Audit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.