赞
踩
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> </body> <script> // http://127.0.0.1/domfilter/demo6.html#<img src=1 οnerrοr=alert(1)> const data = decodeURIComponent(location.hash.substr(1)); const root = document.createElement('div'); root.innerHTML = data; // 这里模拟了XSS过滤的过程,方法是移除所有属性 for (let el of root.querySelectorAll('*')) { for (let attr of el.attributes) { el.removeAttribute(attr.name)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。