Book Image

Mastering Mambo : E-Commerce, Templates, Module Development, SEO, Security, and Performance

By : Christian Wenz, Tobias Hauser
Book Image

Mastering Mambo : E-Commerce, Templates, Module Development, SEO, Security, and Performance

By: Christian Wenz, Tobias Hauser

Overview of this book

<p>Mambo is a PHP-based Open Source CMS. Mambo is both easy to use at the entry level for creating basic websites, while having the power and flexibility to support complex web applications. <br /> <br /> Mambo implements the core requirements of a full featured CMS. It has a powerful and extensible templating system with the ability to upload and manage many different data types. User access control, content approval, rich administrative control, content display scheduling are all built-in. New features and extensions are constantly added to the core system, with many more being available and supported by the community.<br /> <br /> Most of the Mambo development team now works on a fork of Mambo known as Joomla. Mastering Mambo is fully compatible with Joomla's 1.0 release.</p>
Table of Contents (18 chapters)
Mastering Mambo
Credits
About the Authors
Preface
Index

SQL Injection


Take a look at another real-life example from an old Mambo version (Mambo 4.5 Stable 1.0.3, pathway.php file), easily compressed and customized:

$id = mosGetParam( $_REQUEST, 'id', 0 );
if ($id) {
  $database->setQuery( "SELECT title FROM #__categories WHERE id=$id" );
}

Code of this design is in innumerable software products, articles, and books even today. The user data are transferred unchecked directly to SQL commands. The $id PHP variable with the already familiar mosGetParam() auxiliary function comes directly from $_REQUEST and thus, for example, from the URL. This attack is called SQL Injection, and depending on type of database and application, is more or less terrible.

What would work in a lot of databases is to capitalize on the gap by means of the following URL:

http://servername/mambo/index.php?option=content&task=view&itemid=1&id=0;%20DROP%20TABLE%
20#__categories%3B

Now the SQL command with the user data looks as follows:

SELECT title FROM #__categories...