Secunia Research: PhreeBooks Forty Eight SQL Injection Vulnerabilities

======================================================================

                     Secunia Research 20/10/2010

      - PhreeBooks Forty Eight SQL Injection Vulnerabilities -

======================================================================
Table of Contents

Affected Software....................................................1
Severity.............................................................2
Vendor's Description of Software.....................................3
Description of Vulnerability.........................................4
Solution.............................................................5
Time Table...........................................................6
Credits..............................................................7
References...........................................................8
About Secunia........................................................9
Verification........................................................10

====================================================================== 
1) Affected Software 

* PhreeBooks 2.1

NOTE: Other versions may also be affected.

====================================================================== 
2) Severity 

Rating: Moderately critical
Impact: Manipulation of data
Where:  From remote

======================================================================
3) Vendor's Description of Software 

"PhreeBooks accounting was developed as an open source ERP (Enterprise
Resource Planning) web-based application written for the small 
business community"

Product Link:
http://www.phreebooks.com/

====================================================================== 
4) Description of Vulnerability

Secunia Research has discovered multiple vulnerabilities in 
PhreeBooks, which can be exploited by malicious users and malicious 
people to conduct SQL injection attacks.

1) Input passed via the "search_field" parameter to includes/addons
/PhreeHelp/leftframe.php is not properly sanitised before being used 
in SQL queries. This can be exploited to manipulate SQL queries by 
injecting arbitrary SQL code.

Successful exploitation requires that "magic_quotes_gpc" is disabled.

2) Input passed to the "idx" parameter in includes/addons/PhreeHelp
/index.php is not properly sanitised before being used in SQL queries. 
This can be exploited to manipulate SQL queries by injecting arbitrary 
SQL code.

Successful exploitation requires that "magic_quotes_gpc" is disabled.

3) Input passed via the "tpl" parameter to index.php (when "cat" and
"module" are set) is not properly sanitised before being used in SQL
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

Successful exploitation requires that "magic_quotes_gpc" is disabled.

4) Input passed via the "cID" and "oID" parameters to index.php (when
"cat" is set to "orders", "module" is set to "ajax", and "op" is set 
to "load_order") is not properly sanitised before being used in SQL
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

5) Input passed via the "search_period" parameter to index.php (when
"cat" is set to "banking", "module" is set to "popup_bills", and "jID"
is set) is not properly sanitised before being used in SQL queries. 
This can be exploited to manipulate SQL queries by injecting arbitrary 
SQL code.

6) Input passed via the "search_period" parameter to index.php (when
"cat" is set to "orders", "module" is set to "popup_orders", "form" is
set to "orders" and "jID" is set) is not properly sanitised before 
being used in SQL queries. This can be exploited to manipulate SQL 
queries by injecting arbitrary SQL code.

7) Input passed via the "search_period" parameter to index.php (when
"cat" is set to "orders" and "module" is set to "inv_mgr") is not
properly sanitised before being used in SQL queries. This can be
exploited to manipulate SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires "Read Only"
permissions for "Invoice Manager" in the "Customers" section.

8) Input passed via the "search_period" parameter to index.php (when
"cat" is set to "banking" and "module" is set to "reconciliation") is
not properly sanitised before being used in SQL queries. This can be
exploited to manipulate SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires "Read Only"
permissions for "Account Reconciliation" in the "Banking" section.

9) Input passed via the "search_period" parameter to index.php (when
"cat" is set to "orders" and "module" is set to "status", and jID is
set) is not properly sanitised before being used in SQL queries. This
can be exploited to manipulate SQL queries by injecting arbitrary SQL
code.

Successful exploitation of this vulnerability requires "Read Only"
permissions for "Sales Order Manager" in the "Customers" section.

10) Input passed via the "cID" parameter to index.php (when "cat" is 
set to "accounts", "module" is set to "ajax", and "op" is set to
"load_contact") is not properly sanitised before being used in SQL
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

