etcher: Etcher should not fake a system password prompt
- Etcher version: All since commit 9b82891abb86fc27c3df531fa6e1086192de4f03 from @zvin
- Operating system and architecture: macOS (but possibly Linux as well, I don’t it on desktop platforms to validate this)
- Image flashed: Does not apply
- Do you see any meaningful error information in the DevTools? Does not apply
Before flashing a device, Etcher shows what appears to be a system prompt asking for the user’s password, but it is not in fact a system prompt: Etcher’s own application is emulating a system prompt and capturing the password itself 👇
const result = app.displayDialog('balenaEtcher needs privileged access in order to flash disks.\n\nType your password to allow this.', {
defaultAnswer: '',
withIcon: 'caution',
buttons: ['Cancel', 'Ok'],
defaultButton: 'Ok',
hiddenAnswer: true,
})
This tricks users, who think they are entering their password into a trusted system prompt, into forfeiting their password to an arbitrary userspace application who can do with it as it pleases, subverting the system’s own mechanisms for escalating a process’s privilege, so that the application can choose at it’s own whim what to escalate, rather than the user.
This is similar to what Zoom’s notoriously shady installer did to bypass escalation prompts, and even though not necessarily indicative of malicious practices, it’s terrible practice and a complete betrayal of the user’s trust, not to mention a possible malware vector.
Please, stop emulating system prompts and leverage the standard system mechanisms to implement process escalation. The RaspberryPi Imager app is similar in intent to Etcher and as far as I could tell, seems to be using the standard system mechanisms to escalate privilege when it’s time to flash (as a matter of fact, it prompts for a much more granular and specific access than full-blown sudo), you should do the same.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 54
- Comments: 27 (7 by maintainers)
Just another vote for fixing this - downloaded and tried Etcher today and immediately went searching to see if this is spyware. Password prompts should always be from the system, period. An app-specific dialog asking for a password is basically a big sign that says “I’m here to steal your information and do something bad with it, just checking to see if you are foolish enough to fall for it”.
It seems like this wasn’t done maliciously but, yeah, just another opinion here reiterating the point - this is a really bad and scary user experience. Etcher needs access, not my password. It’s 2023, a lot more users know the difference these days.
Same here, it did not make me a bit concerned though, it made me terribly concerned, which also lead me here.
The Raspberry Pi Imager requires no such escalation shenanigans. It would be great to include the same method they use, but of course it could be some limitation of etcher being based on electron. https://github.com/raspberrypi/rpi-imager
Emulating a system prompt for a users password is a big no-no.
Etcher never sees the password, we use
sudo --askpass. The only code that “sees” the password is https://github.com/balena-io/etcher/blob/master/lib/shared/catalina-sudo/sudo-askpass.osascript.js , it is invoked bysudo( https://github.com/balena-io/etcher/blob/cc08ac9236fad0e98700ab403726116122b821c6/lib/shared/catalina-sudo/sudo.ts#L34 ) and is not part of etcher itself. Etcher never sees your password.Please read the other issues, this no longer works for writing to
/dev/disk*starting from Catalina.How ?
I had a quick look at rpi-imager, it uses
authopen, this could probably work for etcher too but requires some native code https://github.com/raspberrypi/rpi-imager/blob/qml/mac/macfile.cpp#L25 . Pull requests are welcome.It’s been four years since this issue was first reported, and it still hasn’t been resolved. While I truly appreciate Balena and the fact that it’s free to use, I believe addressing the password prompt behavior should be prioritized. I’ve used numerous other applications and have never encountered this issue and immediately was wondering if the software is actually legit.
I hope that a patch will be proposed to bring Etcher into line with good practice. Continuing to use Etcher as it works today is like living in the world of Dune, permanently wearing a heart valve on your chest: everything’s fine as long as nobody pulls on it.
Users can’t be expected to check the source code for potential malicious changes every time they accept an update from Etcher. If we want to be consistent, we must uninstall Etcher on macOS as long as the application persists in asking the user for his password rather than requesting privileges to be raised from the system.
This comment posted on #4026 states that the Raspberry Pi Imager application for macOS obtains the right to write blocks to a device directly from the OS, and not by collecting the password directly from the user.
I find it puzzling that an application with such bad security practice and dubious privacy handling is often the recommended tool for flashing images. Well, I guess there often isn’t a better alternative.
I totally agree with Bradleyoeabody. I am here just because I found very strange that a program ask for my password, and not ask the system for access. I will try to see if there is an alternative (ie another program that do not ask my password, but rather ask access to the system).
Calling
sudoon a Mac is the wrong thing to do. My use account type is “standard” and you need to become an “administrator” to access the low-level disk device. As others have mentioned, the RaspberryPi Imager manages this feat. You don’t need to become root do do it, you just need to ask the right question.+1
Here is the command line that could be used to write an ISO image to a usb memory stick. Tested on MacOS using the default dd application:
sudo dd if=/Users/<depends_on_you>/Downloads/<image_name>.iso of=/dev/<removable_stick_name> bs=1m conv=noerror,sync status=progressThe ISO image that is burned onto the USB memory stick will then be exactly the same bit by bit as the one that Etcher would have written.
On MacOS, to find out the name of the USB stick ‘as a raw block device’, use the following command:
diskutil listBefore writing to the USB memory stick with dd, it is mandatory to unmount it with the following command:
sudo diskutil umount /Volumes/<partition_name_on_your_stick>To find out the name of the USB stick ‘as a volume’, use the following command:
ls -l /Volumes/In practice, Etcher is a great tool because it does all this through a GUI that makes it impossible to make a mistake, compared to the many steps and potential question marks an end user has to go through to do the same thing with dd. Both end up working exactly the same.
You’re right and it’s embarrassing but it’s not for lack of trying to resolve this. Digging into the problem the only way forward appears to be to refactor a huge chunk of Etcher into what Apple calls XPC services, which is not a project we can take on right now.