Ultra Light Blog SQL Injection
Posted on 08 November 2016
Ultra Light Blog - SQL Injection Authentication Bypass ======================================================= Discovered by N_A , N_A [at] tutanota.com =========================================== Description ============ Ultra Light blog, based on PHP & MySQL, also comes with CAPTCHA to stop bots. After registering user can create, post topic or send/check messages. User can also change their profile images, about me message and more ! -Sourav Ghosh www.web-shine.in https://sourceforge.net/projects/ultralightblog Vulnerability ============= An SQL Injection vulnerability exists within Ultra Light Blog that allows remote attackers to compromise and take ownership of the blog with full permissions. The vulnerability resides within the login.php file of the blog package: if ($_SESSION["name"] != "" && $_SESSION["msg"] != "" && $_SESSION["id"] != "") { $name = $_SESSION["name"]; $msg = $_SESSION["msg"]; $id = $_SESSION["id"]; .... .... ....A $query="select id,name from login where id = '$id' and name = '$name'"; $rs=mysql_query($query,$conn); $flag=mysql_num_rows($rs); The $query variable is where the injection can occur due to the remote attacker being able to control $id and $name. Exploition and Proof of Concept ================================ The exploitation requires 2 parts: 1) A *valid* username 2) The SQL Injection string 1) If you do not have a valid user name then use any of the following: A A A user, admin ,system ,roote , web-shine As stated in the new_user.php file: A if ($id == "user" || $id == "admin" || $id == "system" || $id == "roote" || $id == "web-shine") A A A $err = "Sorry, you have typed a Reserved ID.<br>"; The Blog package reserves certain usernames and they are by default inside the SQL tables. How ever,A the line below this does not allow logins of a length below 6 characters: if (strlen($id) <6 || strlen($id)>10) A A A $err = $err + "ID Length must be within 6 to 10.<br>"; My tests have shown that user names that work are:A system and web-shineA ( if u do not know the username the blog is registered under ) 2) The injection string required is : a' OR '1'='1A A An example of exploitation would be: username: jimmy16 password: a' OR '1'='1A username: system password: a' OR '1'='1A The result is logging into the blog with total ownership. Email ===== NA[at]tutanota.com