Jump to content

Recommended Posts

Is there any way to track the location of a script that inserted values in my database? I've been finding illegal entries in my DB and can't figure out where they're coming from. Legitimate queries include the filename where the inserts were made but for the illegal entries, these values are blank.

 

This happens in one only of the tables my site uses. These entries don't actually cause any problems but they're still anomalies that I'd like to get fixed. Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/175903-tracking-queries/
Share on other sites

The mysql general query log, when it is enabled, only lists the mysql username, date/time, and the actual query string. The binary query log lists the queries that insert/update data. Unless you used a different mysql user to connect from each different file, those logs would not necessarily tell you anything. The mysql server/php client does not actually know or care anything about where in your application connections or queries are executed at.

 

Either it is not your application code that is being used to execute the queries containing the blank filename information (does your database allow external connections and/or do you have strong passwords on all of your database connections) or your code is being executed through a means that does not have the filename information present such as an include file being requested directly.

 

If all of your code uses a common scheme to form and execute queries, posting an example of your code would allow someone to determine how it might be possible to execute a query where the filename information is blank.

 

It's also possible that the 'extra' entries are due to sql injection. Are you validating and escaping data being put into queries so that you know for a fact that your application does not allow sql injection.

Link to comment
https://forums.phpfreaks.com/topic/175903-tracking-queries/#findComment-926932
Share on other sites

The script needs input from Paypal before executing. Posting a fake/old transaction ID is easy but Paypal verifies the validity of the transaction ID before proceeding and I keep track of all the old ones.

 

I have to admit though that I'm not very familiar with good data validation/escaping practices.

Link to comment
https://forums.phpfreaks.com/topic/175903-tracking-queries/#findComment-927406
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.