How to hack by SQL

This appeared to be an entirely custom application, and we had no prior knowledge of the application nor access to the source code: this was a “blind” attack. A bit of poking showed that this server ran Microsoft’s IIS 6 along with ASP.NET, and this suggested that the database was Microsoft’s SQL server: we believe that these techniques can apply to nearly any web application backed by any SQL server.

The login page had a traditional username-and-password form, but also an email-me-my-password link; the latter proved to be the downfall of the whole system.

When entering an email address, the system presumably looked in the user database for that email address, and mailed something to that address. Since my email address is not found, it wasn’t going to send me anything.

So the first test in any SQL-ish form is to enter a single quote as part of the data: the intention is to see if they construct an SQL string literally without sanitizing. When submitting the form with a quote in the email address, we get a 500 error (server failure), and this suggests that the “broken” input is actually being parsed literally. Bingo.

http://www.unixwiz.net/techtips/sql-injection.html

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • E-mail this story to a friend!
  • MySpace
  • StumbleUpon

Comments

Leave a Reply




  • About

    HD Techblog is a collection of knowledge about Information Technology from HD Expertise. We, HD engineers, contribute many different topics from small technical things like programming tips to broad view such as technology trends, business review. Our aim is to help you to find useful knowledge for your work from our expertise.