プログラムブログ

PHP、Database、ネットワーク、サーバセキュリティ

ratproxyを試してみた

Googleから新しく提供されたWebアプリケーションセキュリティチェックツール ratproxy を試してみた。

まずはここからダウンロードしCentOS5(vmware)にもってきた。

$tar xvzf ratproxy-1.51.tar.gz で解凍

$make を実行したところ次のエラー

cc ratproxy.c -o ratproxy  -Wall -O3 -Wno-pointer-sign -D_GNU_SOURCE http.c mime.c ssl.c -lcrypto -lssl
ratproxy.c:43:25: error: openssl/md5.h: そのようなファイルやディレクトリはありません
http.c:42:25: error: openssl/md5.h: そのようなファイルやディレクトリはありません
http.c: In function ‘checksum_response’:
http.c:1329: error: ‘MD5_CTX’ undeclared (first use in this function)
http.c:1329: error: (Each undeclared identifier is reported only once
http.c:1329: error: for each function it appears in.)
http.c:1329: error: expected ‘;’ before ‘ctx’
http.c:1339: 警告: implicit declaration of function ‘MD5_Init’
http.c:1339: error: ‘ctx’ undeclared (first use in this function)
http.c:1340: 警告: implicit declaration of function ‘MD5_Update’
http.c:1341: 警告: implicit declaration of function ‘MD5_Final’
mime.c:39:25: error: openssl/md5.h: そのようなファイルやディレクトリはありません
ssl.c:38:25: error: openssl/ssl.h: そのようなファイルやディレクトリはありません
ssl.c:39:25: error: openssl/err.h: そのようなファイルやディレクトリはありません
ssl.c: In function ‘ssl_start’:
ssl.c:107: error: ‘SSL_CTX’ undeclared (first use in this function)
ssl.c:107: error: (Each undeclared identifier is reported only once
ssl.c:107: error: for each function it appears in.)
ssl.c:107: error: ‘cli_ctx’ undeclared (first use in this function)
ssl.c:107: error: ‘srv_ctx’ undeclared (first use in this function)
ssl.c:107: 警告: カンマ演算子の左側の式に効力がありません
ssl.c:108: error: ‘SSL’ undeclared (first use in this function)
ssl.c:108: error: ‘cli_ssl’ undeclared (first use in this function)
ssl.c:108: error: ‘srv_ssl’ undeclared (first use in this function)
ssl.c:108: 警告: カンマ演算子の左側の式に効力がありません
ssl.c:109: error: ‘BIO’ undeclared (first use in this function)
ssl.c:109: error: ‘err’ undeclared (first use in this function)
ssl.c:137: 警告: implicit declaration of function ‘SSL_library_init’
ssl.c:138: 警告: implicit declaration of function ‘SSL_load_error_strings’
ssl.c:140: 警告: implicit declaration of function ‘BIO_new_fp’
ssl.c:140: error: ‘BIO_NOCLOSE’ undeclared (first use in this function)
ssl.c:141: 警告: implicit declaration of function ‘SSL_CTX_new’
ssl.c:141: 警告: implicit declaration of function ‘SSLv23_client_method’
ssl.c:142: 警告: implicit declaration of function ‘SSLv23_server_method’
ssl.c:144: 警告: implicit declaration of function ‘ERR_print_errors’
ssl.c:146: 警告: implicit declaration of function ‘SSL_CTX_use_certificate_chain_file’
ssl.c:149: 警告: implicit declaration of function ‘SSL_CTX_use_PrivateKey_file’
ssl.c:149: error: ‘SSL_FILETYPE_PEM’ undeclared (first use in this function)
ssl.c:152: 警告: implicit declaration of function ‘SSL_new’
ssl.c:157: 警告: implicit declaration of function ‘SSL_set_fd’
ssl.c:158: 警告: implicit declaration of function ‘SSL_connect’
ssl.c:162: 警告: implicit declaration of function ‘SSL_accept’
ssl.c:190: 警告: implicit declaration of function ‘SSL_read’
ssl.c:221: 警告: implicit declaration of function ‘SSL_write’
make: *** [ratproxy] エラー 1

どうやらopenssl-develがはいっていないことが原因のようだ。openssl-develをインストールして再度make。

$ make
cc ratproxy.c -o ratproxy  -Wall -O3 -Wno-pointer-sign -D_GNU_SOURCE http.c mime.c ssl.c -lcrypto -lssl

あっさり終了。

次にratproxyを起動する。

いろいろオプションがあるのだが、まずは次のオプションで実行。(オプションについての説明はこのページ)

$ ./ratproxy -w log -lfscm

[!] WARNING: Running with no ‘friendly’ domains specified. Many cross-domain
checks will not work. Please consult the documentation for advice.

[*] Proxy configured successfully. Have fun, and please do not be evil.
[+] Accepting connections on port 8080/tcp (local only)..

ドメイン指定していないのでWARNINGがでたがとりあえずこのまま動かす。
netstatで確認すると、127.0.0.1:8080 が稼働している。

ratproxyを動かしているマシン上でWebブラウザを起動し、プロキシをlocalhost:8080/tcp に設定する。

Webブラウザでチェックしたいサイトにアクセスする。ある程度アクセスしたところでいったん ratproxyを停止。

結果のログを出力する。
./ratproxy-report.sh log > report.html

report.htmlを確認するとこんな感じ。

本当はPassive test ではなくて、Active Testの挙動を見たいのだが、今日は長くなったのでここまで。とりあえず動作することを確認したということで。

No comments yet. Be the first.

Leave a reply