Javascript 基于DOM的XSS在哪里
我收到一份AppScan安全报告,其中以下代码被标记为“基于DOM的跨站点脚本”: 但我看不出问题出在哪里。我想知道这是否是假阳性。这是没有缩小的原始代码Javascript 基于DOM的XSS在哪里,javascript,xss,Javascript,Xss,我收到一份AppScan安全报告,其中以下代码被标记为“基于DOM的跨站点脚本”: 但我看不出问题出在哪里。我想知道这是否是假阳性。这是没有缩小的原始代码 if (jsonResult !== null && jsonResult.errors) { if (jsonResult.errors[0].Key === "OrderNotFound" || jsonResult.errors[0].Key === "ShoppingCartModified")
if (jsonResult !== null && jsonResult.errors) {
if (jsonResult.errors[0].Key === "OrderNotFound" ||
jsonResult.errors[0].Key === "ShoppingCartModified") {
alert(jsonResult.errors[0].Value); //the problem is here
window.location.href = window.location.href.split("#")[0]; //or here
}
} else {
//uiErrors is a KnockoutJS observableArray that is
//shown in the page using the text binding avoiding any innerHTML injection.
//res = method that returns an error msg string for a given key.
uiErrors([res("GenericErrorMessage")]);
}
jsonResult是ajax调用的响应,它具有以下结构:
{
"errors": [
{"Key": "OrderNotFound", "Value": "Your order could not be found."}
]
}
其中,键和值都不是使用任何用户输入创建的。它们是服务器代码中的常量字符串
添加AppScan输出
[1/1]基于DOM的跨站点脚本
严重程度:高
测试类型:应用程序
易受攻击的URL:
CVE识别号:不适用
CWE ID(s):79
修正任务:分析客户端代码并清理其输入源
1的变体1[ID=1612185601]
请求/答复:
??
v=m9is46e_hmcr4gnmuj4o6xssdozcytmn9flbuxtvbmy1:
1:我!==空错误(&i)?(i.errors[0]。键==“OrderNotFound”||
i、 错误[0]。键===“ShoppingCartModified”)&&(警报(i.errors[0]。值),
window.location.href=window.location.href.split(“#”)[0]):t([s
(“一般错误消息”)])
响应验证:
不适用
理由:
不适用
CWE ID:
79您显示的代码似乎没有任何XSS问题。这可能是假阳性,或者扫描仪没有正确识别问题的位置
可能值得在应用程序上重新运行扫描仪,同时使用完全未统一的代码,以便获得更精确的位置信息;即使它实际上是假阳性,这也会帮助您了解扫描仪的困惑所在。window.location.href=window.location.href.split(“#”)[0] 导致问题的上述代码行。technicallyn split(“#”)将删除#字符后面的值。。但他在这里的要点是:如果我们在“#”字符之前包含注入,会怎么样
protocal://domainname.com/details.htm/“注射剂!@#$XSS”#Helloworld AppScan是否提供了利用漏洞的详细信息?@YuriyGalanter添加了AppScan的详细信息。
{
"errors": [
{"Key": "OrderNotFound", "Value": "Your order could not be found."}
]
}