Skip to content

Infinite recursion on modern web apps returning same-size fallback pages #1492

Description

@pentest0099

Description

When scanning modern web apps (e.g. React/Next.js/Angular) in recursive mode, dirsearch often loops infinitely because the target returns identical-sized responses (e.g. fallback index.html) for non-existent paths.
This causes repeated recursion with no new results.

Steps to Reproduce
dirsearch -u https://target.site/ -r --deep-recursive -i 200 --recursion-status 200,403
All subpaths return the same response size and dirsearch keeps scanning endlessly.

Expected Behavior

If the same (status_code, response_size) repeats several times for a base path, dirsearch should:

Stop recursion on that path.

Log a message indicating repeated identical responses

Proposed Solution

Add a limit and skip behavior:

CLI option: --max-same-size (default 5)

Internal logic example:
seen_sizes[base][(status, size)] += 1
if seen_sizes[base][(status, size)] > max_same_size:
skip_recursion(base)

Why

Modern apps return same-size fallback pages for all routes — current recursion logic misinterprets them as valid directories

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions