代码点火器 XSS 过滤器问题


CodeIgniter XSS Filter issues

application/controlers/welcome.php

<?php
class Welcome extends CI_Controller {
    public function index()
    {
        if ($val = $this->input->post('test'))
        {
            var_dump($val);
        }
        else
        {
            $this->load->view('welcome_message');
        }
    }
}

应用程序/视图/weclome_message.php

<form action="" method="POST">
<input type="text" name="test" />
<input type="submit" />
</form>

带有 XSS 过滤器 ON 和输入 %9c 的输出:

string(1) "œ"

带有 XSS 过滤器 OFF 和输入 %9c 的输出:

string(3) "%9c"

我期望第一个与第二个值相同。到底发生了什么?

我认为这是因为

$str = rawurldecode($str);

在xss_clean功能中。请看第 346 行:

https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Security.php

您可以尝试对该行进行注释,看看会发生什么。