11) Input passed via the "guess" parameter to index.php (when "cat" is
set to "accounts", "module" is set to "ajax", and "op" is set to
"load_contact_info") is not properly sanitised before being used in 
SQL queries. This can be exploited to manipulate SQL queries by 
injecting arbitrary SQL code.

12) Input passed via the "type" parameter to index.php (when "cat" is
set to "accounts" and "module" is set to "popup_accts") is not 
properly sanitised before being used in SQL queries. This can be 
exploited to manipulate SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

13) Input passed via the "pID" parameter to index.php (when "cat" is 
set to "general" and "module" is set to "ctl_panel") is not properly
sanitised before being used in SQL queries. This can be exploited to
manipulate SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

14) Input passed via the "sID" parameter to index.php (when "cat" is 
set to "setup", "module" is set to "popup_setup", and "subject" is set 
to "zones", "countries", "inv_tabs", "tax_auths_vend", tax_rates_vend",
or "tax_rate") is not properly sanitised before being used in SQL 
queries. This can be exploited to manipulate SQL queries by injecting 
arbitrary SQL code.

15) Input passed via the "sID" parameter to index.php (when "cat" is 
set to "setup", "module" is set to "popup_setup", and "subject" is set 
to "departments", "project_phases", "chart_of_accounts", "currency",
"dept_types", or "project_costs") is not properly sanitised before 
being used in SQL queries. This can be exploited to manipulate SQL 
queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

16) Input passed via the "iID", "upc", and "sku" parameters to 
index.php (when "cat" is set to "inventory", "module" is set to "ajax", 
"op" is set to "inv_details" and "fID" is set) is not properly 
sanitised before being used in SQL queries. This can be exploited to 
manipulate SQL queries by injecting arbitrary SQL code.

17) Input passed via the "cID" and "sku" parameters to index.php 
("cat" is set to "inventory", "module" is se to "main" and "action" is 
set) is not properly sanitised before being used in SQL queries. This 
can be exploited to manipulate SQL queries by injecting arbitrary SQL 
code.

Successful exploitation of this vulnerability requires "Edit" 
permissions for "Edit/Maintain" in the "Inventory" section.

18) Input passed via the "cID" parameter to index.php (when "cat" is 
set to "inventory", "module" is set to "popup_inv", and "f2" is set) is 
not properly sanitised before being used in SQL queries. This can be
exploited to manipulate SQL queries by injecting arbitrary SQL code.

19) Input passed via the "sku" parameter to index.php (when "cat" is 
set to "inventory", "module" is set to "popup_prices") is not properly
sanitised before being used in SQL queries. This can be exploited to 
manipulate SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

20) Input passed via the "psID" parameter to index.php (when "cat" is
set to "services", "module" is set to "price_sheets", "action" is set 
to "revise") is not properly sanitised before being used in SQL 
queries. This can be exploited to manipulate SQL queries by injecting 
arbitrary SQL code.

Successful exploitation of this vulnerability requires "Edit"
permissions for "Price Sheet Manager" in the "Customers" section.

21) Input passed via the "rID" parameter to index.php (when "cat" is 
set to "gen_ledger", "module" is set to "ajax", and "op" is set to
"load_record") is not properly sanitised before being used in SQL 
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

22) Input passed via the "rID" parameter to index.php (when "cat" is 
set to "reportwriter", "module" is set to "ajax", and "op" is set to
"load_email_msg") is not properly sanitised before being used in SQL
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

23) Input passed via the "ReportID" parameter to index.php (when "cat"
is set to "reportwriter" and "module" is set to "form_gen", "rpt_gen",
or "builder") is not properly sanitised before being used in SQL
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

Successful exploitation of this vulnerability requires "Read Only"
permissions for "Reports" in the "Tools" section.

