Categories
PHP

LavaLair SQL Injection Vulnerability: Looking Inside

Lavalair is the name of a very popular mobile chat community software developed using PHP MySQL and WML front end. I was once a serious mobile web developer and worked with mobile web apps a lot.

A few days ago, a Indian boy asked for some help with a wapdesire clone of LavaLair. His site was getting hacked by some so-called “hackers”. My experience with LavaLair told me it was some sort of nasty SQL Injection. After having a look at the script, I found out a intensive SQL Injection vulnerability in the registration page. I wrote a CLI php script to inject some SQL codes.

Here is the tool I used to crack into the target site:

The easiest explanation is that LavaLair by default requires magic_quotes_gpc() to be off and it’s insert SQLs are in the format:

So, it becomes easy to inject some single quotes and hash sign to terminate the script and modify it the way you wish.

My suggestion would be to use Insert SQLs in this way:

And now a little rant about these so called hackers… I have heard lots of stories about AyOn and some other freaks terrorizing the LL community… It’s really funny the way the developers never bothered to learn how these scrip kiddies or so-called hackers managed their way in… From the very beginning, I have used J21Community with magic_quotes_gpc turned on and secure SQL queries. That’s one of the important reasons why no J21Community site has been hacked yet by SQL Injection… 😀

Categories
PHP

Reflection API in PHP

The reflection API works in a similar way of Python’s dir() function. The API provides a rich set of classes to reverse engineer classes, methods, parameters and functions.

Suppose, we want to explore and reverse engineer a class, then use the following code:

For example:

Outputs:

Cool, isn’t it? I loved it ! Thanks to Hasin Hayder for referring me to this API.

Read more at: http://www.php.net/language.oop5.reflection 😉

Categories
PHP Python

Why I like Python more than PHP ?

A friend of mine asked me a few days ago, why I like Python more than PHP given that I am more skilled in PHP than in Python.

Well, here is the answer. I like Python because:

– On my machine, Python is faster than PHP most of the time.

– I have to type less when I am building a decently large app.

– PHP is going to be the language of the future, yeah, but still Python has more features to offer.

– Python has a large collection cool libraries and addtional modules. I did visit PECL repo of PHP. I still prefer Python’s module collection.

– Python has a larger built in module collection.

– Python has a very good interactive shell and many decent IDEs. Even the Gedit I use on my Ubuntu has a python console.

– Debugging is pretty easy. Inspection of objects are easier as well.

– Programs can be converted to bytecode.

– Force indentation makes the code more readable.

– Things are always easier and less time consuming on Python. Just compare the BeautifulSoup with PHP’s SimpleXML and DOM. You’ll get the difference.

– Python is well suited for all sorts of development — desktop apps, web apps or even mobile apps.

And I have many more reasons, but what’s the point writing them in? The simplest answer is Python has won my heart and so I prefer it to PHP. Any objections ?