Author: fallen leaves [J. L.S. T]
Information Source:Http://hi.baidu.com/jluoye
I have been working hard to keep up with the Internet for a long time.
See todayPhpeval has an article on CGI security.I was so careful when I was studying CGI.
The cgi program I encountered generally uses mysql as a database, or a plain text database.
For cgi + mysql injection, I will not mention the bird. Although the method is a bit different from the general mysql injection, it is also similar
Let's talk about some small things in the text database.
Almost all plain text CGI programs have a common problem, that is, generate a cgi file named after the user ID or user name in a specified directory.
All contents in this file are not filtered, which allows us to insert arbitrary cgi code and execute
For example, a program registration process is as follows: Check that the user folder does not exist, otherwise, create ==> create a cgi file named by user name under the users directory ==> write the corresponding registration information in this CGI File ==> complete registration
If the registration process is like this, we can execute any code. For example, the data for registering a user is as follows:
User name: luoye
User password: password
Email Address: luoye@00day.cn
The program creates a luoye. cgi file under the users directory, where the content is "luoye | password | luoye@00day.cn"
If we register a user like this:
Username: print (1 );#
User password: password
Email Address: luoye@00day.cn
After registration, we only need to browse the print (1) % 23. cgi program under the users directory to execute the cgi code. If it is evil, we will write the system @ ARGV. This station is ours.
If the program is created using the user ID as the file name, the harm is even greater.
The defense method is also very simple. It filters User Registration Information and moves the users directory to a non-web directory.
In fact, there are still a lot of skills. Here is only one of them. We will not say much about the other. You can explore E by yourself, =)
If the final exam is good, click here to get JJ's stuff ~~