← 输入框|github.com|刷新
Skip to content

Assert all input parameters used in dynamic SQL and PL/SQL #921

Closed

Description

@PhilippSalvisberg

Description

This is a generic issue. There are some places in utPLSQL that are vulnerable to SQL injections. We have

  1. find a way to identify them
  2. fix them
  3. set up an automated review mechanism to find such issues, e.g. during our automated builds

@krisrice pointed out the following example in ut_suite_manager.get_cached_suite_data

and c.object_owner = ']'||upper(a_object_owner)||q'['

This line as two issues

  1. the parameter is not asserted, in this case via sys.dbms_assert.schema_name
  2. the parameter is converted to upper case, which leads to wrong results when quoted usernames are used (see also Quoted usernames are not supported #920).

utPLSQL Version

v3.1.7.2808-develop

Activity

  1. PhilippSalvisberg commented on May 12, 2019

    @PhilippSalvisberg
    MemberAuthor

    I've create a PL/SQL Cop check to detect SQL Injects. I ran it against the source directory.

    The checks looks if a dbms_assert unit was applied directly or indirectly to a passed string parameter.

    Here are the results (to be verified):

    File name Line Excerpt
    core/ut_suite_manager.pkb 348 a_object_owner
    core/ut_suite_manager.pkb 350 a_object_owner
    core/ut_suite_manager.pkb 377 a_path
    core/ut_suite_manager.pkb 390 a_object_owner
    core/ut_suite_manager.pkb 394 a_object_owner
    core/ut_suite_manager.pkb 400 a_object_name
    core/ut_suite_manager.pkb 403 a_procedure_name
    core/ut_suite_manager.pkb 731 a_owner_name
    core/ut_suite_manager.pkb 736 a_owner_name
    core/ut_suite_manager.pkb 740 a_owner_name
    core/ut_suite_manager.pkb 742 a_package_name
    core/ut_suite_manager.pkb 811 a_owner_name
    core/ut_suite_manager.pkb 823 a_package_name
    core/ut_suite_manager.pkb 828 a_procedure_name
    core/coverage/ut_coverage.pkb 115 a_sql
    core/coverage/ut_coverage.pkb 115 a_sql
    core/coverage/ut_coverage.pkb 115 a_sql
    core/annotations/ut_annotation_manager.pkb 73 a_object_owner
    core/annotations/ut_annotation_manager.pkb 74 a_object_type
    core/types/ut_suite_item.tbs 68 a_savepoint
    core/ut_metadata.pkb 317 a_compound_type
  2. added a commit that references this issue on Jun 1, 2019
    9389074
  3. added a commit that references this issue on Jun 1, 2019
    246e96a
  4. added a commit that references this issue on Jun 18, 2019
    1a5c525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions