Tag: Osama mustafa
Oracle Security Case Study
In most of the companies , there is access to Email Systems, Intranet , networks and internet , most of these user are using the application that connected to Database ( assume that it’s Oracle Database).
By Creating Security Procedure to protect database and what this database contain you create hard environment to deal with since the three compentents are availability, integrity and secuirty which mean if you increase the security then integrity will not be on the same level and so on,The Oracle database has several layers of security and provides auditing functionality at each level. most of then mention in Oracle Security Section website.
- Password management : One of the basic steps to Enforce user to follow the rules such as : password expiration, limit password reuse, limit the number of failed logon attempts, force password complexity, lock and expire database accounts
- Database Auditing to monitor user activity.
- Fine Grained Auditing to define specific conditions necessary for an audit record to be generated, resulting in a more meaningful audit trail
- Database Resource Manager to set resource limits and quotas on the amount of various system resources available to users
- Roles to manage object privileges
- Oracle Label Security for more sophisticated row level security
- Data Encryption to provide an additional layer of protection
Limit The Access To The Database
Resource_limit should set to True
SQL> show parameter resource
NAME TYPE VALUE
———————————— ———– ——————————
resource_limit boolean TURE
resource_manager_plan string
After change this parameter Bounce database.
Connect to database using sysdba privileges
sqlplus / as sysdba
create profile Only_one_user limit sessions_per_user 1;
Create New User/modify old one depend on what you want:
create user test identified by test profile Only_one_user;
grant connect to test;
Now Try to connect to this user using more than one terminal, if you did you will receive error
ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
Thank you
Osama Mustafa
Most Common Dbcontrol issue
Notice that sometime the Solution will be different Regarding to DB version and OS Version I will Post Some MOS notes that could help you. Sometimes you need to apply Patch and on other hand there’s Workaround.
Error #1 :
Exception in thread “main” oracle.sysman.emcp.exception.DatabaseUnavailableException: Database instance unavailable
Solution :
- -Make Sure you Database is Up and Running.
- -Set/export ORACLE_SID.
- -Check if Database registered with Listener.
You can get back to this MOS note :
EMCA fails with “SEVERE: Database instance unavailable” [ID 750697.1]
EMCA fails with Database Instance is unavailable. Fix the ORA error thrown and run EM Configuration Assistant again. [ID 1511262.1]
Creating dbconsole 11.2 fails with “Exception in thread “main” oracle.sysman.emcp.exception.DatabaseUnavailableException: Database instance unavailable” on Windows [ID 1332546.1]
Error #2:
Running EMCA fails with “SEVERE: Invalid username/password”
Solution :
- -Make Sure You Insert Correct Password.
- -In Some Version you can use “Password”
- -Recreate Password File.
You can Get back to this MOS note :
Problem: Running EMCA fails with “SEVERE: Invalid username/password” [ID 744176.1]
EMCA fails with SEVERE: Invalid username/password or database/scan listener not up or database service is not registered with scan listener. [ID 1330272.1]
Error #3:
WARNING: ORA-01031: insufficient privileges
Solution
You need to check the logs, different error could be appear.
Failed to unlock all EM-related accounts
Alter User Identified By
Also Check MOS Notes :
Troubleshooting the ‘ORA-01031: insufficient privileges’ error when using EMCA to Create or Drop DBconsole [ID 358201.1]
Error #4:
SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .
Solution :
- – set/export ORACLE_SID
- -Check your Listener.
- -Check if Database Registered.
Check the below MOS note :
Troubleshooting the EMCA Error “ORA-12514” “Listener is not up. Start the Listener and run EM Configuration Assistant again” When Creating or Dropping DBConsole [ID 368591.1]
EMCA Fails With Error “ORA-12541: TNS:no listener” and “Listener is not up. Start the Listener and run EM Configuration Assistant again” [ID 975024.1]
Using Production Data is this Right ?
I seen lot of Company Use Production Data on development database/Test Database because it’s great for testing,really easy and No cost for doing this but is this right ? My View On this Topic No production data is allowed on the development. There’s lot of point to discuss to proof exactly what i mean and if it’s necessary to use it then hide it with multiple ways i will talk about it.
There is a lot more chance that the data may be compromised,This data should be removed and sanitized to make it anonymous / De-personalized.I read lot of articles every article explain something different for example This article support using Prod Data. after reading this blog ask yourself one question how the production make job easier ? by let developer/unauthorized people looking to customer Data !!!! Different point of view Customer want their data to be secure and the employees want to test the code and something easy and real to use.
Check this The Ponemon Institute has come out with some interesting (and scary) data on data security during development and testing.
This chart shows what Breach of data. It shows a lot of sensitive data such as card holder data, customer data, credit card information and business confidential information.
Personally I prefer to use a subset or dummy data use Red-Gate Data Generator,
There’s lot of security issue can be lead by Using Prod data for testing/development such as severely compromise its confidentiality, even leading to legal action.
Take this example Hannaford Brothers,In March, the Maine-based Hannaford Brothers grocery store chain
announced that 4.2 million customer card transactions had been compromised by the hackers. More than 1800 credit card numbers were immediately used for fraudulent transactions.
after all this examples is it Ok to use Prod Data On test ? Do you have a legitimate reason? do you have
Security,Encryption, Firewalls, Breech Detection , Include to that There’s difference Security Rules On prod data and Test Data , Production database For authorized People, Privacy, Auditing, Roles , Privileges lot of conditions to access it. on the other hand Development data Frequently wide open,Dozens of employees have access, Access from many to unlimited places, Home access And you still Want to use Production Data ? Do you programs care or know the difference ?
Some Rules you have to follow :
- Make your employees aware of the policies and procedures.
- If it is possible to not use production data, take that option.use alternate ways of testing scenarios.
- Ensure that production data is masked or scrubbed when it is moved out of the production environment.
if it’s necessary to use your Production Data Then Do it right by scrambling (Scrambling is the function of replacing a character (or byte) of data with a different character (or byte) of data) Oracle Provide you with solutions to do that called data masking By write your own function that will Scramble data for you.
another option could be use is encryption (Encryption is a series of algorithms used to encrypt data into nonsensical characters (not in the English alphabet)). There’s Another way you can hide production data NULL’ing Out,Substitution, Gibberish Generation ….
Finally Using live data in non-production is either illegal or expensive. For the companies using it illegally, it’s only a matter of time before somebody slips up and the practice is discovered
Read Ponemon Institute Report
Osama Mustafa
What is ORA-00600
ORA 600 “internal error code, arguments: [%s], [%s],[%s], [%s], [%s]”
and you should it’s different Oracle errors , Because when you see this error then it’s indicating for bugs, the above is general description for the error the first characterset / Number is is used with database version to identify the problem by oracle support. and maybe you will find related document on https://support.oracle.com.
When you face this error you should check the below document searching for some Notes/Patch could help you :
Note 600.1 ORA-600/ORA-7445 Lookup tool
You need to Choose database version ( 4 digit ) and First argument in the error, also for more information how to use this tool :
Note 1082674.1 : A Video To Demonstrate The Usage Of The ORA-600/ORA-7445 Lookup Tool [Video]
Notice when you check the alert log and see this error, a trace file is generated and an entry is written to the alert.log with details of the trace file location, trace file provide you with more information about the error that could help you to solve it. you can check the below document how to use trace file :
Note 453125.1 11g Diagnosability Frequently Asked Questions
Note 443529.1 11g Quick Steps to Package and Send Critical Error Diagnostic Information to Support[Video]
Most Common Reason for ORA-00600 File-Corruption, Failure in Hardware, I/O , or memory, to solve this error you need to do some steps before Open Services Request :
- Check Alert Log .
- Don’t forget to look at the Ora-00600 Tools.
- If you find any Notes related to your problem use it and read it carefully.
- The last option you could help is contact Oracle Support by open Services Request but provide the full information such as:
- alertlog for database.
- Traces.
- If any change happened lately included with SR.
- I post About RDA it’s useful to use it when you open SR.
Thank you
Osama Mustafa
ORA-01031: insufficient privileges When Start Windows Services
ORADIM.LOG….
**************************
C:\Oracle\Ora11g\bin\oradim.exe -startup -sid ptdb -usrpwd * -log oradim.log -nocheck 0
Thu Nov 15 15:16:15 2012
ORA-01031: insufficient privileges
You have to check :
1- startup type for the services ( if it’s set automatically )
2- Group to user ( the user should be in ORA_DBA Group )
3 – you can check log on tab in the service properties and set the username and password who responsible about this services and can do it by:
Go to Control Panel -> Administrative Tools -> Services .
Choose oracle services and then
click “properties”. Select the “Log On” tab and note the account that is set to run the service.
Thank you
Osama mustafa
Remote Diagnostic Agent
RDA is Command Line diagnostic tool that is executed by an engine written in the Perl programming language,The data captured provides Oracle Support with a comprehensive picture of the customer’s environment which aids in problem diagnosis, You can check the below MOS Note :
Remote Diagnostic Agent (RDA) 4 – FAQ [ID 330363.1]
Oracle Support encourages the use of RDA because it greatly reduces service request resolution time by minimizing the number of requests from Oracle Support for more information.RDA Support Most Of Operating system.and also it’s supported for Most Oracle Products.
But why should i use RDA, as i mention before oracle support encourages to use RDA to collect information and also there’s another reasons to use it :
- Oracle Fusion Middleware issues
- Oracle Collaboration products.
- Oracle Application issues.
- Installation/configuration issues
- Performance issues
- ORA-600, ORA-7445, ORA-3113.
- Upgrade and migration.
- Developer issues
- Oracle Database issues
The Simplest way to review RDA Output is using Html , Web browsing since after run rda.sh the output will generate on the same RDA Folder. (RDA_Output).
After review MOS note :
RDA 4 – Health Check / Validation Engine Guide [ID 250262.1]
after finishing from a prerequisite system you need to need check before installation of an oracle product.This special check should be done in addition to the installation document and the check inside the installer,The utility called RDA with a module for Health Check called HCVE.
./rda.sh -T hcve
The sample output could be like the below :
Test Results
~~~~~~~~~~~~
ID NAME RESULT VALUE
===== ====================
20 User in /etc/passwd? PASSED userOK
30 Group in /etc/group? PASSED GroupOK
Thank you
Osama Mustafa
Nmap and Oracle – Security Topics
Nmap is a powerful tool that is capable of generating a multitude of signatures depending on how it is used. However, if we understand the operation of the tool in general, it is easier to recognize its overall signature in network traffic. Dissecting the signature into sub-patterns one can differentiate between fingerprinting attempts that were successful and those that were not. It is important to understand that we have examined only one of the scan types that nmap can perform, the SYN half-open stealth scan. Several other scans are supported by Nmap: Tcp connect, FIN, Xmas, NULL, udp, ping, and even ftp-bounce. Expect to see these in the near future.
There’s lot of features Nmap can provide it to you : Host discovery, Port Scanning , OS detection , Auditing the security of a device by identifying the network connections, and Version detection
They Are two version of this Tools Command line version ( powerful one ) and GUI Version This tools available on Windows and Linux and if you decide to go with Command line you need to be experts to do that since its need lot of practice.
You can check how the GUI and Command line look like in the below pictures :
provides all the information that is needed for a well-informed, full-fledged, precisely targeted assault on a network. Such an attack would have a high probability of success, and would likely go unnoticed by organizations that lack intrusion detection capabilities.
But how can i use Nmap with Oracle, when i do some penetration testing i use this tool as command line to dicover the vulnerability, when oracle database installed on server it‘s allow to use ports in server which maybe cause vulnerability ( the simplest Way to describe ) I cannot post everything about NMAP here since i will need new book to talk about it.
the Below some examples that you could use note that I use command line version, For Example something Called Oracle Query runs a given query against the Oracle database server and returns the results
nmap -p 1521 –script oracle-query –script-args
another one could be used called Oracle hash dump which dump the database password hashes from Oracle and MS-SQL. The results are returned in format suitable and could be store in file.
For Example : CVE-2012-3137 vulnerability,. The vulnerability exists in Oracle 11g R1/R2 and allows linking the session key to a password hash. When initiating an authentication attempt as a valid user the server will respond with a session key and salt. Once received the script will disconnect the connection thereby not recording the login attempt. The session key and salt can then be used to brute force the users password, there’s patch to fix this security issue.
To avoid such an issue you should Apply Oracle security Patches, CPU patches , And OS Patches by doing maintenance like this you can minimize Vulnerability that could be happened
Thank you
Osama Mustafa
AWR Vs StatPack
1-you should be aware that AWR not exists in database 9i so you forced to use statepack, include to that steps to generate AWR much easier than STATPACK.
2-AWR hold all the information and statistics that exists in STATPACK, include to that AWR hold Additional Information.
3- in AWR you will find information called Active Session History ( ASH ) which is not exists in STATPACK.
4- To generate STATPACK you should Run Procedure to enable snapshot, you can use DBMS_JOB or schedule it using crontab.
5- AWR snapshots provide a persistent view of database statistics. A snapshot is a collection of performance statistics that are captured at a specific point in time,AWR snapshots are scheduled every 60 minutes by default.
6- Statspack snapshot purges must be scheduled manually otherwise AWR snapshots are purged automatically using MMON.
Thank you
Osama Mustafa













