-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[WIP, feedback wanted] macaroons: add new request hash caveat to improve replay protection #1181
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guggero
force-pushed
the
macaroon-request-hash
branch
from
May 5, 2018 09:57
49db13d
to
879898b
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
4 times, most recently
from
May 12, 2018 10:50
5166706
to
2715521
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
May 23, 2018 11:28
4ec6ae5
to
bf8af71
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
3 times, most recently
from
June 5, 2018 08:24
637734f
to
72311bc
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
3 times, most recently
from
June 14, 2018 06:21
15ee13e
to
b4032d2
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
July 1, 2018 10:30
cdbfed0
to
a8c5970
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
July 10, 2018 06:57
a8c5970
to
f67cbbf
Compare
Roasbeef
added
P3
might get fixed, nice to have
needs review
PR needs review by regular contributors
labels
Jul 10, 2018
guggero
force-pushed
the
macaroon-request-hash
branch
from
July 15, 2018 07:23
f67cbbf
to
fe585d5
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
July 29, 2018 07:58
8f29a4a
to
e632adf
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
July 30, 2018 07:02
e632adf
to
5ed9e71
Compare
guggero
changed the title
[WIP] macaroons: add new request hash caveat to improve replay protection
[WIP, feedback wanted] macaroons: add new request hash caveat to improve replay protection
Jul 30, 2018
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
August 19, 2018 10:28
cdbbd5b
to
6bca2ad
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
September 1, 2018 14:16
6bca2ad
to
2d46b26
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
September 15, 2018 06:21
fb0007a
to
6ae3ef9
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
September 29, 2018 08:44
6ae3ef9
to
b89aa31
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
November 3, 2018 08:12
b89aa31
to
b217b98
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
November 24, 2018 08:25
b217b98
to
dbd9271
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
December 29, 2018 13:27
5ea5e34
to
f51af6e
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
January 4, 2019 07:55
78549b0
to
a9cb175
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
2 times, most recently
from
February 22, 2019 11:03
d7264d1
to
1bab374
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
April 17, 2019 10:34
1bab374
to
e84c37f
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
May 26, 2019 12:53
e84c37f
to
648eed9
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
June 4, 2019 06:48
648eed9
to
2038941
Compare
guggero
force-pushed
the
macaroon-request-hash
branch
from
September 30, 2019 08:08
2038941
to
1b281d6
Compare
Not really relevant and not a big security benefit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #285.
To make sure that a macaroon that is somehow intercepted during transmission cannot be used by an attacker, the
lncli
already sets a caveat for a 60 second timeout. Additionally, the macaroon can be locked down to a specific IP address.With this PR the gRPC client (for now, just
lncli
, the feature can be disabled with--no-macaroon-request-hash
) creates a SHA256 hash of the method name concatenated with the JSON serialized request gRPC object.That hash is added to the macaroon as a first-party caveat named
request-hash
.On the server side, this caveat is validated by hashing the method and request object again.
I'm not sure if I'm on the right track with my implementation. That's why I created the PR with the status 'work in progress'. I would really appreciate feedback on what I did, especially from @aakselrod since he created the original issue/feature request.
As I see it, the following questions arise from the way I implemented it:
SendPayment
is a streaming command where several payments can be sent through the same stream but with only one macaroon that is sent at the beginning. So the only thing we can hash is the method name itself (likelnrpc.SendPayment
). But if an attacker can sniff that macaroon, he can send payments himself (until the 60 second timeout runs out). So my question is: Does anyone have an idea on how to further improve the replay protection for streaming requests?lncli
and should in principle also be doable over the REST gateway. My question is: Should we provide code samples on how to do that for all languages? Should we maybe write some kind of simple integration tests for the languages we support?This is the current state of the implementation:
request-hash
feature to work for unary/synchronous requests inlncli
.request-hash
feature to work for streaming/asynchronous requests inlncli
.--no-macaroon-request-hash
.UnaryServerInterceptor
.lncli
.lncli
.As always, thank you for your input!