Create time: 2005-03-09
Article attribute: original
Article submission:
54alpha (Netsh_at_163.com)
PHP injection topic
------------ Alpha
/ * This article has been issued in the "hacker X file" 2004 top 10.
I would like to use this document to my favorite my mom and dad, and all people who have helped me. * /
/ * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Romao did not support uploading pictures
You can get
Http://www.54hack.info/txt/php.pdf Download this article PDF Document (including images) * /
PHP Injection Attack is the most popular way of attack today, with its powerful flexibility to attract the vast number.
In the previous issue, "PHP Safety and Injection Topics" Zhonglin .Linx mainly tells the various vulnerabilities of the PHP program, but also the problem of PHP mysql injection, but the problem of injection is relatively small, let us feel that there is no happiness. .
OK, I will blow the PHP mysql injection for everyone's porter, so you will make you full of money (Who throws bricks!).
This article is mainly serving the small dishes. If you are already a old bird, some things will feel more boring, but as long as you look at it, you will find a lot of interesting things.
Read this article, you only have to understand this thing below.
1. I understand how the PHP MySQL environment is built, and the related articles we have included in the CD, if you are not very clear about building a PHP MySQL environment, please check this article first, introduced in the previous topic. .
2. Probably understand the configuration of PHP and Apache, mainly used in php.ini and httpd.conf
And this article we mainly use is the configuration of PHP.ini. For security, we generally open the security model in php.ini, that is, let Safe_Mode = ON, and one is to return to PHP execution errors, which will return a lot of useful information, so we should close it.
That is, after the Display_errors = OFF turns off error display, the PHP function will not be displayed to the user again.
In the PHP configuration file php.ini has a very important configuration option MAGIC_QUOTES_GPC, the high version of the default is magic_quotes_gpc = ON, only in the original antique PHP
The default configuration is magic_quotes_gpc = OFF, but the antique thing is also used!
When Magic_QUOTES_GPC = ON occurs during php.ini, there is no panic, the sky is can't collapse! It is just to automatically turn all the '(single quotes), "(dual quotes), / (double quotes), / (double quotes), and empty characters in the submitted variable, such as turning' into / ', Turn / become //.
That's it, let us very bad, many times we have to say Byebye to the characters.
But don't be discouraged, we still have a good way to deal with it, look down!
3. Have a certain PHP language basis and understand some SQL statements, these are very simple, we use something very little, so charging and oh!
Let's take a look at Magic_QUOTES_GPC = OFF, we can do something, then we will find a way to engage in magic_quotes_gpc = on the situation: Magic_quotes_GPC = OFF injection attack
Magic_quotes_gpc = Off Although it is very unsafe, the new version will also make
Magic_quotes_gpc = ON, but in many servers, we also found MAGIC_QUOTES_GPC = OFF case, for example
Www.qichi. *.
There are some programs like the VBB forum, even if you configure magic_quotes_gpc = ON, it will automatically eliminate the escape character, let us have organic multiplication, so say
Magic_quotes_GPC = OFF injection method is also a big market.
Below we will explain in detail from the syntax, injecting point and injection types, Mysql PHP injection
A: Prior to the MYSQL grammar
1. Let's talk about some Mysql's basic syntax, and it is a child who has not studied it. ~ _ ~
1) SELECT
SELECT [straight_join] [SQL_SMALL_RESULT]
SELECT_EXPRESSION, ...
[INTO {OUTFILE | DUMPFILE} 'file_name' export_options]
[From Table_References
[Where where_definition]
[Group by col_name, ...]
[Order by {unsigned_integer | col_name | formula} [ASC | DESC], ...]
]
Commonly used, select_expression refers to the columns you want to retrieve, and then we can use WHERE to limit the conditions, we can also use Into Outfile to output the select result to the file. Of course, we can also use SELECT directly to
E.g
MySQL> SELECT 'A';
-
| a |
-
| a |
-
1 row in set (0.00 sec)
Please see the Mysql Chinese Manual 7.12.
Here are some utilization.
See the code first
This code is used to search.