hypothermic/phpxssblock
Composer 安装命令:
composer require hypothermic/phpxssblock
包简介
Block the dirty script kiddies who are trying to use XSS on your web forms!
README 文档
README
Block the IP Addresses of clients who are trying to exploit your website by using XSS.
Usage
See the form.php example to get a better view of how to implement this library.
At the top of each page, put:
<?php use HypothermicIT\XSSBlock\XBlock; if (XBlock::isBlocked($_SERVER['REMOTE_ADDR'])) { include 'my-error-page.html'; exit(); } ?>
And, when handling user input, validate each $_GET and $_POST through the XBlock Sanitize Method:
$username = XBlock::Sanitize($_GET["username"], $_SERVER['REMOTE_ADDR']); // For example, show it as a HTML paragraph. echo("<p>Hello " . $username . "</p>");
Database
This library requires a database to store the list of blocked IP's. It is very simple to set up the database, and an implementation for MySQL/MariaDB is included by default. You will only need to create the database user and you're set.
CREATE USER IF NOT EXISTS `xssblock-user`@`localhost` IDENTIFIED BY "change_me!"; CREATE DATABASE IF NOT EXISTS `XSSBlock`; USE `XSSBlock`; CREATE TABLE IF NOT EXISTS `XSSBlock`.`Registry` (`ip_addr` varchar(48) NOT NULL PRIMARY KEY) ENGINE=InnoDB DEFAULT CHARSET=utf8; GRANT SELECT, INSERT ON `XSSBlock`.`Registry` TO `xssblock-user`@`localhost`;
By default, the MySQL implementation will try to connect to localhost:3306 with user xssblock-user.
You may change the settings in config.php
Weaknesses
Of course, this project is more to scare off attackers than to provide security. The red screen surely looks scary and discouraging.
Keep in mind that a smart attacker could "change" his IP address by using a proxy/vpn or by connecting to the Tor network.
hypothermic/phpxssblock 适用场景与选型建议
hypothermic/phpxssblock 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「block」 「xss」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hypothermic/phpxssblock 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hypothermic/phpxssblock 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hypothermic/phpxssblock 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Block routes by IP
An HTML/XHTML filter written in PHP. Checks on attribute values. Can be used to avoid Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks, among other things.
See how Matrix and Neo blocks are being used across your sections.
Prevent crawlers from creating a session
A jQuery augmented PHP library for creating and validating HTML forms
This module is designed to provide a special alerts feed block for Howard University
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-27
