Skip to content

Fix false positives in large-response comparison fallback#6062

Open
ebrasha wants to merge 1 commit into
sqlmapproject:masterfrom
ebrasha:bugfix/large-response-fallback-fp
Open

Fix false positives in large-response comparison fallback#6062
ebrasha wants to merge 1 commit into
sqlmapproject:masterfrom
ebrasha:bugfix/large-response-fallback-fp

Conversation

@ebrasha
Copy link
Copy Markdown

@ebrasha ebrasha commented May 30, 2026

What changed

This PR fixes a false-positive issue in SQLi detection when response comparison falls back for very large pages (or when SequenceMatcher is skipped).

Previously, in that fallback path we only compared response lengths.
That meant two completely different large responses with similar sizes could produce a high ratio and be treated as similar, which could lead to incorrect injection signals.

The fallback now uses lightweight sampled content similarity instead of raw length-only comparison:

  • Responses are normalized to bytes
  • Multiple fixed windows are sampled across the response (start/middle/end)
  • Byte-level similarity is calculated from sampled chunks
  • Final score is combined with length ratio as a secondary signal

Why this is better

  • Reduces false positives caused by length-only matching
  • Keeps fallback path fast for large responses
  • Preserves existing normal comparison behavior for non-fallback paths
  • Improves robustness for large JSON/CSV/binary-like payload responses

Scope

Only lib/request/comparison.py is updated.
No behavioral change intended outside the large-response/skip-seqmatcher fallback branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant