use mySQL process id to locate PHP script that issued query -


we trying locate php script assembling query , causing havoc. far have not succeeded in using grep locate script.

is possible use mysql pids show processlist locate php script issuing query?

don't think so. depend on actual architecture , topology.

maybe - this, too, might hugely disruptive, depending on context - attempt override mysql_query function (or whatever wrapper in use among various scripts) recognize misbehaving/malicious query , log relevant information.

see: http://no2.php.net/runkit_function_redefine

since logging take place "inside" havoc-wreaking script, more information available.

another possibility filter mysql queries , induce recognizable behaviour in script, waiting long time or throwing error. might doable through mysql proxy: https://launchpad.net/mysql-proxy

assuming script malicious, inability locate might point kind of encryption - , such scripts make heavy use of eval(), base64_decode , gzuncompress(). looking these functions might more productive searching query fragments.

a useful hack, not useful now, "decorate" queries revealing comments, such as, "select ... ...; -- 012345": "-- 012345" part ignored mysql, logged, , grepping "-- 012345" find target.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -