VYPR
Medium severity4.2OSV Advisory· Published Aug 27, 2025· Updated Apr 15, 2026

CVE-2025-57821

CVE-2025-57821

Description

Basecamp's Google Sign-In adds Google sign-in to Rails applications. Prior to version 1.3.0, it is possible to craft a malformed URL that passes the "same origin" check, resulting in the user being redirected to another origin. Rails applications configured to store the flash information in a session cookie may be vulnerable, if this can be chained with an attack that allows injection of arbitrary data into the session cookie. This issue has been patched in version 1.3.0. If upgrading is not possible at this time, a way to mitigate the chained attack can be done by explicitly setting SameSite=Lax or SameSite=Strict on the application session cookie.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
google_sign_inRubyGems
< 1.3.01.3.0

Affected products

1

Patches

3
e206b0af5035

Merge pull request #74 from basecamp/flavorjones/gemspec-files

https://github.com/basecamp/google_sign_inMike DalessioAug 27, 2025via osv
1 file changed · +1 2
  • google_sign_in.gemspec+1 2 modified
    @@ -13,6 +13,5 @@ Gem::Specification.new do |s|
       s.add_dependency 'google-id-token', '>= 1.4.0'
       s.add_dependency 'oauth2', '>= 1.4.0'
     
    -  s.files      = `git ls-files`.split("\n")
    -  s.test_files = `git ls-files -- test/*`.split("\n")
    +  s.files = Dir["{app,config,lib}/**/*", "MIT-LICENSE", "README.md", "SECURITY.md"]
     end
    
859036512012

Merge pull request #73 from basecamp/flavorjones/fix-url-check

https://github.com/basecamp/google_sign_inMike DalessioAug 26, 2025via ghsa
2 files changed · +17 2
  • lib/google_sign_in/redirect_protector.rb+5 2 modified
    @@ -9,9 +9,12 @@ class Violation < StandardError; end
         QUALIFIED_URL_PATTERN = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
     
         def ensure_same_origin(target, source)
    -      if target.blank? || (target =~ QUALIFIED_URL_PATTERN && origin_of(target) != origin_of(source))
    -        raise Violation, "Redirect target #{target.inspect} does not have same origin as request (expected #{origin_of(source)})"
    +      if (target =~ QUALIFIED_URL_PATTERN && origin_of(target) == origin_of(source)) ||
    +         target =~ URI::DEFAULT_PARSER.regexp[:ABS_PATH]
    +        return
           end
    +
    +      raise Violation, "Redirect target #{target.inspect} does not have same origin as request (expected #{origin_of(source)})"
         end
     
         private
    
  • test/models/redirect_protector_test.rb+12 0 modified
    @@ -8,6 +8,18 @@ class GoogleSignIn::RedirectProtectorTest < ActiveSupport::TestCase
         end
       end
     
    +  test "disallows URL target that is not a valid URL" do
    +    assert_raises GoogleSignIn::RedirectProtector::Violation do
    +      GoogleSignIn::RedirectProtector.ensure_same_origin 'https://basecamp.com\n\r@\n\revil.com', 'https://basecamp.com'
    +    end
    +  end
    +
    +  test "disallows URL target that is blank" do
    +    assert_raises GoogleSignIn::RedirectProtector::Violation do
    +      GoogleSignIn::RedirectProtector.ensure_same_origin '', 'https://basecamp.com'
    +    end
    +  end
    +
       test "disallows URL target with different port than source" do
         assert_raises GoogleSignIn::RedirectProtector::Violation do
           GoogleSignIn::RedirectProtector.ensure_same_origin 'https://basecamp.com:10443', 'https://basecamp.com'
    
a0548a604fb1

Prevent redirects to malformed URLs

https://github.com/basecamp/google_sign_inMike DalessioAug 22, 2025via ghsa
2 files changed · +17 2
  • lib/google_sign_in/redirect_protector.rb+5 2 modified
    @@ -9,9 +9,12 @@ class Violation < StandardError; end
         QUALIFIED_URL_PATTERN = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
     
         def ensure_same_origin(target, source)
    -      if target.blank? || (target =~ QUALIFIED_URL_PATTERN && origin_of(target) != origin_of(source))
    -        raise Violation, "Redirect target #{target.inspect} does not have same origin as request (expected #{origin_of(source)})"
    +      if (target =~ QUALIFIED_URL_PATTERN && origin_of(target) == origin_of(source)) ||
    +         target =~ URI::DEFAULT_PARSER.regexp[:ABS_PATH]
    +        return
           end
    +
    +      raise Violation, "Redirect target #{target.inspect} does not have same origin as request (expected #{origin_of(source)})"
         end
     
         private
    
  • test/models/redirect_protector_test.rb+12 0 modified
    @@ -8,6 +8,18 @@ class GoogleSignIn::RedirectProtectorTest < ActiveSupport::TestCase
         end
       end
     
    +  test "disallows URL target that is not a valid URL" do
    +    assert_raises GoogleSignIn::RedirectProtector::Violation do
    +      GoogleSignIn::RedirectProtector.ensure_same_origin 'https://basecamp.com\n\r@\n\revil.com', 'https://basecamp.com'
    +    end
    +  end
    +
    +  test "disallows URL target that is blank" do
    +    assert_raises GoogleSignIn::RedirectProtector::Violation do
    +      GoogleSignIn::RedirectProtector.ensure_same_origin '', 'https://basecamp.com'
    +    end
    +  end
    +
       test "disallows URL target with different port than source" do
         assert_raises GoogleSignIn::RedirectProtector::Violation do
           GoogleSignIn::RedirectProtector.ensure_same_origin 'https://basecamp.com:10443', 'https://basecamp.com'
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

8

News mentions

0

No linked articles in our index yet.