Giter VIP home page Giter VIP logo

Comments (2)

suukii avatar suukii commented on May 24, 2024 1

概念

运营商劫持是指运营商(某动、某信、某通)为了卖广告或者其他经济利益,劫持了用户的访问,比较常见的有两种劫持方式:DNS 劫持HTTP劫持

DNS 劫持

DNS 解析返回错误的 IP 地址,把用户导航到广告页或者其他恶意网站。

这种方式现在好像是受管制的。

HTTP劫持

在 HTTP 劫持中,DNS 解析没有问题,但在用户和网站进行交互通信的过程中,运营商劫持了用户的请求,自己也给用户返回了一段脚本,向网页中插入弹窗广告之类的。或者是运营商把用户的目标网站的响应资源缓存在了自己的服务器上,后续用户再请求这个网站时,就把用户路由到运营商自己的服务器上,直接返回缓存的资源,不再请求目标服务器,节省流量。

HTTPS劫持

不懂。

防御

如果是针对运营商向正常页面中插入内容这个行为,可以通过:

  • CSP script-src 指令设置白名单
  • 改写 document.write() + 白名单过滤,不允许插入未知的 <script> 标签(不过插入元素又不止document.write()这一个方法)
  • MutationObserver 监听 DOM 变化,发现不正常的节点就把它移除

其他:

不知道。

工程化

我 · 不 · 会。

from fe-interview.

stale avatar stale commented on May 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from fe-interview.

Related Issues (20)

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.