Subscribe by Email


Showing posts with label DBMS. Show all posts
Showing posts with label DBMS. Show all posts

Friday, April 20, 2012

What are different aspects of DBMS specific SQL injection attack?


DBMS specific SQL injection attack is one of the different types of the SQL injection. Some of the SQL injection attacks that are carried out today on web sites are based up on the DBMS specific SQL injection. 

About DBMS specific SQL


- DBMS specific SQL is employed for sending the certain specified statements to the engine of the data base for its execution. 

- Unless the connection is not specified, the default cursors for the default connections are used by the prolific. 

- For the DBMS specific SQL, the statements can fed to the data base engine in any format that it supports. 

- Such a privilege grants you the access to all the features of the data base.

- SQL injection attacks are quite well known vectors for the data base management systems because they fail to cleanse or sanitize the input supplied by the users. 

- Like in the web based applications, the passing SQL commands (these commands are the parameters of some stored procedure and functions) are exploited by the SQL injection attacks. 

- These malicious commands are then executed in the context of the component through which the required function is called. 

- This whole process is carried out via the system components as well as the administrator’s privileges.

- This process results in what is called the privilege escalation. 

Example to illustrate Privilege Escalation



- Suppose some component provides the backup functionality and is run at higher privilege.

- A function injected with the malicious SQL statements is called. 

- This allows the user become a DBA by escalating their privileges which then helps them to overtake the data base. 

- By keeping the data base patches up to date, many of the SQL injection attacks can be effectively avoided. 

- Though the classic SQL injection attack had become outdated and the inference SQL injection still continues to prevail as great security threat, the DBMS specific SQL injection attack is still considered to be supportive regardless of how the classic SQLIA, inference SQL and other types of SQLIAs are utilized. 

- The permissions to log in the data base that belongs to some web application can be limited to only what is required. 

- This may prove to be effective in reducing the affect of the SQL injection attack that may further exploit any bugs and errors present in the web application or site.

- Like bugs and errors the severity of the SQL injection attacks also ranges among low, medium and high levels.

- Following a successful SQL injection attack, the attackers can very easily execute the arbitrary SQL commands.

- Such vulnerability can be exploited by the remote authenticated users for injecting the malicious SQL statements and commands. 

-  A successful SQL injection can steal the sensitive data from the data base or modify it as he/ she desires.

- The attacker can even carry out the administrative operations on the data base like issuing a command to shut down the whole data base, recover a deleted file etc.

Approaches to avoid malicious SQL injection in database


Any of the two below mentioned approaches can be followed for avoiding the malicious SQL injections in to the data base:

1.  Parameterized queries: 
      - This approach involves the use of bounded queries. 
    - Out of the two, this is easier to follow and work in an almost similar way in many languages including java, .NET, PHP, Perl etc. 
      - In the parameterized queries the data and the query is kept separate from each other by bounds.

2.  Parameterized stored procedures: 
     - Though being a little difficult to implement, it proves to be more effective than the previous one in avoiding many types of SQL injection attacks.

Avoiding the use of dynamic table names and even if you are, don’t accept the names from the users since on using these measures it is very unlikely that your application will fall victim to the SQL injection attack. 


Tuesday, August 4, 2009

Database (DBMS) Languages

Once the design of the database is completed and a DBMS is chosen to implement the database, the next step is to define the conceptual and internal schema for the data and any mappings between the two. The languages that are used to do so are :

• Data Definition Language (DDL): To specify the conceptual schema of a database by the DBA and by database designers. In many DBMSs, the DDL is also used to define internal and external schemas (views).
• In some DBMSs, separate storage definition language (SDL) are used to define internal and external schemas.
The mappings between the two schemas may be specified in either one of these languages. For a true three-schema architecture, a third language is needed, the view definition language (VDL), to specify user views and their mappings to conceptual schema.

Once the database schemas are compiled and the database is populated with data, users must have some means to manipulate the data.
• Data Manipulation Language (DML): Used to specify database retrievals and updates.
• DML commands (data sublanguage) can be embedded in a general-purpose programming language (hostlanguage), such as COBOL, C or an Assembly Language.
• Alternatively, stand-alone DML commands can be applied directly (query language).
DMLs can be high level(set-oriented, nonprocedural) or low level)record-oriented, procedural). A high-level DML can be embedded in a host programming language, or it can be used as a stand-alone language; in the latter case it is often called as a query language.

In current DBMSs, a comprehensive integrated language is used that includes constructs for conceptual schema definition, view definition, and data manipulation. A typical example of a comprehensive database language is the SQL relational database language.
Whenever DML commands are embedded in a general-purpose programming language, that language is called the host language and the DML is called the data sublanguage.


DBMS Three-Schema Architecture and Data Independence

WHAT IS DBMS ?
- To be able to carry out operations like insertion, deletion and retrieval, the database needs to be managed by a substantial piece of software; this software is usually called a Database Management System(DBMS).
- A DBMS is usually a very large software package that enables many different tasks including the provision of facilities to enable the user to access and modify information in the database.
- Data Description Languages (DDL) and Data Manipulation Languages (DML) are needed for manipulating and retrieving data stored in the DBMS. These languages are called respectively.

An architecture for database systems, called the three-schema architecture was proposed to help achieve and visualize the important characteristics of the database approach.

THE THREE-SCHEMA ARCHITECTURE:
The goal of the three-schema architecture is to separate the user applications and the physical database. In this architecture, schemas can be defined at 3 levels :
1. Internal level or Internal schema : Describes the physical storage structure of the database. The internal schema uses a physical data model and describes the complete details of data storage and access paths for the database.
2. Conceptual level or Conceptual schema : Describes the structure of the whole database for a community of users. It hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user operations, and constraints. Implementation data model can be used at this level.
3. External level or External schema : It includes a number of external schemas or user views. Each external schema describes the part of the database that a particular user is interested in and hides the rest of the database from user. Implementation data model can be used at this level.

DBMS Three-Schema architecture

IMPORTANT TO REMEMBER :
Data and meta-data
- three schemas are only meta-data(descriptions of data).
- data actually exists only at the physical level.
Mapping
- DBMS must transform a request specified on an external schema into a request against the conceptual schema, and then into the internal schema.
- requires information in meta-data on how to accomplish the mapping among various levels.
- overhead(time-consuming) leading to inefficiencies.
- few DBMSs have implemented the full three-schema architecture.

DATA INDEPENDENCE

The disjointing of data descriptions from the application programs (or user-interfaces) that uses the data is called data independence. Data independence is one of the main advantages of DBMS. The three-schema architecture provides the concept of data independence, which means that upper-levels are unaffected by changes to lower-levels. The three schemas architecture makes it easier to achieve true data independence. There are two kinds of data independence.

- Physical data independence
* The ability to modify the physical scheme without causing application programs to be rewritten.
* Modifications at this level are usually to improve performance.

- Logical data independence
* The ability to modify the conceptual scheme without causing application programs to be rewritten.
* Usually done when logical structure of database is altered.

Logical data independence is harder to achieve as the application programs are usually heavily dependent on the logical structure of the data. An analogy is made to abstract data types in programming languages.


Facebook activity