PHP - Is “include” function secure?

前端 未结 8 838
傲寒
傲寒 2020-12-06 06:28

I\'m using the \"include\" function (e.x. \"include \'header2.php\'\" or \"include \'class.users.php\'\") to add the header or session class in my website. I don\'t really r

8条回答
  •  感情败类
    2020-12-06 07:28

    It all depends on how you implement it. If you specifically set the path, then it's secure. The attack could happen if you allow user input to determine the file path without sanitization or checks.

    Insecure (Directory Traversal)

    
    

    Insecure (URL fopen - If enabled)

    
    

    Insecure

    
    

    Partially Insecure ( *.php files are vulnerable )

    
    

    Secure (Though not sure why anyone would do this.)

    
    

    Secure

    
    

提交回复
热议问题