信息来源:幻影
eric butera emailed me with a very interesting topic about protecting against php_self exploits. i thought it might be a good idea to gather a few test cases demonstrating the problem. why php allows these url’s is beyond me and it wouldn’t take much work to filter out these malicious url’s in the php code.
For any of you that don’t know, it’s possible to inject code into PHP_SELF. It works by supplying a “/” after the actual PHP file then entering your desired code. I’ve done 4 test cases which show how it’s possible to inject javascript and perform a redirect on code which doesn’t filter PHP_SELF correctly.
Test case 1Injects data into a HTTP header, although this scenario is not very likely I thought I would include it to show that even running htmlentities or htmlspecialchars won’t save you from attack completely.
Test case 2Shows how easy it is to inject XSS into links, this is very likely as many PHP applications ofter refer to the same page to change the current action/display.
Test case 3A search page often includes references to PHP_SELF and can be exploited as easily as links.
立即学习“PHP免费学习笔记(深入)”;
Test case 4Finally I show how code can be injected directly on the page without the need to break out of anything.
The test cases can be downloaded here:-
Test cases
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号