Home > Backend Development > PHP Tutorial > How to prevent utf-7 reflected xss vulnerability in php.

How to prevent utf-7 reflected xss vulnerability in php.

WBOY
Release: 2016-08-04 09:21:55
Original
1161 people have browsed it

Using the yii1.1 framework

<code>        $req = Yii::app()->request;
        $purifier = new CHtmlPurifier();
        $purifier->options = array(
            'URI.AllowedSchemes'=>array(
                'http' => true,
                'https' => true,
            )
        );
            $url = $purifier->purify($req->getParam('url'));</code>
Copy after login
Copy after login

All parameters are filtered using purify. But there is still this loophole. Please tell me how to solve it. Is there a better solution for liberation?

Reply content:

Using the yii1.1 framework

<code>        $req = Yii::app()->request;
        $purifier = new CHtmlPurifier();
        $purifier->options = array(
            'URI.AllowedSchemes'=>array(
                'http' => true,
                'https' => true,
            )
        );
            $url = $purifier->purify($req->getParam('url'));</code>
Copy after login
Copy after login
All parameters are filtered using purify. But there is still this loophole. Please tell me how to solve it. Is there a better solution for liberation?

1 Custom method to filter common xss attack tags: script|iframe|image/Uis

2 Configuration direction to consider: Set httponly to prohibit obtaining cookies

3 Service direction: Use SSL protocol and prohibit loading of external js

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template