Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does SQL inject vulnerabilities

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how SQL injects vulnerabilities". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

SQL injection preface

Structured query statement (Structured Query Language, abbreviation: SQL) is a special programming language used in the standard database query language.

SQL injection (SQL Injection) is a common Web security vulnerability, which can be exploited by attackers to access or modify data or exploit potential database vulnerabilities.

What is SQL injection?

SQL injection (SQL Injectiob) is an attack that inserts or adds sql statements to the input parameters of an application (user), and then passes these parameters to the background SQL server for parsing and execution.

Common Web architectures

Presentation layer: Web browser / rendering engine-visit the website

Logical layer: scripting languages: ASP, PHP, JSP, .NET, etc.-load, compile and execute script files

Storage layer: database: MSSQL, MYSQL, PRACLE, etc.-execute SQL statement

Where is the SQL injection?

GEI

POST

HTTP head injection

Cookie injection

.

Any variable that can be controlled by the client and passed to the server. That is, where you can interact with the database.

Loophole principle

The attack against SQL injection can be described as an attack that destroys the original SQL structure and achieves unexpected results when programming by injecting SQL syntax into the user's controllable parameters.

The reason can be attributed to the superposition of the following two reasons:

1. When the program writer interacts with the database, the program writer uses the method of character concatenation to construct SQL statements.

two。 The parameter contents are spliced into the SQL statement without sufficient filtering of the user-controllable parameters.

SQL injection compromise vulnerability harm

Using SQL injection vulnerability, attackers can obtain a variety of information in the database (for example, administrator backstage secret account number, code), thus stealing data in the database.

In special cases, you can also modify the database content or insert content into the database.

If there is a problem with the database permission allocation, or if there is a defect in the database itself, the attacker directly obtains webshell or server system permissions through the SQL injection vulnerability.

Classification and utilization of SQL injection classification according to SQL data type

Integer injection

String injection

Classified according to the syntax of injection

Note:

UNION query SQL Injection (can be injected into federated queries)

Error-based SQL Injection (error injection)

Blind note:

Boolean-based bind SQL Injection (Boolean injection)

Time-based bind SQL Injection (based on time delay injection)

Stacked queries SQL Injection (query injection with multiple statements)

My SQL injection related statements

Query the current database version: select version ()

Query the current database: select database ()

Query the current path: select @ @ basedir

Query the current database user: select user ()

Query the current My SQL path: select @ @ datadir

System version of the query server: select@@Version_compole_os

Query database: select schema_name from information_schema.schemata

Query table name: select table_name from information_schema.tables where table_schema=' library name'

Query column name: select column_name from information_schema.columns where table_schema=' library name 'and table_name=' table name'

Sql injection repair

1. Regular filtering of special characters, PDO precompilation

2.web Application Firewall

3. Station and warehouse separation

This is the end of "how SQL injects vulnerabilities". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report