0

A customer called to complain about his Magento Shop. The MySQL database is 10GB large even though the shop is rather small and does not have that many sales. I found out that magento inserts a new quote into sales_flat_quote at rate of 3-4 per minute, and it goes on 24/7. There are no cronjobs that could automatically create theese. I believe it could be some kind of inefficient DoS attack, since it has been going for years now, and only now did we notice it.

The Magento version is 1.4.1.1 (I know it should have been updated, but the customer does not want to pay for an update) and all the security patches have been installed.

Is is a known issue? What can i do to stop it?

migrated from stackoverflow.com Nov 23 '15 at 0:11

This question came from our site for professional and enthusiast programmers.

  • I hope you’re charging the client to look into this now, given their decision to not update has bitten them in the ass if it is an attacker ;) – Martin Bean Nov 18 '15 at 20:29
  • Anything in HTTP log? Instrument Magento code where it handles this particular insert to dump $_REQUEST and you should be able track down the URL that generates this activity. Then just block that URL, User-agent, or IP. I wonder if it is some spider that is stuck in a loop on a URL. – Sasha Pachev Nov 18 '15 at 20:34
  • @SashaPachev It could be BING. I found this IP: 157.55.39.122 and it belongs to Microsoft. I will now adjust robots.txt to prevent them from going to the cart. Let us see if it helps. – Bojan Hrnkas Nov 18 '15 at 20:51
0

I have found the culprit. The Extension PRWD Auto Shipping Module has an observer that calls Mage::getSingleton('checkout/session')->getQuote()->save(); each time when any page (!) has been called from a country other than standard shipping country.

If there is no Quote, a new one will be created.

Here is the full stack trace if someone is interested:

#0  Mage_Sales_Model_Quote->_afterSave() called at [/var/www/pyro/app/code/core/Mage/Core/Model/Abstract.php:307]
#1  Mage_Core_Model_Abstract->save() called at [/var/www/pyro/app/code/community/PRWD/Autoshipping/Model/Observer.php:60]
#2  PRWD_Autoshipping_Model_Observer->add_shipping(Varien_Event_Observer Object ([] => Array ([event] => Varien_Event Object ([] => Varien_Event_Observer_Collection Object ([] => Array ()),[] => Array ([controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[] => controller,[] => view,[] => action),[] => Mage_Core_Controller_Response_Http Object ([] => Array (),[] => Array (),[] => Array ([0] => Array ([name] => Content-Type,[value] => text/html; charset=UTF-8,[replace] => )),[] => Array (),[] => 200,[] => ,[] => ,[headersSentThrowsException] => 1),[] => ,[] => Array (),[] => Array (),[] => ,[] => Array (),[] => ),[name] => controller_action_predispatch),[] => ,[] => ,[] => ,[] => ),[controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[] => controller,[] => view,[] => action),[] => Mage_Core_Controller_Response_Http Object ([] => Array (),[] => Array (),[] => Array ([0] => Array ([name] => Content-Type,[value] => text/html; charset=UTF-8,[replace] => )),[] => Array (),[] => 200,[] => ,[] => ,[headersSentThrowsException] => 1),[] => ,[] => Array (),[] => Array (),[] => ,[] => Array (),[] => )),[] => 1,[] => ,[] => ,[] => )) called at [/var/www/pyro/app/code/community/PRWD/Autoshipping/Model/Observer.php:88]
#3  PRWD_Autoshipping_Model_Observer->check_country(Varien_Event_Observer Object ([] => Array ([event] => Varien_Event Object ([] => Varien_Event_Observer_Collection Object ([] => Array ()),[] => Array ([controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[] => controller,[] => view,[] => action),[] => Mage_Core_Controller_Response_Http Object ([] => Array (),[] => Array (),[] => Array ([0] => Array ([name] => Content-Type,[value] => text/html; charset=UTF-8,[replace] => )),[] => Array (),[] => 200,[] => ,[] => ,[headersSentThrowsException] => 1),[] => ,[] => Array (),[] => Array (),[] => ,[] => Array (),[] => ),[name] => controller_action_predispatch),[] => ,[] => ,[] => ,[] => ),[controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[] => controller,[] => view,[] => action),[] => Mage_Core_Controller_Response_Http Object ([] => Array (),[] => Array (),[] => Array ([0] => Array ([name] => Content-Type,[value] => text/html; charset=UTF-8,[replace] => )),[] => Array (),[] => 200,[] => ,[] => ,[headersSentThrowsException] => 1),[] => ,[] => Array (),[] => Array (),[] => ,[] => Array (),[] => )),[] => 1,[] => ,[] => ,[] => )) called at [/var/www/pyro/app/code/core/Mage/Core/Model/App.php:1228]
#4  Mage_Core_Model_App->_callObserverMethod(PRWD_Autoshipping_Model_Observer Object (), check_country, Varien_Event_Observer Object ([] => Array ([event] => Varien_Event Object ([] => Varien_Event_Observer_Collection Object ([] => Array ()),[] => Array ([controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[] => controller,[] => view,[] => action),[] => Mage_Core_Controller_Response_Http Object ([] => Array (),[] => Array (),[] => Array ([0] => Array ([name] => Content-Type,[value] => text/html; charset=UTF-8,[replace] => )),[] => Array (),[] => 200,[] => ,[] => ,[headersSentThrowsException] => 1),[] => ,[] => Array (),[] => Array (),[] => ,[] => Array (),[] => ),[name] => controller_action_predispatch),[] => ,[] => ,[] => ,[] => ),[controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[] => controller,[] => view,[] => action),[] => Mage_Core_Controller_Response_Http Object ([] => Array (),[] => Array (),[] => Array ([0] => Array ([name] => Content-Type,[value] => text/html; charset=UTF-8,[replace] => )),[] => Array (),[] => 200,[] => ,[] => ,[headersSentThrowsException] => 1),[] => ,[] => Array (),[] => Array (),[] => ,[] => Array (),[] => )),[] => 1,[] => ,[] => ,[] => )) called at [/var/www/pyro/app/code/core/Mage/Core/Model/App.php:1209]
#5  Mage_Core_Model_App->dispatchEvent(controller_action_predispatch, Array ([controller_action] => Mage_Catalog_CategoryController Object ([] => frontend,[] => frontend,[] => Mage_Core_Controller_Request_Http Object ([] => ,[] => /feuerwerksbatterien.html,[] => ,[] => /feuerwerksbatterien.html,[] => ,[] => ,[] => catalog,[] => Array ([api] => ),[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/category/view/id/814?cat=372&form=176&kaliber=159&limit=25&mode=grid,[] => ,[] => ,[] => catalog/category/view/id/814,[] => Array ([id] => 814),[] => ,[] => Array ([rewrite_request_path] => feuerwerksbatterien.html),[] => 1,[] => catalog,[] => module,[] => category,[]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.