Headline
CVE-2022-36073: Merge pull request from GHSA-8qpf-wf2p-25vg · rubygems/rubygems.org@90c9e6a
RubyGems.org is the Ruby community gem host. A bug in password & email change confirmation code allowed an attacker to change their RubyGems.org account’s email to an unowned email address. Having access to an account whose email has been changed could enable an attacker to save API keys for that account, and when a legitimate user attempts to create an account with their email (and has to reset password to gain access) and is granted access to other gems, the attacker would then be able to publish and yank versions of those gems. Commit number 90c9e6aac2d91518b479c51d48275c57de492d4d contains a patch for this issue.
@@ -96,4 +96,36 @@ def forgot_password_with(email)
assert page.has_content?(“Sign out”) end
test “resetting password with pending email change” do visit sign_in_path
email = @user.email new_email = “[email protected]”
fill_in "Email or Username", with: email fill_in "Password", with: @user.password click_button “Sign in”
visit edit_profile_path
fill_in "Username", with: “username” fill_in "Email address", with: new_email fill_in "Password", with: @user.password perform_enqueued_jobs { click_button “Update” }
assert_equal new_email, @user.reload.unconfirmed_email
click_link “Sign out”
forgot_password_with email
assert_nil @user.reload.unconfirmed_email
token = /edit\?token=(.+)$/.match(password_reset_link)[1] visit update_email_confirmations_path(token: token)
assert @user.reload.authenticated? PasswordHelpers::SECURE_TEST_PASSWORD assert_equal email, @user.email end end