Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only custom payload should not insert base xss payloads #568

Merged
merged 3 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions CONTRIBUTORS.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 31 additions & 29 deletions pkg/scanning/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,36 +270,38 @@ func Scan(target string, options model.Options, sid string) (model.Result, error
vStatus[k] = false
}

// set path base XSS
for k, v := range options.PathReflection {
if strings.Contains(v, "Injected:") {
// Injected pattern
injectedPoint := strings.Split(v, "/")
injectedPoint = injectedPoint[1:]
for _, ip := range injectedPoint {
var arr []string
if strings.Contains(ip, "inJS") {
arr = optimization.SetPayloadValue(getInJsPayload(ip), options)
}
if strings.Contains(ip, "inHTML") {
arr = optimization.SetPayloadValue(getHTMLPayload(ip), options)
}
if strings.Contains(ip, "inATTR") {
arr = optimization.SetPayloadValue(getAttrPayload(ip), options)
}
for _, avv := range arr {
var tempURL string
if len(parsedURL.Path) == 0 {
tempURL = target + "/" + avv
} else {
split := strings.Split(target, "/")
split[k+3] = split[k+3] + avv
tempURL = strings.Join(split, "/")
// set path base XSS if only custom payload is not set
if !options.OnlyCustomPayload {
for k, v := range options.PathReflection {
if strings.Contains(v, "Injected:") {
// Injected pattern
injectedPoint := strings.Split(v, "/")
injectedPoint = injectedPoint[1:]
for _, ip := range injectedPoint {
var arr []string
if strings.Contains(ip, "inJS") {
arr = optimization.SetPayloadValue(getInJsPayload(ip), options)
}
if strings.Contains(ip, "inHTML") {
arr = optimization.SetPayloadValue(getHTMLPayload(ip), options)
}
if strings.Contains(ip, "inATTR") {
arr = optimization.SetPayloadValue(getAttrPayload(ip), options)
}
for _, avv := range arr {
var tempURL string
if len(parsedURL.Path) == 0 {
tempURL = target + "/" + avv
} else {
split := strings.Split(target, "/")
split[k+3] = split[k+3] + avv
tempURL = strings.Join(split, "/")
}
// Add Path XSS Query
tq, tm := optimization.MakeRequestQuery(tempURL, "", "", ip, "toAppend", "NaN", options)
tm["payload"] = avv
query[tq] = tm
}
// Add Path XSS Query
tq, tm := optimization.MakeRequestQuery(tempURL, "", "", ip, "toAppend", "NaN", options)
tm["payload"] = avv
query[tq] = tm
}
}
}
Expand Down
Loading