Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers – is the security community’s go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

About SAP Adaptive Server Enterprise dbcc import_sproc SQL injection vulnerability (CVE-2016-7402)

This vulnerability was introduced in SAP Adaptive Server Enterprise 16.0 SP02 PL03: prior versions of 16.0 are not vulnerable.

The DBCC command import_sproc is internal to the server and is not intended to be called by users. However any database owner can still invoke it using the following syntax:

dbcc import_sproc('loopback', 'SourceDB', 'TargetDB')

Interestingly, SAP renamed this dbcc command in 16.0 SP02 PL04 to import_stored_programs instead of import_sproc:

E:\SAP\ASE-16_0\scripts>strings -s * | findstr /i /c:"dbcc im"
E:\SAP\ASE-16_0\scripts\instmstr: dbcc import_stored_programs(@srvname, @dbname, @dbname)

When the command is executed on the patched version, permissions error is returned if user is not already an admin:

dbcc import_stored_programs('loopback', 'SourceDB', 'TargetDB')
Msg 10353, Level 14, State 6: Server '...', Line 1:
You must have any of the following role(s) to execute this command/procedure: 'sa_role' . Please contact a user with the appropriate role for help.

As you can see SAP simply changed the permissions for the dbcc import_stored_programs to require the sa_role to execute instead of remediation of the injection itself.

To fix this issue we recommend admins apply the vendor supplied fix, 16.0 SP02 PL04 HF1, which was released in September 2016.

As usual, Trustwave database security products contain a dedicated check for this vulnerability. Trustwave also published an advisory: https://www.trustwave.com/Resources/Security-Advisories/Advisories/TWSL2016-017/?fid=8409

Recent SpiderLabs Blog Posts