LoginSignup
3
2

More than 3 years have passed since last update.

OWASP Juice Shop をソースから動かす

Posted at

OWASP Juice Shop

OWASP Juice Shopは、"安全でない"WEBアプリケーションです。セキュリティトレーニングや脆弱性のデモ、CTFの学習として使えるサイトです。OWASP TOP 10を含む多くの脆弱性が予め埋め込まれており、擬似的にハッキングを勉強することができます。さらにハッキング状況をスコアボードで追跡しており、ちょっとしたゲーム感覚で勉強できます。

脆弱性診断ツールを試したり、脆弱性診断員の勉強なんかに使ったりします。

環境

"安全でない"環境なので、ローカルな環境で動かすのが良いです。今回は、自分のPC上に構築しました。

  • macOs Catalina
  • node.js v12.16.1

手順

GitHubを参考にすると以下の通りです。

  1. node.jsのインストール
  2. git clone https://github.com/bkimminich/juice-shop.gitでgitからソースをcloneする
  3. npm installでパッケージインストール
  4. npm startでスタート
  5. http://localhost:3000にアクセス

node.jsのインストール

バージョンですが、GitHubのバージョン情報を参考にすると、10.X以降(11.X)を除くが対応のようです。
なので、安定版である12.Xを入れることにしました。

こちらの記事を参考に入れました。MacにNode.jsをインストール

  1. Homebrewのインストール
  2. nodebrewのインストール
  3. node.jsのインストール

Homebrewのインストール

Homebrewは、macOS用パッケージマネージャーです。
https://brew.sh/index_ja.html に記載されているコマンドをターミナルで実行するだけです。

% /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
...
% brew -v
Homebrew 2.2.6
Homebrew/homebrew-core (git revision 42c65e; last commit 2020-02-28)

バージョンが表示されていれば良いかと思います。

nodebrewのインストール

% brew install nodebrew
...
% nodebrew -v
nodebrew 1.0.1

Usage:
...

バージョンが表示されていれば、インストール完了です。

node.jsのインストール

インストールは下記コマンドでできます。
nodebrew install-binary <version>
<version>を直接指定する場合は、nodebrew ls-remoteで、バージョンを確認すると良いと思います。

今回は、安定版をインストールしたかったので、stableとしました。

% nodebrew install-binary stable
Fetching: https://nodejs.org/dist/v12.16.1/node-v12.16.1-darwin-x64.tar.gz
Warning: Failed to create the file                                                                                                                                                                         
Warning: /Users/koujimatsuda/.nodebrew/src/v12.16.1/node-v12.16.1-darwin-x64.ta
Warning: r.gz: No such file or directory
                                                                                                                                                                                                        0.0%
curl: (23) Failed writing body (0 != 1019)
download failed: https://nodejs.org/dist/v12.16.1/node-v12.16.1-darwin-x64.tar.gz

上記エラーがでた場合、元記事を参考にフォルダを作ってやります。

% mkdir -p ~/.nodebrew/src

もう一回

% nodebrew install-binary stable
Fetching: https://nodejs.org/dist/v12.16.1/node-v12.16.1-darwin-x64.tar.gz
##################################################################################################################################################################################################### 100.0%
Installed successfully
% nodebrew ls                   
v12.16.1

current: none

使うバージョンを指定します。

% nodebrew use v12.16.1
use v12.16.1
koujimatsuda@matsudakoujinoMacBook-Pro practice % nodebrew ls          
v12.16.1

current: v12.16.1

最後にパスを通す

% echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zprofile
% source ~/.zprofile 

gitからソースをcloneする

git clone https://github.com/bkimminich/juice-shop.gitです。

% git clone https://github.com/bkimminich/juice-shop.git
% ls
juice-shop

パッケージインストール

% cd juice-shop
% npm install

しばし待つ

スタート

% npm start

> juice-shop@9.3.1 start /Users/koujimatsuda/development/juice-shop
> node app

info: All dependencies in ./package.json are satisfied (OK)
info: Detected Node.js version v12.16.1 (OK)
info: Detected OS darwin (OK)
info: Detected CPU x64 (OK)
info: Required file index.html is present (OK)
info: Required file styles.css is present (OK)
info: Required file main-es2015.js is present (OK)
info: Required file tutorial-es2015.js is present (OK)
info: Required file polyfills-es2015.js is present (OK)
info: Required file runtime-es2015.js is present (OK)
info: Required file vendor-es2015.js is present (OK)
info: Required file main-es5.js is present (OK)
info: Required file tutorial-es5.js is present (OK)
info: Required file polyfills-es5.js is present (OK)
info: Required file runtime-es5.js is present (OK)
info: Required file vendor-es5.js is present (OK)
info: Configuration default validated (OK)
info: Port 3000 is available (OK)
info: Server listening on port 3000
info: Solved challenge Score Board (Find the carefully hidden 'Score Board' page.)

アクセス

http://localhost:3000にアクセスしてページが表示されれば完了です。

最後に

今回は、ソースからインストールする時の手順を書きましたが、dockerで始めた方が動かすのも再構築も簡単なので、そっちの方がおすすめです。

OWASP Juice Shop をDocker上で動かす

ソースとか修正して色々試してみたい方は、ソースからの手順を試してみてはいかがでしょう。

参考

https://github.com/bkimminich/juice-shop
https://qiita.com/kyosuke5_20/items/c5f68fc9d89b84c0df09

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2