Closed Bug 185929 Opened 23 years ago Closed 22 years ago

authentication loops endlessly if a clients relogons (under a new username/password)

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: danielh, Assigned: darin.moz)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.0.1) Gecko/20020919 IBM Web Browser for OS/2 Build Identifier: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.0.1) Gecko/20020919 IBM Web Browser for OS/2 Scenario: JOE has an account on foo.net; His wife JANE has an expired account on foo.net The server at foo.net uses digestauthentiation Joe requests bar.html, and enters his username and password, and recieves the content. A few minutes later, Jane takes over from Joe, and uses a "relogon" option (say, in a checkbox) to "switch users". This option works by temporarily suppressing Joe's account, and then sending a 401 authorization request Jane enters her username and password, which fails. The browser should then ask for a new username and password. INSTEAD, it sends Joe's username and password, then Janes, then Joes... ad infinitum. It seems that the browser remembers that "Joe's username/password works fine", and keeps looping between the two when (all of a sudden) Joe's username/password no longer work. If desired, I can create & post a simple example of this problem (I discovered it when using a proprietary resource). Reproducible: Always Steps to Reproduce: 1. If asksed, I'll set up a simple example of this on my web site 2. 3. Actual Results: browser did nothing -- the server shows that the browser was repetitively sending authorization requests (first for user1, then user2, then user1, ...) Expected Results: After user2's (jane, in the scenario described above) username/password failed, it should either ask the client to provide a new username and password. Or, perhaps try to use the user1 (joe, in the above scenario) username and password, and when that fails ask the client for a new username and password
Dup of bug 150604? (fixed on the trunk medio August) Reporter: Can you reproduce the bug on current trunk builds?
From my reading of 150604, it does NOT seem to be the same bug. Since I don't have easy access to the "trunk build", I can't answer that question at the moment. However, I have written a simple script that demonstrates this behaviour. Note that IBM Mozilla browser 2.0 for OS/2, [Mozilla/5.0(OS/2;..) Gecko/20020919for OS/2] Netscape 7.0 for WIN 98, Mozilla 1.1 for Mandrake Linux 9.0 [ [Mozilla/5.0 X11..) Gecko 20020826) for all fail; In contrast Opera 6.0 for WIN 98 IE 6.0 (for WIN 98), Netscape 4.x (for OS/2 and WIN98) do NOT fail (they do not go into an infinite loop of requests in response to 401 responses). Test: a) From Mozilla, goto http://srehttp.org/t1? b) You'll be presented with an authorization prompt for "Our Site" Enter "user1" for the username and "user1" for the password (without the " quotes). c) Since user1 is a recognized user, a "2nd step" screen will appear. Just hit the "click here to continue" button d) a javascript info screen will appear. Just hit the OK button e) A "Hello USER1" screen will appear. Now comes the fun part Hit the "reLogon" link f) You'll be presented with another authorization prompt, for "Test of Mozilla Authentication"., Enter "user2" for the username and "user2" for the password (without the " quotes) g) Since USER2 is NOT a recognized user, you'll immediately be presented with an authorization prompt for "T1". Now try to logon as user1 (the "recognized user)... Enter "user1" for the username and "user1" for the password (without the " quotes) h) Nothing happens. Actually, the status screen cyclically displays "Transferring data from srehttp.org" and "Sending request to srehttp.org" messages. Once you are convinced this is misbehavior is real, hit ESC to stop the request (don't let it run forever, since srehttp.org is a working site). Basically, what's happening is shown in the following modified server log: [Request and Username (from authentication request header) status messages - - common-log style entry for the response] /t? : User=user1 Okay user, now ask for "2nd password" - - user1 [18/Dec/2002:13:56:59 0500] "GET /t? HTTP/1.1" 200 15551 /t? : User=user1 Okay user,and okay 2nd password Action:: Say hello (prior user= - - user1 [18/Dec/2002:13:57:05 0500] "GET /t? HTTP/1.1" 200 417 /T?mode=logon&user=USER1 : User=user1 Okay user,and okay 2nd password Action:: Relogon with prior user=USER1 :: Relogon detected same username :: Sending a "possibly new username" auth response - - user1 [18/Dec/2002:13:57:08 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 593 /T?mode=logon&user=USER1 : User=user1 Okay user,and okay 2nd password Action:: Relogon with prior user=USER1 :: Relogon detected same username :: Sending a "possibly new username" auth response - - user1 [18/Dec/2002:13:57:08 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 593 /T?mode=logon&user=USER1 : User=user2 Okay password, but no 2nd password available. Send a 401 request (since user2 is not given access rights) - - user2 [18/Dec/2002:13:57:12 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 703 /T?mode=logon&user=USER1 : User=user2 Okay password, but no 2nd password available. Send a 401 request (since user2 is not given access rights) - - user2 [18/Dec/2002:13:57:13 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 703 /T?mode=logon&user=USER1 : User=user1 Okay user,and okay 2nd password Action:: Relogon with prior user=USER1 :: Relogon detected same username :: Sending a "possibly new username" auth response - - user1 [18/Dec/2002:13:57:18 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 593 /T?mode=logon&user=USER1 : User=user2 Okay password, but no 2nd password available. Send a 401 request (since user2 is not given access rights) : - - user2 [18/Dec/2002:13:57:19 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 703 /T?mode=logon&user=USER1 : User=user1 Okay user,and okay 2nd password Action:: Relogon with prior user=USER1 :: Relogon detected same username :: Sending a "possibly new username" auth response : - - user1 [18/Dec/2002:13:57:20 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 593 /T?mode=logon&user=USER1 : User=user2 Okay password, but no 2nd password available. Send a 401 request (since user2 is not given access rights) : - - user2 [18/Dec/2002:13:57:21 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 703 /T?mode=logon&user=USER1 : User=user1 Okay user,and okay 2nd password Action:: Relogon with prior user=USER1 :: Relogon detected same username :: Sending a "possibly new username" auth response : - - user1 [18/Dec/2002:13:57:21 0500] "GET /T?mode=logon&user=USER1 HTTP/1.1" 401 593 ... ad infinitum .....
Not OS/2 specific per reporter
OS: other → All
Hardware: PC → All
hi Daniel, my appologies for not responding to this bug report sooner. (many bugs, little time!) anyhow, there seems to be something wrong with the testcase. user1 does not appear to be a valid user any longer. if you could either fixup the testcase or simply generate a HTTP log for us that would be great! instructions for generating a HTTP log can be found here: http://www.mozilla.org/projects/netlib/http/http-debugging.html thanks!!
Yup, I had changed permissions, which inadvertently blocked access to this T1? resource. So I fixed things up, and it's now accessible Reminder: the test is found at http://srehttp.org/t1? a) enter username/password of user1/user1 at the 1st authentication screen b) you'll get a few status screens, hit the obvious buttons c) at the next authentication screen, enter user2/user2 d) this will not be accepted, you should get another authentication screen e) enter user1/user1 which ought to work, but instead puts the browser get's stuck sending auth responses Note: IBM Web Browser build "Gecko 20020919" will start "looping" after step e However, IBM Web Browser build "Gecko 20030616" won't even get to step d (the looping occurs after step c). Let me know if I can be of further assistance.
I've seen this behavior for basic when the a web server was configured to put an error message in as the realm field if the user had entered something in the incorrect format. Since, the default operation was to remember a password unless it next received another 401 for the same realm the password was considered correct. That password would automatically be replayed, everytime that realm was presented. The same thing happend at the error prompt, if the user put in a bad password, they were presented with the original prompt and realm. Since the realm changed that password was also cached and considered correct. Then an infinite loop began as the realm switched back and forth. Since this error involes realm changes, I'm guessing its the same problem. I'm not sure if its fixed yet on the trunk, but I've seen comments in the code suggesting it may be.
cneberg: yes, the bug you describe should be fixed on the trunk (see bug 201986). can someone please test a trunk build? builds are available here: ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-trunk based on when this bug was filed, i suspect this may be a duplicate bug report. cc'ing javier since this bug was originally filed against the 1.0.1 based IBM web browser for OS/2. *** This bug has been marked as a duplicate of 201986 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
I tried this on OS/2 Mozilla trunk and MacOSX Mozilla 1.6a. When clicking on the 'reLogon' link, I never get an authentication dialog; it just cycles from 'Transferring...' to 'Waiting for srehttp.org...' endlessly.
Well, I recently fixed a bug in the authentication procedure of the server handling srehttp.org (a problem with case translation). That seems to have unveiled this new, arguably worse, bug. That is, the "looping" starts even earlier. So you can try this: step 1) goto http://srehttp.org/t1? You'll get an authentication response from the "OUR SITE" realm step 2) enter a username of "user1" and a password of "user1" You'll get a "second step" screen that contains a simple form. step 3) enter the "click here to continue" button A javascript alert will appear. step 4) Hit okay A new request is submitted to the server, using the same request line (t1?),and that also is sent with a cookie (that is created by the javascript routine that threw up the alert) step 5)A "hello" screen will appear. Hit the "relogon" link This submits (to srehttp.org) a request of "t1?mode=logon&user=user1 At this point, the original bug report note that an authentication screen would be displayed, with a realm name of "Test of Mozilla Authentication". At which point, entering a "user2/user2" username/password would cause Mozilla to start repetitively sending authentication responses. BUT NOW, Mozilla just keeps sending the same authentication response it used for "t1?". That is, it sends the username, password, and cookie that worked (back in step 4). But this doesn't work for "t1?mode=logon&user=user1", So when the server sends a 401 request back, Mozilla does it again (sends the username,password, and cookie that worked in step 4). Which causes the server to ... ad infinitum. So, the problem is that Mozilla is NOT recognizing that "t1?" is NOT the same request as "t1?mode=logon&user=user1" --- EVEN THOUGH the realm used for t1?'s authentication was "OUR SITE" and the realm for t1?mode=logon&user=user1's authentication was "Test of Mozilla Authentication". As noted above, this bad behaviour is also shown by NS 7.1 under WIN 98. Opera 6.0 (under win 98) DOES NOT behave so badly (so it's not strictly some wierd server goofup). Summarizing: it appears Chris' is correct (since this behavior occurs when realms are switched.
daniel: what version of mozilla are you testing?
From about: IBM Web Browser for OS/2 Version 2.0.1 Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.3) Gecko/20030616 Note that this same behavior occurs under NetScape 7.1 for win 98 (do you need more details on which version?)
the infinite loop is caused by an error in the digest auth module on the server. it has set the STALE="TRUE" flag, which tells the browser that the username and password are not necessarily invalid, but that the digest auth credentials simply need to be recomputed using a new server supplied cnonce value. mozilla does so, but for some reason the server continues to complain. and it continues to set the STALE="TRUE" flag, and we repeat... reopening bug since this is indeed not a duplicate, but a different problem.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Attached file HTTP log —
here's the HTTP log that shows the server at fault. here's a typical response carrying a stale="TRUE" flag: 1106328880[81c9e70]: http response [ 1106328880[81c9e70]: HTTP/1.1 401 Unauthorized 1106328880[81c9e70]: Date: Fri, 21 Nov 2003 05:10:28 GMT 1106328880[81c9e70]: Cache-Control: no-cache 1106328880[81c9e70]: Connection: Close 1106328880[81c9e70]: WWW-Authenticate: Digest realm="Test of Mozilla Authentication", qop="auth", nonce="1398f0cd48ec6d2577ab2c6f53babf97:628", stale="TRUE" Basic Realm="Test of Mozilla Authentication" 1106328880[81c9e70]: Expires: Fri, 21 Nov 2003 05:10:28 GMT 1106328880[81c9e70]: Content-Type: text/html 1106328880[81c9e70]: Content-Length: 249 1106328880[81c9e70]: ] also, i meant nonce in my previous comment... not cnonce ;)
and here's the exerpt from RFC 2617 section 3.2.1, which has this to say about the stale flag: stale A flag, indicating that the previous request from the client was rejected because the nonce value was stale. If stale is TRUE (case-insensitive), the client may wish to simply retry the request with a new encrypted response, without reprompting the user for a new username and password. The server should only set stale to TRUE if it receives a request for which the nonce is invalid but with a valid digest for that nonce (indicating that the client knows the correct username/password). If stale is FALSE, or anything other than TRUE, or the stale directive is not present, the username and/or password are invalid, and new values must be obtained. marking INVALID.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → INVALID
Ooops. It wasn't a problem with the server, but in the test script I inadvertently called the authentication procedure with a "insert a stale" flag. That's fixed. And now we have the original behavior: a) logon using user1/user1 (Our Site is the realm) Get a form, hit the button, get a hello screen b) hit the "relogon" link on the hello screen c) logon using user2/user2 (Test of Mozilla... is the realm) d) an authentication screen is shown, T1 is the realm e) enter user1/user1 f) the looping statrs -- mozilla sends user1/user, then user2/user2, then user1/user1,.... If you are interested, I'll post an annotated server log. Since the 2nd user1/user1 logon is under a different realm, that may explain things (let me try using the same realm in the first and third logons)
Okay, I just tested the script using the same realm name in the "3rd authentiation" as in the "first authentication" -- and the looping now starts as soon as the 3rd authenctication screen is sent. I've reset this back (3rd authentication screen has a unique realm), but if anyone wants me to make the "third realm" the same as the first, just ask.
daniel: please try a recent mozilla build. netscape 7.1 is getting to be pretty old. using a recent nightly build from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest/ i cannot reproduce any loops. i keep getting prompted to enter username and password. if you can reproduce this bug using a recent build, then i will reopen the bug for investigation.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: