-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[security] send --code
does not verify that a nameplate was provided and uses the entire code as the nameplate instead
#193
Comments
Oh wow, I somehow had completely ignored that the protocol uses the entire code including the Nameplate for PAKE. I'll have a look into this. The thing is, that nameplates technically do not need to be numeric, so it is not easy to do validation. Maybe the best thing would be to simply assert something about the length of the password? Also, note that in what you describe codes like |
I don't see any issue with allowing string nameplates. (Actually, you can even set the code to the empty string, and have it claim an empty nameplate with an empty password. I transferred a file this way with no issues.)
That's a footgun for users to be sure. The biggest issue is that it's not obvious to the user what part of the code is nameplate and what part of it is password. That's actually how I discovered this bug, I was trying to figure out how MWRS handled that internally. I think the cleanest way to do this might be to break with the Python client and have separate Of course this might require more refactoring, and I'm not sure if breaking backward compatibility is an issue here. Edit: to clarify, I'm not suggesting breaking with the protocol and only using the password portion for PAKE. I'm suggesting changing the CLI so that the nameplate and password portions of the code are provided separately by the user. |
This has somehow been falling through the cracks, and I am not looking forward to making a new semver-breaking release so soon after the last one. Luckily this isn't difficult to solve, even with the current cli arguments. Generally this would "only" require some entropy validation in https://github.com/magic-wormhole/magic-wormhole.rs/blob/main/cli/src/main.rs#L295 by splitting the As a bonus, printing a warning whenever the code is less than, say, 10 bytes, is probably a good idea. And maybe amending the documentation to include some more information about how the code argument works, and about this check. I'll get around to it before the next minor release in a couple weeks, but I am always glad about contributions :) |
It's worth thinking about which issues we want to fix here:
A solution like "check that the code is at least four bytes long" doesn't solve this issue, because the PGP words are all >= 4 bytes but would still only have 8 bits of entropy. Given that the output of wormhole-rs is already very verbose, perhaps it would be a reasonable to explicitly print
when a custom code is used. This wouldn't cause any issue with UX because we already explicitly print the whole wormhole "code" and give an example of usage "wormhole-rs receive claim-arrange". |
send --code
does not verify that a nameplate was provided and uses the entire code as the nameplate insteadsend --code
does not verify that a nameplate was provided and uses the entire code as the nameplate instead
I think nameplates do have to be numbers, no? https://github.com/magic-wormhole/magic-wormhole/blob/master/docs/server-protocol.rst#concepts (At least, they currently are in the reference implementation, although I'm not entirely sure where that's enforced, or not) |
@meejah it's not enforced, in fact you can even make the nameplate the empty string and that works too. |
The intent is clearly that they're numbers, so probably it should be enforced (both on clients and the server). |
I have opened #257 and intend to merge this for 0.7.2
This will be a hard error in the next point release. This is too unsafe to ever be okay, and I'd rather have people's setups fall apart then.
I'll add a flag to the CLI client to support this later. At the very least "--password" as an alternative to "--code" makes a lot of sense to have.
#257 includes code to validate the entropy of the passed code words. This will be a hard error in the future, right now we only fail in interactive terminals for now. This should be almost all use cases. This requires library users to enable the optional "entropy" feature until we can make this a hard error for all use cases in the next release.
I have added number validation to nameplates. Right now it only prints a warning, I'll upgrade this to an error on the next breaking release. |
This is almost certainly not intended behavior, as it voids security since the nameplate is not private.
One of the more obvious impacts here is that users are vulnerable to a malicious mailbox server, which is why I'm disclosing this publicly - the only real fix for an affected user is to stop sending codes that don't contain a nameplate.
Unfortunately, this is more dangerous than I originally thought, because the wormhole mailbox protocol has a
list
feature that makes all nameplates public.In debug log:
In Wireshark (unmasked websocket text):
Code:
splitn
doesn't fail when there is nothing to split, so thenext()
just takes the whole string. UnfortunatelyCode
is instantiated as a tuple struct, not by callingnew
, so it doesn't get checked that way either. The code also doesn't fail when doing PAKE, unfortunately, because the protocol uses the entire code (including the nameplate) as the password, so the fact that the code is 100% nameplate and 0% password is no bother. This part seems like a bit of a footgun for implementers.The text was updated successfully, but these errors were encountered: