【问题标题】:Codeigniter XSS filter not working for image injection?Codeigniter XSS 过滤器不适用于图像注入?
【发布时间】:2017-02-10 11:39:59
【问题描述】:

CI 新手,尽量避免在输入字段中注入一些代码。

在我的登录文本中,我输入了名称,然后是一张图片<img src="http://vignette1.wikia.nocookie.net/markiplier/images/a/a4/EvilGame.jpg/revision/latest?cb=20151015031339" >。 我试过了:

  1. 设置 global_xss_filtering $config['global_xss_filtering'] = TRUE;

  2. $login=$this->input->post('login', TRUE);

  3. $login = $this->security->xss_clean($login);

但是,当我回显 $login 时,以上都不能缓和图像。我是否正确实施了 XSS 过滤器?还是我误解了CI XSS过滤器的用法?

【问题讨论】:

    标签: codeigniter


    【解决方案1】:

    xss_clean() 仅用于过滤输出(对输入不执行任何操作),global_xss_filtering 已被弃用。 Apparently xss_clean was laughably bad in 2011。不知道是不是重写了。

    这里讲的是输入验证

    http://phpsecurity.readthedocs.io/en/latest/Input-Validation.html

    还有这个(有用,但过时)

    What's the best method for sanitizing user input with PHP?

    这里讲的是 XSS 预防。 https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet

    XSS 上也是如此。

    https://paragonie.com/blog/2015/06/preventing-xss-vulnerabilities-in-php-everything-you-need-know

    【讨论】:

    • @ourmandave- 非常感谢。我只是对 CI XSS 过滤器很好奇。而且你的材料很有帮助。
    猜你喜欢
    • 2018-10-04
    • 1970-01-01
    • 1970-01-01
    • 2013-09-26
    • 2013-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多