Open Bug 1759788 Opened 4 years ago Updated 28 days ago

Password captured after page script fills it with dummy values

Categories

(Toolkit :: Password Manager: Site Compatibility, defect, P3)

Firefox 98
defect

Tracking

()

UNCONFIRMED

People

(Reporter: octavio.molano, Assigned: serg)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:98.0) Gecko/20100101 Firefox/98.0

Steps to reproduce:

When logging into sites that use CHAP authentication, Firefox doesn't correctly remember the password and gets either an empty string or a string of zeroes (one for each password character).

Step 1: Go to https://demo03.vinipad.net/
Step 2: Try to login using any username and password (it doesn't matter if you don't actually log into the site because you don't know the password)
Step 3: After clicking on the "Login" button, a popup will offer to remember the password.

Actual results:

If the password is stored with the "Save" button, that password will be a string of zeroes instead of the actual password entered into the field.

Expected results:

The password stored should have been the actual password, not a string of zeroes.

Chrome, on the other hand, does properly remember passwords on that same site.

The Bugbug bot thinks this bug should belong to the 'Toolkit::Password Manager' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Password Manager
Product: Firefox → Toolkit
Severity: -- → S2
Priority: -- → P2
Summary: Firefox doesn't remember the passwords in sites using CHAP authentication → Password captured from "hidden" field instead of the one on screen
Flags: needinfo?(sgalich)
Flags: needinfo?(sgalich)
See Also: → 1247245
Flags: needinfo?(sgalich)
Flags: needinfo?(sgalich)

What more info do you need?

Flags: needinfo?(sgalich)

:o2k no more info needed, thank you!
I can reproduce this bug.

The site's script replaces every character in password with 0 in sendForm() function.

sendForm: function() // Prepara entrada del usuario y envía el formulario
	{
		var chs=document.getElementById('hdn_chs');
		var pwd=document.getElementById('txt_pwd');
		var pl=pwd.value.length,dummy='';
		chs.value=sha1(sha1(pwd.value)+chs.value);
		for (var i = 0; i < pl; i++) {dummy += '0';}
		pwd.value=dummy;

		document.getElementById('btn_login').style.cursor = 'progress';
		document.body.style.cursor = 'progress';

		document.getElementsByTagName('form').item(0).submit();
	}

By the time Firefox capture values, they are modified by site's script.

Flags: needinfo?(sgalich)

Flagging for re-triage

Severity: S2 → --
Priority: P2 → --
Summary: Password captured from "hidden" field instead of the one on screen → Password captured after page script fills it with dummy values

:dimi, can you see what Chrome is doing here? I wonder what their heuristics are for a situation like this.

Severity: -- → S3
Flags: needinfo?(dlee)
Priority: -- → P3
Component: Password Manager → Password Manager: Site Compatibility

(In reply to Sergey Galich from comment #3)

The site's script replaces every character in password with 0 in sendForm() function.

sendForm: function() // Prepara entrada del usuario y envía el formulario
	{
		var chs=document.getElementById('hdn_chs');
		var pwd=document.getElementById('txt_pwd');
		var pl=pwd.value.length,dummy='';
		chs.value=sha1(sha1(pwd.value)+chs.value);
		for (var i = 0; i < pl; i++) {dummy += '0';}
		pwd.value=dummy;

		document.getElementById('btn_login').style.cursor = 'progress';
		document.body.style.cursor = 'progress';

		document.getElementsByTagName('form').item(0).submit();
	}

By the time Firefox capture values, they are modified by site's script.

The point of replacing the password with zeroes is to avoid sending a single-hashed password to the server, sending instead the combination of the hashed password plus the "challenge string" value, all hashed with sha1 a second time for better security, which is how CHAP authentication usually works.

Chrome somehow manages to capture the password value BEFORE the sendForm() function is executed, but that function is not executed from a "submit" type button input, but from just a "button" type button input with a JS click event, so I'm not quite sure how Chrome knows to store the unmodified password value even before a form submit action is requested.

Assignee: nobody → sgalich
Flags: needinfo?(dlee)
Depends on: 1771806
You need to log in before you can comment on or make changes to this bug.