github-vet / github-vet/rangeloop-pointer-findings
hahwul/dalfox: pkg/scanning/scan.go; 73 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [hahwul/dalfox](https://www.github.com/hahwul/dalfox) at [pkg/scanning/scan.go](https://github.com/hahwul/dalfox/blob/1a8e2679d4a8b5c9b71ab1b4f93f2be6928002aa/pkg/scanning/scan.go#L727-L799)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
> range-loop variable k used in defer or goroutine at line 784
[Click here to see the code in its original context.](https://github.com/hahwul/dalfox/blob/1a8e2679d4a8b5c9b71ab1b4f93f2be6928002aa/pkg/scanning/scan.go#L727-L799)
Click here to show the 73 line(s) of Go which triggered the analyzer.
```go
for k := range paramsQue {
if (options.UniqParam == "") || (options.UniqParam == k) {
//tempURL := u
//temp_q := u.Query()
//temp_q.Set(k, v[0]+"DalFox")
/*
data := u.String()
data = strings.Replace(data, k+"="+v[0], k+"="+v[0]+"DalFox", 1)
tempURL, _ := url.Parse(data)
temp_q := tempURL.Query()
tempURL.RawQuery = temp_q.Encode()
*/
tempURL, _ := optimization.MakeRequestQuery(target, k, "DalFox", "PA", "toAppend", "NaN", options)
var code string
//tempURL.RawQuery = temp_q.Encode()
rl.Block(tempURL.Host)
resbody, resp, _, vrs, _ := SendReq(tempURL, "DalFox", options)
if vrs {
code = CodeView(resbody, "DalFox")
code = code[:len(code)-5]
pointer := optimization.Abstraction(resbody, "DalFox")
smap := "Injected: "
tempSmap := make(map[string]int)
for _, v := range pointer {
if tempSmap[v] == 0 {
tempSmap[v] = 1
} else {
tempSmap[v] = tempSmap[v] + 1
}
}
for k, v := range tempSmap {
smap = smap + "/" + k + "(" + strconv.Itoa(v) + ")"
}
params[k] = append(params[k], smap)
var wg sync.WaitGroup
mutex := &sync.Mutex{}
chars := GetSpecialChar()
for _, c := range chars {
wg.Add(1)
char := c
/*
tdata := u.String()
tdata = strings.Replace(tdata, k+"="+v[0], k+"="+v[0]+"DalFox"+char, 1)
turl, _ := url.Parse(tdata)
tq := turl.Query()
turl.RawQuery = tq.Encode()
*/
/* turl := u
q := u.Query()
q.Set(k, v[0]+"DalFox"+string(char))
turl.RawQuery = q.Encode()
*/
go func() {
defer wg.Done()
turl, _ := optimization.MakeRequestQuery(target, k, "dalfox"+char, "PA", "toAppend", "NaN", options)
rl.Block(tempURL.Host)
_, _, _, vrs, _ := SendReq(turl, "dalfox"+char, options)
_ = resp
if vrs {
mutex.Lock()
params[k] = append(params[k], char)
mutex.Unlock()
}
}()
}
wg.Wait()
params[k] = append(params[k], code)
}
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 1a8e2679d4a8b5c9b71ab1b4f93f2be6928002aa
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.