SuperY4Ng's Blog

bwapp(1)

字数统计: 341阅读时长: 1 min
2018/10/08 Share
1
Ps:https://blog.csdn.net/Super_Yiang/article/details/82970499

HTML Injection - Reflected (GET)

low

题目很明显注入,而且提交方式为get,尝试着在输入框分别输入1和1

1
http://192.168.109.130/bWAPP/htmli_get.php?firstname=1&lastname=1&form=submit

下方也会显示

那么尝试注入代码

1
<marquee><h2>You just got hacked!!</h2></marquee>

成功注入

medium

尝试直接注入

1
<marquee><h2>You just got hacked!!</h2></marquee>

注入失败

查看源码发现<和>被转义成&lt;和&gt;

尝试将<和>进行urlencode成%3C和%3E进行注入

1
%3Cmarquee%3E%3Ch2%3EYou just got hacked!!%3C/h2%3E%3C/marquee%3E

成功绕过并注入

high

高级别的直接放源码审计吧

1
2
3
4
5
6
7
8
9
10
11
12
13
function xss_check_3($data, $encoding = "UTF-8")
{

// htmlspecialchars - converts special characters to HTML entities
// '&' (ampersand) becomes '&amp;'
// '"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set
// "'" (single quote) becomes '&#039;' (or &apos;) only when ENT_QUOTES is set
// '<' (less than) becomes '&lt;'
// '>' (greater than) becomes '&gt;'

return htmlspecialchars($data, ENT_QUOTES, $encoding);

}

很明显源码中用了htmlspecialchars()这个函数,码一波:

htmlspecialchars() 函数把预定义的字符转换为 HTML 实体。

预定义的字符是:

1
2
3
4
5
& (和号)成为 &amp
" (双引号)成为 &quot
' (单引号)成为 &#039
< (小于)成为 &lt
> (大于)成为 &gt

能力有限,只能观摩一波,浅尝辄止。

CATALOG
  1. 1. HTML Injection - Reflected (GET)
    1. 1.0.0.0.1. low
    2. 1.0.0.0.2. medium
    3. 1.0.0.0.3. high