日期:2014-05-16  浏览次数:20373 次

DBA做坏事之盗用Oracle用户身份
       DBA管理着数据库所有的数据,但对某些数据的操作,因为审计或其它原因,用管理员身份可能并不方便,但你又不知道方便的那个Oracle用户
的用户密码是多少,因为Oracle的用户密码是加密了的。那有没办法不用知道密码的情况下,借用下别的Oracle用户身份来玩玩,弄完了再还回去呢?当然有法子的。 看我来怎么弄。  

例子用8i测的,但11g版本后有个新变化,密码加密字符串放user$了,需要去user$中查出:   
SQL> select * from v$version;
/c clsBANNER
----------------------------------------------------------------
Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
PL/SQL Release 8.1.7.0.0 - Production
CORE    8.1.7.0.0       Production
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
NLSRTL Version 3.4.1.0.0 - Production

SQL> create user test identified by test;

用户已创建

SQL> SELECT password FROM dba_users WHERE username='TEST';
/c clsPASSWORD
------------------------------
7A0F2B316C212D67

SQL> alter user test identified by newpwd;

用户已更改。

SQL> SELECT password FROM dba_users WHERE username='TEST';
/c clsPASSWORD
------------------------------
39797952BFEE21C3

SQL> grant connect,resource to test;

授权成功。
  上面建了个test用户,原来的密码是test,后改成了newpwd. 这里注意下,密码test加密后的字符串为"7A0F2B316C212D67".

再开另一个会话测试连接: 
C:\>sqlplus /nolog

SQL*Plus: Release 8.1.7.0.0 - Production on 星期四 3月 13 15:37:54 2014

(c) Copyright 2000 Oracle Corporation.  All rights reserved.

SQL> connect test/test@xcldb
ERROR:
ORA-01017: invalid username/password; logon denied


SQL> connect test/newpwd@xcldb
ERROR:
ORA-01045: user TEST lacks CREATE SESSION privilege; logon denied


SQL> connect test/newpwd@xcldb
已连接。
SQL> disconnect;

  证明新密码是生效的。

   尝试把密码改回为旧的"test",看下面怎么弄的。
SQL> alter user test identified by values '7A0F2B316C212D67';

用户已更改。

SQL> SELECT password FROM dba_users WHERE username='TEST';
/c clsPASSWORD
------------------------------
7A0F2B316C212D67

SQL>
 有木有,神奇的密码字符串又回来了。

 再测试下:
  
SQL> disconnect;
从Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
With the Partitioning option
JServer Release 8.1.7.0.0 - Production中断开
SQL> connect test/newpwd@xcldb
ER