LoginSignup
0
0

More than 1 year has passed since last update.

rack gemの脆弱性CVE-2022-30122, CVE-2022-30123について

Last updated at Posted at 2022-06-01

gem rackの脆弱性CVE-2022-30122, CVE-2022-30123について

CVE-2022-30122

アナウンス

概要

以下の処理を使用している場合にrackでMIMEのパースを行う際に使用している正規表現でReDoSが可能。

  • Rack::Multipart.parse_multipart
  • request.POST
  • request.params

修正コミット

CVE-2022-30123

アナウンス

概要

以下のrack middlewareの処理の中でリクエストのパース処理に脆弱性がありOSコマンドインジェクションが可能

  • Rack::Lint
  • Rack::CommonLogger

修正コミット

Rack::Lint

callメソッドで指定されたOOPS?\b!がエスケープされて/OOPS\?\\/になっている

lambda {
  Rack::Lint.new(nil).call(env("REQUEST_METHOD" => "OOPS?\b!"))
}.must_raise(Rack::Lint::LintError).
  message.must_match(/OOPS\?\\/)

Rack::CommonLogger

requestメソッドの引数で指定されるGET\が エスケープされて/GET\\x8になっている

it "escapes non printable characters except newline" do
  logdev = StringIO.new
  log = Logger.new(logdev)
  Rack::MockRequest.new(Rack::CommonLogger.new(app_without_lint, log)).request("GET\b", "/hello")

  logdev.string.must_match(/GET\\x8 \/hello HTTP\/1\.1/)
end
0
0
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
0
0