DVWA Reflected XSS (ALL LEVELS)
文章描述了三种级别的跨站脚本(XSS)攻击测试:低级通过直接注入`<script>`标签触发弹窗;中级利用大小写混合绕过黑名单过滤;高级使用`<img>`标签的`onerror`事件绕过正则表达式过滤。 2025-9-6 05:48:43 Author: infosecwriteups.com(查看原文) 阅读量:8 收藏

Low, Medium and High

Chris Christian

1. Low

Enter your name into the input field and observe the application’s behavior.

Press enter or click to view image in full size

The input is directly reflected in both the URL and the page output beside “Hello”.

View it’s source by selecting “View Source” in the bottom-right corner.

Observe that the application simply echoes back the user-supplied input without any sanitization or encoding.

Inject the following payload into the input field:

<script>alert(1)</script>

Result: A JavaScript alert is successfully executed, confirming the application is vulnerable to reflected XSS at this level.

2. Medium

View the source code.

Observe that this time our previous payload won’t work because the application includes a filter that removes <script> tags.

Since javascript is not a case sensitive language, we can bypass this filter by mixing uppercase and lowercase letters in the tag:

<scRipt>alert(1)</Script>

Result: The alert executes successfully, demonstrating that the blacklist-based filter is insufficient.

Press enter or click to view image in full size

3. High

View the source code.

At this level, the application applies a regex-based replacement that strips variations of <script> tags, including obfuscated ones (e.g., <ScRiPt>, <sCrXXXipt>, <s c r i p t>).

Since the filter specifically targets <script> tags, we must craft a payload that does not rely on them.

Use an alternate injection vector, such as an image element with an error handler:

<img src=x onerror=alert(1)>

The invalid image source (x) triggers an error, which in turn executes the onerror JavaScript handler.

Result: The alert is executed successfully, confirming that the application remains vulnerable despite the regex filter.


文章来源: https://infosecwriteups.com/dvwa-reflected-xss-all-levels-616e561dd674?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh