For SQL injection and anti-injection is actually an attack and defense, today we want to tell you the most basic injection and prevention methods, the principle is to take advantage of some PHP or MySQL features and we did not pay attention to the cause.
A simple SQL
A simple SQL injection attack caseIf we have a company web site, in the site's background database to keep all the customer data and other important information. If there is such a command in the code of the website login page to read the user information.
The code is as follows
Copy Code
?$q = "Select ' id ' from ' users ' WHERE ' username ' = '". $_get[' username ']. " ' and '
performed
After reading the first section, some people will think: I also often test whether it can be injected. Isn't it very easy?
In fact, this is not the best method. Why?
First, not necessarily the IIS of each server returns a specific error message to the client. If a cint (parameter) or other statement is added to the program,
SQL Injection fails, but the server also reports an error. The specific p
Phpsql injection and anti-injection Classic case analysis. SQL injection and anti-injection are actually Attacks and Defenses. today we want to tell you the most basic injection and pre
1. SQL InjectionSo far, I have hardly seen anyone who has written a very complete article, or a very mature solution (there are certainly many people who can do it, and the problem is that it has not been spread. Unfortunately) I would like to give a few simple points to inspire everyone to think about and play a role in attracting others.
I. Principles of SQL Injection
Dependency Injection control inversion Service locator mode Dependency injection inversion of the control IoC service Locator Patterns
Author/martin Fowler compilation/Transparency
The Java community has recently unleashed a flurry of lightweight containers that can help developers assemble components from different projects into an cohesive application. There is a pattern behind them that determines how th
programs and servers and obtain the information you think. ? /P> Section 2: Determine whether SQL injection can be performed After reading the first section, some people will think: I also often test whether it can be injected. Isn't it very easy? In fact, this is not the best method. Why? First of all, not necessarily the IIS of each server returns a specific error message to the client. If statements
1. About SQL injection
So far, I have not seen who wrote a very complete article, or a very mature solution (can do a lot of people, the problem is not spread out, very sorry) I simply said a few, hope to inspire people to think, play a role in the discussion
First, the principle of SQL injection
The implementation
whether it can be injected. Isn't it very easy?
In fact, this is not the best method. Why?
First of all, not necessarily the IIS of each server returns a specific error message to the client. If statements such as CINT (parameter) are added to the program, SQL injection will not succeed, but the server also reports an error. The specific prompt is that an error occurs on the server when processing the URL.
Label:"SQL injection" talking about post injection in SQL injection This article source: I Spring and Autumn College 00x01 In many communication groups, I see a lot of friends for post injection is very confused, once geometry
Tags: record is to write the EAL engine special Password page fromSQL Injection VulnerabilityPrinciple: As the developer writes the operation database code, the external controllable parameter is directly stitched into the SQL statement, and is placed directly into the database engine without any filtering.Attack Mode:(1) When permissions are large, write directly to Webshell or execute system commands dire
the program and server, so as to obtain the information you think of.
Section II, to determine whether SQL injection
After reading the first section, some people will feel: I also often this test can inject, this is not very simple?
In fact, this is not the best way, why?
First of all, not necessarily every server's IIS return specific error prompts to the client, if the program added CInt (parameters)
This paper describes the simple implementation of SQL anti-injection method in PHP. Share to everyone for your reference, as follows:
There is not much filtering here, mainly for PHP and MySQL combination.
General anti-injection, as long as the use of PHP addslashes function is possible.
Here's a copy of the code:
PHP Code:
$_post = Sql_injection ($_post); $_ge
abnormally. However, this method is very simple, but it is not the best, because:
First, not necessarily the IIS of each server returns a specific error message to the client. If statements such as CINT (parameter) are added to the program, SQL injection will not succeed, but the server also reports an error. The specific prompt is that an error occurs on the server when processing the URL. Contact the s
Although there are many previous articles that discuss SQL injection, the content discussed today may help you check your server and take precautions. TSE, you can win. The first thing to understand is what kind of SQL injection attack is.
Looking at recent security incidents and their aftermath, security experts have
some time ago, in a lot of blogs and micro-blog burst out of the 12306 some loopholes in the website of the Ministry of Railways, as such a large project, it is not impossible to say that there are loopholes, but the loopholes are some novice programmers will make mistakes. In fact , the SQL Injection vulnerability is one. As a rookie little programmer, I know nothing about
II, to determine whether SQL injection
After reading the first section, some people will feel: I also often this test can inject, this is not very simple?
In fact, this is not the best way, why?
First of all, not necessarily every server's IIS return specific error prompts to the client, if the program added CInt (parameters), such as statements, SQL
SQL injection focuses on the construction of SQL statements, only the flexible use of SQL
Statement to construct the injected string of the bull ratio. After finishing the study, I wrote some notes, ready to use. I hope you're looking at the following.
The rationale for solving SQL
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.