lynndylanhurley / lynndylanhurley/devise_token_auth

Pentester criticises: Redirct Urls are not validated before redirect occurs

Open
#1,527 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hi - one of my projects just got pentested and the behavior of redirecting got mentioned as a medium issue:

The whitelist check is only applied when the email with the redirect link is generated. So it is possible to intercept the email, edit the GET route, change the base server address to a manipulated website, deliver the email, catch the token on the "wrongly" redirected website and with the stolen token take over the account.

Maybe change passwords_controller like:

          requested_redirect_url = @resource.build_auth_url(@redirect_url, redirect_headers)
          if DeviseTokenAuth::Url.whitelisted? requested_redirect_url
            redirect_to(requested_redirect_url)
          else
            render_edit_error
          end

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the redirect flow in passwords_controller, including build_auth_url, the whitelist check, redirect_to, and render_edit_error. Done means the redirect URL is validated before the redirect occurs and rejected URLs use the error path; verify the affected controller behavior with the repository’s relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, authentication, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.