Multiple Vulnerabilities in phphg Guestbook

Summary

Vulnerability
Multiple Vulnerabilities in phphg Guestbook
Discovered
2006.02.04
Last Update
2006.03.18 Solution added
ID
EV0058
CVE
CVE-2006-0602 CVE-2006-0603 CVE-2006-0604
Risk Level
medium
Type
Multiple Vulnerabilities
Status
Patched
Vendor
Hinton Design (http://www.hintondesign.org)
Vulnerable Software
phphg Guestbook (http://www.hintondesign.org/downloads/view_cat.php?cat_id=45)
Version
1.2
PoC/Exploit
Available
Solution
Available
Discovered by
Aliaksandr Hartsuyeu (eVuln.com)

Description

Multiple Vulnerabilities found in phphg Guestbook (http://www.hintondesign.org/downloads/view_cat.php?cat_id=45) script.

1. Authentication Bypass
Vulnerable script: check.php

There are two ways to bypass authentication:

a) SQL Injection
Variable $HTTP_POST_VARS[username] isn't properly sanitized before being used in a SQL query. This can be used to make any SQL query by injecting arbitrary SQL code.
Condition: magic_quotes_gpc - off

b) Cookie based authentication
check.php script dont make password comparisson when identifying user by cookies


2. Multiple Cross-Site Scripting
Vulnerable script: signed.php
Variables $HTTP_POST_VARS[location] $HTTP_POST_VARS[website] $HTTP_POST_VARS[message] are not properly sanitized. This can be used to post arbitrary html or script code.


3. SQL Injections in administrator control panel
Vulnerable scripts:
admin/edit_smilie.php
admin/add_theme.php
admin/ban_ip.php
admin/add_lang
admin/edit_filter


Variable $HTTP_GET_VARS[id] variable isn't properly sanitized. This can be used to make any SQL query by injecting arbitrary SQL code.
Condition: magic_quotes_gpc - off

PoC/Exploit

1. Authentication Bypass

a) SQL Injection
url: http://host/hg/admin.php
Username: ' or 1/*
Password: any

b) Cookie based authentication
Cookie: loged=yes
Cookie: username=admin
Cookie: user_level=1


2. Cross-Site Scripting Example.
Url: http://host/hg/sign.php
Location: <XSS>
Website: javascript:alert(123)
Message: <XSS>


3. SQL Injection Example:
http://host/hg/admin/edit_smilie.php?id=333'%20union%20select%201,2,3,4/*

Solution.

To fix this problem install or upgrade to latest version provided by vendor.