add urlSuffix support to DomBasedXSS

This commit is contained in:
Erik Krogh Kristensen 2020-03-26 15:47:59 +01:00
Родитель a850616927
Коммит 6b507c6933
1 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -23,5 +23,33 @@ module DomBasedXss {
or
node instanceof Sanitizer
}
override predicate isAdditionalLoadStoreStep(
DataFlow::Node pred, DataFlow::Node succ, string predProp, string succProp
) {
exists(DataFlow::PropRead read |
pred = read.getBase() and
succ = read and
read.getPropertyName() = "hash" and
predProp = "hash" and
succProp = urlSuffixPseudoProperty()
)
}
override predicate isAdditionalLoadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
exists(DataFlow::MethodCallNode call, string name |
name = "substr" or name = "substring" or name = "slice"
|
call.getMethodName() = name and
not call.getArgument(0).getIntValue() = 0 and
pred = call.getReceiver() and
succ = call and
prop = urlSuffixPseudoProperty()
)
}
}
private string urlSuffixPseudoProperty() {
result = "$UrlSuffix$"
}
}