Opened 15 years ago
Last modified 15 years ago
#142 new defect
analyze consequences of recent TLS plaintext-injection vulnerability
Reported by: | Brian Warner | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | undecided |
Component: | unknown | Version: | 0.4.1 |
Keywords: | security | Cc: |
Description
A week ago, a new problem in TLS surfaced, in which an attacker can inject arbitrary plaintext into the supposedly-authenticated connection just after a "renegotiation" takes place. There was also some suggestion that the attacker could force a renegotiation to occur whenever they liked. I don't yet know if this means that the attacker can inject data into just the beginning of the conversation, or into other places too.
Foolscap is somewhat less vulnerable to this than systems (like HTTP using client-side certificates) that depend upon authorizing clients. Foolscap generally doesn't care *who* you are, just whether or not you know the swissnum.
However, a plaintext-injecting attacker could still cause mischief, sometimes with consequences that violate the expected security properties. If the injection can occur after a getReferenceByName
, then the attacker will be able to send arbitrary messages to objects which the real client has already accessed and retains a RemoteReference
to (because the swissnum-to-CLID mapping is cached for each connection). They'd have to guess which object you're using, and what methods/arguments it responds to, and couldn't see the results.
The attacker could also inject a message which updates the "vocab table" (a mapping from small integer to string, used to compress frequently-used strings like "getReferenceByName"). This would probably only be usable to prevent methods from being called (a DoS attack), but the attacker might also be able to e.g. transform calls to remote_foo() into calls to remote_bar().
We need to:
- learn more about the TLS vulnerability: arbitrary injection, or only at the beginning?
- identify where renegotiation might take place
- explain how foolscap-using applications might be vulnerable
(note that if every single message included the swissnum, and we didn't use CLIDs at all, then the injection-vulnerability window would be much smaller: they'd have to jam something exactly after the swissnum and before the normal message name/args).
Change History (2)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
http://www.theregister.co.uk/2009/11/14/ssl_renegotiation_bug_exploited describes a Twitter exploit that uses this same technique, publishing secret information (in this case, a user's twitter credentials) through a pastebin-like service (in this case, a twitter status update).
I've done some more research, and brainstormed with Zooko, and I think there's a plausible but hard-to-exploit vulnerability. First, the background:
OPEN STRING("call") reqid clid STRING(methodname) OPEN STRING("arguments") numposargs posarg[0] posarg[1].. kwargname0 kwarg[0] kwargname1 kwarg[1] CLOSE CLOSE
The best attack I can think of so far requires the following conditions:
getReference(secretfurl)
andrref.callRemote("withdraw", "100 dollars")
If the attack succeeds, the attacker gets to learn the swissnum and/or argument values of the client's message send.
The attack proceeds as follows:
From the point of view of the client "Alice":
OPEN STRING("call") reqid 0 STRING("getReferenceByName") OPEN STRING("arguments") 1 STRING(swissnum) CLOSE CLOSE
. All of this goes into the attacker's second pastebin.From the point of view of the server:
The end state is that Alice thinks she has invoked her "withdraw" method successfully, but she has not. The attacker can read his second pastebin later and learn the swissnum that alice used for the withdrawal and the arguments she passed.
The attack depends upon being able to exactly predict the length of the messages that Alice will send to the server, so that the CLOSE CLOSE tokens line up correctly. If they don't, the server will not accept the pastebin PUT method and the secrets will be discarded. But nothing that Alice sends is intentionally of random length, and randomly-generated swissnums are always the same size. The attack is easier if we only care about the swissnum and not the method arguments (if we care about argument values, we need them to be of constant length). It is also easier if we don't need to hide the evidence from Alice (making sure she doesn't witness any errors).
This attack relies upon a pastebin-like GET service to amplify the attacker's chosen-prefix (towards-the-server) ability into the ability to send arbitrary data towards the client as well, plus a PUT service to let them see what the victim is sending. An easier GET-only variant would be to use this ability to trick Alice into using the wrong CLID, perhaps in conjunction with a "deposit" method. The contents of the GET pastebin could include a fake response to the "getReferenceByName" method that claimed CLID=5, where in fact CLID 5 had previously been allocated by the attacker to point at his own account instead of Alice's intended beneficiary. This form of attack would require less predictability of her method's arguments, since it wouldn't need a CLOSE CLOSE token sequence to line up anywhere. However, it would still need a dummy method of some sort to absorb her HELLO (and maybe DECISION) block, since these are otherwise likely to cause a banana-level error and drop the connection. An ADD-VOCAB sequence would serve as a good absorb-and-discard tool.
The hypothetical pastebin service must take a non-zero time to respond, because the attacker must have enough time to splice in the client's real connection before the server transmits the pastebin's contents. The new client-to-server connection must be negotiated before the client observes the HELLO block, because that is the point at which the client will ask the TLS transport for the peer certificate in use, and that cert must match the expected tubid for negotiation to proceed. Foolscap's use of eventual-send in method dispatch probably makes this easier to accomplish.
The attack can only be carried out against users of the same Tub as the pastebin service.
A Tahoe storage server could probably be used as a pastebin service. However, Tahoe's end-to-end nature means clients don't send many high-value secrets to a storage server (really just the write-enabler, and lease renew/expire secrets), making this a fairly uninteresting place to attack. I don't believe that foolscap "Gifts" (third-party references) could be used to extend this attack to point at an alternate server: nothing the client sees will cause it to send any secrets that it didn't intend to reveal to the target Tub.
There might be a way to use Foolscap error messages as a pastebin GET service, for example the
"method 'foo' not defined in RIBlah"
error message, using a carefully constructed long method name. The token sequence generated by this would be more complex and require more careful balancing, and any occurrences of a double-newline in the message would break the attack. On the other hand, using a third-party reference in the arguments of a benign message call (which then fails to resolve with a carefully-constructed failure argument) would allow the attacker to control both the timing and the content of the message that gets sent to the client.