About magic_quotes_gpc in php Injection

Source: Internet
Author: User

 

BY: Hans

 

Magic_quotes_gpc = on

 

Everyone knows the php configuration file php. in. If the magic_quotes_gpc configuration in it is opened, magic_quotes_gpc = on anyone who knows something about php knows it.

 

Then we need to inject numeric fields.

 

<?

If (isset ($ _ POST ["f_login"])

{

 

// Connect to the database

$ T_strUid = $ _ POST ["f_uid"];

$ T_strPwd = $ _ POST ["f_pwd"];

$ T_strSQL = "SELECT * FROM tbl_users WHERE uid = $ t_strUid AND password = '$ t_strPwd' LIMIT 0, 1 ";

If ($ t_hRes = mysql_query ($ t_strSQL ))

{

// Query successful

 

}

 

}

?>

<Html>

<Body>

<Form method = post action = "">

User ID: <input type = "text" name = "username" size = 30> <br>

 

Password: <input type = text name = "userpwd" size = 30> <br>

<Input type = "submit" name = "user_login" value = "Logon">

</Form>

</Body>

 

 

The above Code requires us to enter username and password to log on. Some codes are omitted.

 

If entered correctly:

 

Select * from tbltable_users WHERE userid = admin AND password = 'admin' LIMIT 0, 1

 

If the attacker enters admin OR 1 = 1 # At username, the SQL statement injected is as follows:

SELECT * FROM table_users WHERE userid = admin OR 1 = 1 # AND password = 'admin' LIMIT 0, 1

 

The following code can be injected.

 

In php. ini, set the display_errors option to display_errors = off.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.