美文网首页我爱编程
由FindFirstFile()所引发的PHP解释器的神奇解析行

由FindFirstFile()所引发的PHP解释器的神奇解析行

作者: PureT | 来源:发表于2018-04-16 22:00 被阅读0次

    由于FindFirstFile()函数处理存在Bug,导致调用了该函数的PHP解释器也引发了一系列的问题。

    在实践中发现以下几个表达式都是可以成功包含文件的(假设1.php存在)

    include('1.php')
    include('1.phP')
    include('1.ph<')
    include('1.ph>')
    

    即可以用<代替*(这意味着可以匹配任意个字符)
    用>代替?(这意味着可以匹配单个字符)
    还可以用"代替.

    不只是include受到影响,凡是PHP解释器调用过FindFirstFile()来处理的函数都存在这样的问题。下面列表都是受影响的函数。

    include()
    include_once()
    require()
    require_once()
    fopen()
    ZipArchive::open()
    copy()
    file_get_contents()
    parse_ini_file()
    readfile()
    file_put_contents()
    mkdir()
    tempnam()
    touch()
    move_uploaded_file()
    opendir()
    readdir()
    rewinddir()
    closedir()
    

    具体在win的哪些版本受到影响大家可以自己实验下。

    关于漏洞的其它详情可以看下: http://www.madchat.fr/coding/php/secu/onsec.whitepaper-02.eng.pdf

    相关文章

      网友评论

        本文标题:由FindFirstFile()所引发的PHP解释器的神奇解析行

        本文链接:https://www.haomeiwen.com/subject/bhlykftx.html