sqlmap icon indicating copy to clipboard operation
sqlmap copied to clipboard

Use swagger as the source for targets

Open donnd-t opened this issue 4 years ago • 6 comments

Parse a JSON swagger document describing all APIs, for possible targets. Specify the swagger document using the --swaggerFile option.

The swagger must contain examples which sqlmap will use as parameter values to inject.

Addresses issue https://github.com/sqlmapproject/sqlmap/issues/3140

donnd-t avatar Sep 28 '21 07:09 donnd-t

I appreciate your effort here, though, how realistic is the scenario where user gets a swagger.json with properly filled example(s)?

stamparm avatar Nov 05 '21 18:11 stamparm

I appreciate your effort here, though, how realistic is the scenario where user gets a swagger.json with properly filled example(s)?

Hi @stamparm . Thanks for your comment. Examples(s) are not required by the swagger spec but it is generally good practice to add them. Adding them has other advantages e.g. Swagger UI will prefill requests from the examples for users browsing and trying your APIs.

It is a small sample size but of the two applications I'm working on in my company, one had full examples already and the other had a handful missing which I was able to add in a few minutes.

If an example is missing a warning is printed and that API is skipped. Other APIs with full examples will still be scanned.

donnd-t avatar Nov 12 '21 03:11 donnd-t

Please add this, it is very useful

arnoldasr avatar Sep 09 '22 12:09 arnoldasr

Can you please add more description, I want to use it from your repo even though it is not merged

sahin52 avatar Oct 18 '22 10:10 sahin52

I tried this, it has bugs + there is no document or something that tells how it works + it doesn't directly work when a swagger is supplied + it doesn't run after doing everything(getting rid of bugs). This needs a lot of improvements and testing. Thanks for your effort.

sahin52 avatar Oct 18 '22 14:10 sahin52

While I think you shouldnt find such swagger files in production, I like the idea for security tests while development.

janmaterne avatar Oct 24 '22 06:10 janmaterne