I was assigned the maintenance of a non-profit website that recently fell victim to an SQL injection attack. Someone used a form on the site to add text to every available text field in the database (varchar, nvarchar, etc.), which when rendering as HTML includes and executes a JavaScript file.
A search on the Google URL shows that it is from Romanian or Chinese mail spammers, but thatโs not what matters right now.
I looked through and manually deleted the information from the text fields that appear on most of the visible and popular pages on the site, but I'm curious what would be the best programmatic way to remove text from other text fields on the site.
Obviously, there is still something to be done (to simplify the site against SQL injection, using something like markdowns instead of storing HTML, etc.), and I am working on them, but for now I really need this is a good way to log in and remove entered text. I know what exact text is, it is the same every time and is always added to the end of any text field. I canโt let anyone delete all the HTML in the database at any time, and I donโt know when it happened that way, I canโt just go back to the backup. In addition, the site is hosted on a shared host, and I cannot connect directly to the database using SQL Server tools. I can execute queries against it, so if there is any way to create a SQL update statement to "find all text fields in all tables in the entire database and do this to clear them," this will be the Best.
security sql database sql-server
Tom Kidd Aug 28 '08 at 14:29 2008-08-28 14:29
source share