24) Input passed via the "short_name" parameter to index.php (when 
"cat" is set to "accounts", "module" is set to "main", and "type" is 
set to "i") when adding or editing a contact is not properly sanitised 
before being used in SQL queries. This can be exploited to manipulate 
SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires "Add" 
permissions for "PhreeCRM" in the "Customers" section and that 
"magic_quotes_gpc" is disabled.

25) Input passed via the "my_note" parameter to index.php (when
"my_note_submit" is set to "Add" and "module_id" is set to "my_notes")
is not properly sanitised before being used in SQL queries. This can be
exploited to manipulate SQL queries by injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

26) Input passed via the "my_title" and "my_url" parameters to 
index.php (when "my_personal_links" is set to "Add" and "module_id" is 
set to "personal_links") is not properly sanitised before being used 
in SQL queries. This can be exploited to manipulate SQL queries by 
injecting arbitrary SQL code.

Successful exploitation of this vulnerability requires that
"magic_quotes_gpc" is disabled.

27) Input passed via the "type" and "guess" parameters to index.php
(when "cat" is set to "orders", "module" is set to "ajax", and "op" is
set to "load_searches") is not properly sanitised before being used in
SQL queries. This can be exploited to manipulate SQL queries by
injecting arbitrary SQL code.

28) Input passed via the "gl_acct_id" parameter to index.php (when 
"cat" is set to "banking", "module" is set to "ajax", and "op" is set 
to "acct_balance") is not properly sanitised before being used in SQL
queries. This can be exploited to manipulate SQL queries by injecting
arbitrary SQL code.

29) Input passed via the "cID" and "bID" parameters to index.php (when
"cat" is set to banking", "module" is set to "ajax", and "op" is set to
"load_bill") is not properly sanitised before being used in SQL 
queries. This can be exploited to manipulate SQL queries by injecting 
arbitrary SQL code.

30) Input passed via the "contact_id" parameter to index.php (when 
"cat" is set to "banking", "module" is set to "ajax", and "op" is set 
to "stored_payments") is not properly sanitised before being used in 
SQL queries. This can be exploited to manipulate SQL queries by 
injecting arbitrary SQL code.

31) Input passed via the "jID" parameter to index.php (when "cat" is 
set to "banking" and "module" is set to "popup_bills") is not properly
sanitised before being used in SQL queries. This can be exploited to 
manipulate SQL queries by injecting arbitrary SQL code.

====================================================================== 
5) Solution 

No fix is currently available.

====================================================================== 
6) Time Table 

23/09/2010 - Vendor notified.
06/10/2010 - Vendor notified (2nd attempt)
16/10/2010 - Vendor notified (2nd attempt)
20/10/2010 - Public disclosure.

====================================================================== 
7) Credits 

Discovered by Secunia Research.

====================================================================== 
8) References

The Common Vulnerabilities and Exposures (CVE) project has not 
currently assigned a CVE identifier for the vulnerabilities.

====================================================================== 
9) About Secunia

Secunia offers vulnerability management solutions to corporate
customers with verified and reliable vulnerability intelligence
relevant to their specific system configuration:

http://secunia.com/advisories/business_solutions/

Secunia also provides a publicly accessible and comprehensive advisory
database as a service to the security community and private 
individuals, who are interested in or concerned about IT-security.

http://secunia.com/advisories/

Secunia believes that it is important to support the community and to
do active vulnerability research in order to aid improving the 
security and reliability of software in general:

http://secunia.com/secunia_research/

Secunia regularly hires new skilled team members. Check the URL below
to see currently vacant positions:

http://secunia.com/corporate/jobs/

Secunia offers a FREE mailing list called Secunia Security Advisories:

http://secunia.com/advisories/mailing_lists/

====================================================================== 
10) Verification 

Please verify this advisory by visiting the Secunia website:
http://secunia.com/secunia_research/2010-123/

Complete list of vulnerability reports published by Secunia Research:
http://secunia.com/secunia_research/

======================================================================