Re: SQL injection

From: Davi Ottenheimer (DaviO_at_westmarine.com)
Date: 06/09/05

  • Next message: Bénoni MARTIN: "RE: SQL injection"
    Date: Thu, 09 Jun 2005 09:07:22 -0700
    To: <faisal@netxs.com.pk>, <pen-test@securityfocus.com>
    
    

    All relational databases are susceptible to SQL injection attacks. Here's the "official" MS intro/guide to countermeasures:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh18.asp
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh14.asp

    Above all, as others have mentioned, if the database port is exposed then risk of compromise is significantly higher. A DB and application should be behind a filter/firewall and traffic should be restricted to trusted systems...this is not only a best practice, it is now included in regulations such as the Payment Card Industry Security Standard.

    Hope that helps,

    Davi

    >>> Faisal Khan <faisal@netxs.com.pk> 06/09/05 08:37AM >>>

    Pardon the ignorance, but is there any hardware/software based device that
    can outright prevent/mitigate (detect?) SQL injections? Would an IDS be
    able to prevent this?

    At 08:29 PM 6/9/2005, you wrote:
    >Another option you could try is to use ettercap to insert your
    >laptop/pen-test system in as a Man-in-the-Middle between the SQL server
    >and client systems and then capture the port 1433 traffic using
    >tcpdump/ethereal/your favorite packet capturing program. This will
    >definitely yield the 'sa' password (as well as others).
    >
    >If you're using Windows on your attack platform, consider using Cain &
    >Abel as it can do the Man-in-the-Middle/SQL password capture all in one.
    >
    >Ido
    >--
    >Ido Dubrawsky, CISSP
    >Senior Security Consultant
    >SBC/Callisma
    >(571) 633-9500 (Office)
    >(202) 213-9029 (Mobile)
    >
    >
    > > -----Original Message-----
    > > From: Erik Pace Birkholz [mailto:erik@specialopssecurity.com]
    > > Sent: Thursday, June 09, 2005 4:06 AM
    > > To: Hugo Vinicius Garcia Razera; pen-test@securityfocus.com
    > > Cc: Erik Pace Birkholz
    > > Subject: RE: pen-test on a windows 2003 server box whit
    > > MS-SQL and Terminal Services
    > >
    > >
    > > Hugo,
    > >
    > > Based on the limited info you have provided, here is my advice.
    > >
    > > Have you done UDP port scans? If you haven't done so, scan to
    > > determine
    > > what UDP ports are open. Depending on what you find this could be
    > > helpful. For example, if SNMP is available with a default or guessable
    > > community name it will provide usernames among other goodies.
    > >
    > > Re: obtaining the SQL version; since the OS is Win3k the SQL
    > > server will
    > > likely be SQL 2000 with SP3 or later. If you really want to
    > > find out try
    > > SQLVer (www.sqlsecurity.com) as Chip already mentioned and
    > > try SQLRecon
    > > (www.SpecialOpsSecurity.com -click on LABS).
    > >
    > > With that said don't give up on the SQL "SA" brute force
    > > attacks. There
    > > is no account lock out for SA so rock and roll. SQLDict.exe
    > > works pretty
    > > well if you have a big dictionary file. Another option is ForceSQL.exe
    > > because it brute forces an account (sa) based on a user specified
    > > character set (charset.txt) up to a user specified max
    > > password length.
    > >
    > > You also mentioned DNS: 53. Not sure if you are referring to
    > > UDP or TCP?
    > > If it is TCP then you should try a zone transfer.
    > >
    > > Also don't forget full (1-65535) TCP port scans and source port scans
    > > (SRC=20,53,88,80,etc...)
    > >
    > > Finally use tracerouting, hping2, tcpdump, etc to determine if the
    > > blocking ACLs are on the host or a network device. Something is
    > > facilitating the firewalling that is hiding juicy MS specific
    > > ports like
    > > TCP 135 and 445. Is it ICF, IPSec, a personal firewall, network
    > > firewall, perimeter router or what? Once you know this it will help
    > > direct your attempts to subvert that protection and get
    > > exposure to more
    > > ports on the target.
    > >
    > > Let us know how it goes!
    > >
    > > Good luck,
    > >
    > > Erik Pace Birkholz
    > > www.SpecialOpsSecurity.com
    > >
    > >
    > >
    > > -----Original Message-----
    > > From: Hugo Vinicius Garcia Razera [mailto:hviniciusg@gmail.com]
    > > Sent: Tuesday, June 07, 2005 4:01 PM
    > > To: pen-test@securityfocus.com
    > > Subject: pen-test on a windows 2003 server box whit MS-SQL
    > > and Terminal
    > > Services
    > >
    > > Hi every one, I'm doing a pen test on a client, and have found that he
    > > have a windows 2003 server box on one segment of his public addresses
    > > this is his dns/web/mail server:
    > >
    > > - mssql :1433
    > > - terminal services :3389
    > > - iis 6 :80
    > > - smtp :25
    > > - pop3 :110
    > > - dns : 53
    > > - ftp : filtered
    > >
    > > ports opened, i logged on the terminal services port whit the winxp
    > > remote desktop utility and it connects perfectly.
    > >
    > > i tried a dictionari atack on mssql server whit the "sa" account and
    > > others user names i collected.
    > > Hydra from THC was the tool, but no succes on this atack.
    > > also tried the tsgrinder for terminal services , but no success.
    > >
    > >
    > > well here come some questions:
    > >
    > > - What others Usernames should i try for sql and terminal services?
    > > i tried whit "sa" for sql and "Administrator" for TS
    > >
    > > - Any one knows how could i identify what version of sql server is
    > > running.
    > > - What other services of this host can be exploited?
    > >
    > > any comments, ideas, suggestions would be greatly appreciated.
    > >
    > > Hugo Vinicius Garcia Razera
    > >

    Faisal Khan
    CEO
    Net Access Communication
    Systems (Private) Limited
    _____________________________
    1107 Park Avenue, 24-A, Block 6,
    PECHS, Main Shahrah-e-Faisal,
    Karachi 74500 (Pakistan)
    Board: +92 (21) 111 222 377
    Direct: +92 (21) 454-346
    Fax: +92 (21) 454-4347
    Cell: +92 (333) 216-1291
    Email: faisal@netxs.com.pk
    Web: <http://www.netxs.com.pk/>www.netxs.com.pk
    ************************************************************************************************
    The contents of this email and any attachments are confidential.
    It is intended for the named recipient(s) only.
    If you have received this email in error please notify the system manager or the
    sender immediately and do not disclose the contents to anyone or make copies.

    This email was scanned for viruses, vandals and malicious content.
    via mail3.westmarine.com
    *************************************************************************************************


  • Next message: Bénoni MARTIN: "RE: SQL injection"

    Relevant Pages

    • Re: [Full-disclosure] Brute force attack - need your advice
      ... But please state a config that someone with experience can not get into, is more of a point that security is ever evolving. ... Yup it is security by obscurity and it will help against a script kiddie that won't take the time to scan all ports, thats why I suggested move to a high non-standard port. ... I'm not talking about downloading blacklists but dynamic firewall rules and scripting to achieve a dynamic list based on ranking of attacks against the box. ...
      (Full-Disclosure)
    • Re: Scanning Class A network
      ... >network to identify hosts and ports exposed to the Internet. ... >Audit your website security with Acunetix Web Vulnerability Scanner: ... Cross site scripting and other web attacks before hackers do! ...
      (Pen-Test)
    • RE: Scanning Class A network
      ... The network you're scanning will have changed significantly in the time ... Assuming you could build a cluster to check 100,000 ports per second, ... >Audit your website security with Acunetix Web Vulnerability Scanner: ... Up to 75% of cyber attacks are launched on shopping carts, ...
      (Pen-Test)
    • Re: [fw-wiz] IPS vs. Firewalls (why vs. ?)
      ... that listening ports on the proxy-firewall. ... The only attacks you're mitigating ... There are about a million ways I can get a malicious WMF to ...
      (Firewall-Wizards)
    • Re: Sniffing on a switch
      ... ALternativley ports can be spanned. ... switch, thus helping the sniffer. ... > Audit your website security with Acunetix Web Vulnerability Scanner: ... Up to 75% of cyber attacks are launched on shopping carts, ...
      (Pen-Test)