Skip to content
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
3 changes: 3 additions & 0 deletions pkg/fuzz/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package fuzz
import (
"fmt"
"io"
"maps"
"regexp"
"strings"

Expand Down Expand Up @@ -222,6 +223,8 @@ func (rule *Rule) evaluateVars(input string) (string, error) {
func (rule *Rule) evaluateVarsWithInteractsh(data map[string]interface{}, interactshUrls []string) (map[string]interface{}, []string) {
// Check if Interactsh options are configured
if rule.options.Interactsh != nil {
data = maps.Clone(data)

interactshUrlsMap := make(map[string]struct{})
for _, url := range interactshUrls {
interactshUrlsMap[url] = struct{}{}
Expand Down
32 changes: 32 additions & 0 deletions pkg/fuzz/execute_race_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package fuzz

import (
"sync"
"testing"

"github.com/projectdiscovery/nuclei/v3/pkg/protocols"
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/interactsh"
)

func TestEvaluateVarsWithInteractsh_RaceCondition(t *testing.T) {
rule := &Rule{}
rule.options = &protocols.ExecutorOptions{
Interactsh: &interactsh.Client{},
}

sharedData := map[string]interface{}{
"var1": "value1",
"var2": "{{var1}}_suffix",
"var3": "prefix_{{var1}}",
}

var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
rule.evaluateVarsWithInteractsh(sharedData, nil)
}()
}
wg.Wait()
}
Loading