doing detective work

  • Out website was hacked last week, apparently in the form of a SQL injection. While we are addressing the website issue itself, I want to see what I can do to determine the source of the attack. In fact, I don't know for sure it came through the website.

    I'd like to know what my options are with the tools I have. I don't have redgate or anything. Just SQL Server 2005. Do the trans logs tell me who did an insert on a given date? is there a way to search the logs for a certain string? Is there another way other than the logs to see the username of who did a particular insert, update, or even a select?

  • You might want to look at this freebe from Microsoft:

    Log Parser 2.2 available from:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en

    Microsofts description

    Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • If it was a SQL injection attack your log perusing should show the login that peformed the offending action was the login you have your website using to connect to SQL server. You will need some form of connection logging from the web side (or if connections are logged on the SQL side) in order to track who did what beyond that generic login.

    So basically if the command was a sql injection attack unless you log the commands sent from the web app somewhere and can tie those commands back to session ids and inbound IPs you might not be able to track this.

    Just some thoughts as you go forward. I assume your company is doing everything it can to harden it's text inputs exposed to the web now? If so, have them include some web session and ip logging when suspect values are passed through. That way if you can't track it down this time you will at least be ready when they attack again.

  • As a preventative measure, you may want to take a look at the freely available SQL Server Injection detection tool, Scrawlr, available from the clever chaps at HP.

    http://www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2008/06/23/finding-sql-injection-with-scrawlr.aspx

  • These are all great suggestions, folks! Thanks very much!

  • BenBooth (7/31/2009)So basically if the command was a sql injection attack unless you log the commands sent from the web app somewhere and can tie those commands back to session ids and inbound IPs you might not be able to track this.

    Yes, but we are looking for hard evidence that this was, in fact, a SQL injection attack thru the website. There's always the possibility it was an ex-employee remoting in or somesuch thing. If I could see that the website login was involved, I wouldn't be able to see which web user it was, but at least I'd know how it was done.

  • bitbucket (7/31/2009)


    You might want to look at this freebe from Microsoft:

    Log Parser 2.2 available from:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en

    Microsofts description

    Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

    I couldn't make heads or tails of it.

  • John Sansom (7/31/2009)


    As a preventative measure, you may want to take a look at the freely available SQL Server Injection detection tool, Scrawlr, available from the clever chaps at HP.

    http://www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2008/06/23/finding-sql-injection-with-scrawlr.aspx

    That page has a download link which doesn't work.

  • middletree (8/4/2009)


    John Sansom (7/31/2009)


    As a preventative measure, you may want to take a look at the freely available SQL Server Injection detection tool, Scrawlr, available from the clever chaps at HP.

    http://www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2008/06/23/finding-sql-injection-with-scrawlr.aspx

    That page has a download link which doesn't work.

    Lesson number one, never give up at the first hurdle.......

    Here is what a little google time came up with

    https://h30406.www3.hp.com/campaigns/2008/wwcampaign/1-57C4K/index.php?mcc=DNXA&jumpid=in_r11374_us/en/large/tsg/w1_0908_scrawlr_redirect/mcc_DNXA

  • It might also be worth checking your web logs as query string parameters can also be vulnerable to SQL injection.

    Try a search for apostrophes or any SQL keywords.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply