Skip to content

Commit 33dbb51

Browse files
fix unresolved interactsh-url variable with fuzzing (#5289)
* fix unresolved interactsh variable with fuzzing * fix variables override with fuzzing
1 parent f930e9a commit 33dbb51

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

pkg/fuzz/execute.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,12 @@ func (rule *Rule) evaluateVarsWithInteractsh(data map[string]interface{}, intera
167167
if rule.options.Interactsh != nil {
168168
// Iterate through the data to replace and evaluate variables with Interactsh URLs
169169
for k, v := range data {
170+
value := fmt.Sprint(v)
170171
// Replace variables with Interactsh URLs and collect new URLs
171-
got, oastUrls := rule.options.Interactsh.Replace(fmt.Sprint(v), interactshUrls)
172-
172+
got, oastUrls := rule.options.Interactsh.Replace(value, interactshUrls)
173+
if got != value {
174+
data[k] = got
175+
}
173176
// Append new OAST URLs if any
174177
if len(oastUrls) > 0 {
175178
interactshUrls = append(interactshUrls, oastUrls...)

pkg/fuzz/parts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ func (rule *Rule) execWithInput(input *ExecuteRuleInput, httpReq *retryablehttp.
181181
// for fuzzing.
182182
func (rule *Rule) executeEvaluate(input *ExecuteRuleInput, _, value, payload string, interactshURLs []string) (string, []string) {
183183
// TODO: Handle errors
184-
values := generators.MergeMaps(input.Values, map[string]interface{}{
184+
values := generators.MergeMaps(rule.options.Variables.GetAll(), map[string]interface{}{
185185
"value": value,
186-
}, rule.options.Options.Vars.AsMap(), rule.options.Variables.GetAll())
186+
}, rule.options.Options.Vars.AsMap(), input.Values)
187187
firstpass, _ := expressions.Evaluate(payload, values)
188188
interactData, interactshURLs := rule.options.Interactsh.Replace(firstpass, interactshURLs)
189189
evaluated, _ := expressions.Evaluate(interactData, values)

pkg/protocols/common/interactsh/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
var (
1010
defaultInteractionDuration = 60 * time.Second
11-
interactshURLMarkerRegex = regexp.MustCompile(`{{interactsh-url(?:_[0-9]+){0,3}}}`)
11+
interactshURLMarkerRegex = regexp.MustCompile(`(%7[B|b]|\{){2}(interactsh-url(?:_[0-9]+){0,3})(%7[D|d]|\}){2}`)
1212

1313
ErrInteractshClientNotInitialized = errors.New("interactsh client not initialized")
1414
)

0 commit comments

Comments
 (0)