我正在使用一些将某些字符“<”、“>”、“&”列入黑名单的软件对于用户提交的值。
显示提交的结果时,它不是对值进行 HTML 编码(在表格中输出所有提交的结果)。
它将值存储在 Sql Server 中的 nvarchar 字段中。
你能在这种黑名单方式中找到XSS漏洞吗?
看看是否可以让软件供应商对输出进行 HTML 编码。
编辑
我发现表中的值首先作为 JavaScript 变量输出,然后添加到页面中。
javascript 中的值是 javascript 编码的。 javascript 编码正在完成它的工作并转义字符串变量中的值。
我正在寻找从此 javascript 字符串变量呈现的 html 中的 xss 漏洞。
失败的想法
鉴于使用了 javascript,尝试使用 javascript unicode 表示 >
"\u003cscript\u003ealert('hi');\u003/script\u003e"
然而,如上所述,javascript 编码器正在完成它的工作,只是输出为文本。
I'm using some software that is blacklisting certain characters "<", ">", "&" for user submitted values.
It isn't HTML encoding the values when displaying the submitted results (outputs all submitted results in a table).
It stores the values in a nvarchar field in Sql Server.
Can you find a XSS vulnerability in this blacklist approach?
Looking to see if can get software vendor to HTML encode the output.
EDIT
I've found that the values in the table are first output as javascript variables, and then added to the page.
The values in the javascript are javascript encoded. The javascript encoding is doing it's job and escapes values in the string variables.
I'm looking for xss vulnerabilities in the html rendered from this javascript string variable.
Failed Ideas
Given that uses javascript, had a go with javascript unicode representation of < >
"\u003cscript\u003ealert('hi');\u003/script\u003e"
However as mentioned above javascript encoder is doing it's job, and just outputs as text.
发布评论
评论(1)
我知道这已经很旧了,但是将尖括号列入黑名单并不能在所有情况下防止 XSS。
一个反例是,如果您将用户输入放入 HTML 属性中;例如,使用他们的电子邮件创建一个 mailto 链接。
如果他们输入此地址作为电子邮件地址:
他们对您的网站进行了XSS攻击。
I know this is old, but blacklisting angle brackets does NOT prevent XSS in all cases.
A counter-example is if you put user input into an HTML attribute; e.g. creating a mailto link with their email.
If they enter this as their email address:
They have XSS'd your website.