1. 程式人生 > 其它 >php危險函式彙總(用於眼熟)

php危險函式彙總(用於眼熟)

Php程式碼審計時值得關注的函式。

PHP為例總結,是因為php對於函式的鏈路相對短一些。

所以危險函式的重要性比較高,利用難度也較低一些。

每個函式有不同的用法和引數,還要考慮到php的弱特性等問題,所以審計也沒那麼輕鬆。

下一篇是java程式碼審計,相對複雜一些,篇幅也比較長,也相對詳細吧。

本篇用於總結,一眼看過去這些函式都很熟就好了。

執行程式碼函式:

eval()

assert()

    preg_replace()

    create_function()

    array_map()

    call_user_func()

    call_user_func_array
() array_filter usort uasort()
命令執行函式:

system()
exec()
shell_exec()
passthru()
pcntl_exec()
popen()
proc_open() 
檔案包含函式:

require
include
require_ once
include once 
檔案讀取函式:

    copy

    file_get_contents()

    highlight_file()

    fopen()

    read file()

    fread()

    
fgetss() fgets() parse_ini_file() show_source() file()
資訊洩漏函式:

bool phpinfo() 
Xss:

Update()

Insert()

Echo

Print_R
越權:

Radius

或者使用的框架

PHP SimpleXML 函式:

    __construct()

    addAttribute()

    addChild()

    asXML()

    attributes()

    children()

    getDocNamespaces()

    getName()

    getNamespaces()

    registerXPathNamespace()

    
simplexml_import_dom() simplexml_load_file() simplexml_load_string() xpath()
序列化函式:

    serialize()

unserialize()

魔法函式:

    __construc()

    __destruct()

    __call()

    __callStatic()

    __get()

    __set()

    __isset()

    __unset()

    __sleep()

    __wakeup()

    __toString()

    __invoke()

    __set_state()

    __clone()

    __debuginfo() 
常見的漏洞函式:

Intval()

switch()

In_array()

Unset()

Ini_set()

MD5 compare//這個利用了PHP處理雜湊字串的特性

Ereg()

Strcmp()//5.3以前的版本

Is_numeric()

Sha1和md5無法處理陣列

Parse_str()

每個函式的功能和引數決定了其利用方式,所以php程式碼審計重點在於傳參上。//個人觀點

不懂得函式參考:www.php.net