[waraxe-2008-SA#064] - Sql Injection in MyBB 1.2.11 =============================================================================== Author: Janek Vind "waraxe" Date: 21. January 2008 Location: Estonia, Tartu Web: http://www.waraxe.us/advisory-64.html Target software description: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MyBB is a discussion board that has been around for a while; it has evolved from other bulletin boards into the forum package it is today. Therefore, it is a professional and efficient discussion board, developed by an active team of developers. Vulnerabilities discovered =============================================================================== 1. SQL Injection in "private.php" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Preconditions: =============== a) attacker must have logged in as registered user b) private message system must be enabled Caused by: =============== Parameter "disablesmilies" is not sanitized properly before being used in INSERT sql query. Explanation: =============== Let's try this little piece of html code as proof-of-concept: [--------------- PoC start -------------------------------------------------]
[------------- PoC end ----------------------------------------------------] NB! Parameter "to" must be valid username! As result of test we can see sql error message: MySQL error: 1136 Column count doesn't match value count at row 1 Query: INSERT INTO mybb_privatemessages (uid, toid, fromid, folder, subject, icon, message, dateline, status, includesig, smilieoff, receipt, readtime) VALUES ('1', '1', '1', '1', 'f00subject', '0', 'f00message', '1200579555', '0', 'no', '',waraxe,'', '0', '0') So sql injection security hole exists in INSERT query and in case of mysql version >= 4.1 by using subselects attacker can fetch arbitrary data from database, including admin password hash. How to fix: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Download new MyBB version 1.2.12 Greetings: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Greets to ToXiC, LINUX, y3dips, Sm0ke, Heintz, slimjim100, str0ke and anyone else who know me! Greetings to Raido Kerna. Tervitusi Torufoorumi rahvale! Contact: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ come2waraxe@yahoo.com Janek Vind "waraxe" Homepage: http://www.janekvind.com/ Waraxe forum: http://www.waraxe.us/forums.html ---------------------------------- [ EOF ] --------------------------------