GithubHelp home page GithubHelp logo

igit-cn / httphijack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chokcoco/httphijack

0.0 1.0 0.0 23 KB

使用Javascript实现前端防御http劫持及防御XSS攻击,并且对可疑攻击进行上报

JavaScript 77.99% HTML 22.01%

httphijack's Introduction

httphijack

使用 Javascript 实现前端防御 http劫持 及防御 XSS攻击,并且对可疑攻击进行上报。

About

【前端安全】JavaScript防http劫持与XSS

Usage

引入 httphijack1.0.0.js

<script type="text/javascript" src='./httphijack1.0.0.js'></script>

<script>
	window.httphijack.init();
</script>   

Features:

  • 所有内联 on* 事件执行的代码
  • a标签 href 属性 javascript: 内嵌的代码
  • 静态脚本、iframe 等恶意内容
  • 动态添加的脚本文件、iframe 等恶意内容
  • document-write添加的内容
  • 页面被 iframe 嵌套劫持

Tips:

建立自己的域名白名单、关键字黑名单、上报系统及接收后端。

防御 XSShttp劫持,更多的还是得依靠 https 等非 JavaScript 技术,高明的攻击者可以绕过任何 JavaScript 防护。

组件未在生产环境使用,使用了很多 HTML5 才支持的 API,仅供学习交流。

License

MIT

httphijack's People

Contributors

chokcoco avatar hetykai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.