0

I was recently given a subdomain to try and exploit with SQLi: gov.ns.agency. Unlike what I would see in most tutorials, I can't really inject parameters into the URL like I would see everywhere else.

Here's what I tried:

  1. At the login page, any username sufficed with password: ' OR '1'='1 and I'm directed to gov.ns.agency/users. Here a form returns whether a user exists. I'm supposed to get info from columns 'name' and 'pass' from table 'users'. There's a hint also that MySQL is the database and the requests sent are GET and not POST with the exception of some queries which return a 500 Internal Server Error.

  2. 'UNION ALL SELECT NULL,version()'--returned MySQL version 8.0.11 - omitting single quotes would return 'user not found'.

  3. 'UNION SELECT 'Found', COLUMN_NAME FROM information_schema.columns WHERE table_name = 'users' AND column_name LIKE 'pa% returned [name]Found -> [priv]pass. I'm still scratching my head over what 'priv' is, it might describe privileges? admin perhaps?

  4. 'UNION ALL SELECT NULL,concat(schema_name) FROM information_schema.schemata' this would give DB names but instead gave me a 500 Internal Server Error.

I'm quite new to penetration testing and I'm not sure which query would get the tables and even how I'd use tools such as SQLMap or Burpsuite to do it, or even how I'd approach this kind of site where I can't even inject queries into the URL (normally ending in .php?id=123) so any tips would be greatly appreciated!

  • This works for me: ' UNION ALL SELECT NULL,group_concat(schema_name SEPARATOR ',') FROM information_schema.schemata # – Siguza Jun 7 '18 at 13:34
0

To begin with, you say you're not sure which query would get the tables, so in my opinion you should do a crash course in SQL.

Sqlmap and burpsuite are webapp pentesting tools which can be found in pentesting distros like Kali Linux, or if you don't want to install a new distro you can download them and install them in your computer. Apart from Sqlmap and burpsuite there are many others webapp pentesting tools, like nikto, owasp-zap and others...

You also mention you are not sure on how to approach a site you want to hack. Webapps have different vulnerabilities other than Sqli, I recommend you to read this carefully (OWASP top ten).

  • 1
    I'm sorry but I think you misunderstood my question. I was bringing up the specific example of gov.ns.agency. There, the nature of the replies to the queries is such that I can't extract whole tables for this specific example. For DVWA and Mutillidae this is not a problem as just about every tutorial will get you started. If you have spare time on your hands, I think you should visit it once and try it out, I think you'll see what I mean, it's a bit difficult to describe in words alone. – Calahan Jun 7 '18 at 9:20
  • Have you tried to exploit it using SQLi POST method? – SleetyNine018 Jun 7 '18 at 20:38
-1

sqlmap -u "http://vuln.url/x.php?param1=..."

You can add --dbms parameter like --dbms=myqsl if you're sure about the database used or --forms to inject the form in the page.

  • I see, so let me try to understand this: in my case this would work with: sqlmap -u "gov.ns.agency/users" along with --dbms and --forms despite there being no parameters to inject into the URL? – Calahan Jun 7 '18 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.