Repository navigation
Conversation
…lts (sqlmapproject#2503) A scan covering multiple targets inside a single API task (crawl, '-m' bulk file, forms) ran every target through one StdDbOut keyed by the single taskid, so _storeData()'s COMPLETE branch deleted each earlier target's TARGET/TECHNIQUES rows - /scan/<id>/data returned only the last target's results. Mirror the --report-json fix for sqlmapproject#6123: controller.start() now sets kb.reportTaskId per target for API scans too, StdDbOut.write() keys data rows '<taskid>-<n>' per target, and scan_data() folds the per-target rows back into the task's flat result in target order. Single-target scans keep the exact same response shape. Regression tests in tests/test_api.py (TestStdDbOutMultiTarget, TestScanDataMultiTarget).
stamparm
added a commit
that referenced
this pull request
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2503
Problem
When a single REST API task scans more than one target (crawling with
crawlDepth, a-mbulk file, or forms), every target runs through the oneStdDbOutinstance keyed by the single APItaskid. In_storeData(), aCOMPLETEwrite deletes all existing rows for its(taskid, content_type)key before inserting — so each target'sTARGET/TECHNIQUESrows silently deleted the previous target's.GET /scan/<taskid>/dataended up returning only the last target's results. This is exactly what #2503 reported for a crawl via sqlmapapi (onlytest2.php's result came back, itstype: 0entry), and it is the REST API counterpart of #6123, which was fixed for--report-jsononly.Fix (mirrors the #6123 approach)
lib/controller/controller.py—start()now setskb.reportTaskId = targetCountper target for API scans too, not just--report-json.lib/utils/api.py—StdDbOut.write()keys a target's data rows as'<taskid>-<n>'whenkb.reportTaskIdis set (errors/logs still use the plain taskid), andscan_data()folds the per-target rows back into the task's flat{success, data, error}result in target order. Real taskids are dash-less hex, so the'<taskid>-'prefix can only match the task's own rows. Single-target scans keep the exact same response shape.3 files changed, no changes under
thirdparty/orextra/.Evidence (local, against current master
c94f6d0)Reproduced end-to-end with a local two-page vulnerable app (identical
test.php/test2.phpbacked by interpolated SQL) scanned as one API task viabulkFile(boolean-based blind, SQLite):Before — both targets tested and both found injectable (per the scan log), but:
After — 4 entries:
TARGET+TECHNIQUESfor both targets, in scan order. A single-target API scan of the same app still returns exactly its 2 entries, and a CLI-m+--report-jsonrun still produces the two-target report.Tests
tests/test_api.py:TestStdDbOutMultiTarget(per-target keying; no overwrite) andTestScanDataMultiTarget(route-level merge in target order; other tasks' rows ignored). The multi-target tests fail on unpatched code and pass with this change.python -B -m unittest discover -s tests: 2668 tests, only the 27 pre-existing DNS test errors that also occur on unpatched master in this sandbox (UDP/DNS unavailable); no new failures.python sqlmap.py --smoke-test— PASSED;python sqlmap.py --api-test— PASSED; pyflakes clean on the changed files.Disclosure: this change was prepared with AI assistance and verified locally as described above.