Skip to content
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

Fix unauthorized container ops with sessions #2958

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

cthulhu-rider
Copy link
Contributor

@cthulhu-rider cthulhu-rider commented Oct 2, 2024

CLI change is under discussion, see #2947 (comment)

Previously, IR could approve container write operations (PUT, DELETE or
SETEACL) without proper authorization: the request handler did not check
public key from the session token signature against the session
requester, i.e. the container owner. This created a vulnerability in
which any 3rd party could sign the token and perform the operation on
behalf of the container owner by specifying him as the session owner.

Now all container request processors assert that session token is signed
by the container owner. Otherwise, requests are denied.

Fixes #2947.

Signed-off-by: Leonard Lyubich <[email protected]>
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 7.14286% with 13 lines in your changes missing coverage. Please review.

Project coverage is 23.52%. Comparing base (208d7c6) to head (4133364).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
cmd/neofs-cli/modules/util/sign_session.go 11.11% 8 Missing ⚠️
pkg/innerring/processors/container/common.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2958      +/-   ##
==========================================
- Coverage   23.52%   23.52%   -0.01%     
==========================================
  Files         776      776              
  Lines       46606    46619      +13     
==========================================
+ Hits        10964    10967       +3     
- Misses      34778    34789      +11     
+ Partials      864      863       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Previously, CLI `util sign session-token` command unconditionally
overrode issuer field to the execution wallet. This could lead to an
unexpected behavior when user explicitly specified the issuer in the
token and wanted to just attach signature to it.

This changes the default behavior to save the issuer field and adds
`--force-issuer` flag reproducing the old behavior.

Refs #2947. Refs #2487.

Signed-off-by: Leonard Lyubich <[email protected]>
@cthulhu-rider cthulhu-rider force-pushed the bugfix/2947-verify-session-signer branch from 852471c to 4133364 Compare October 2, 2024 15:18
@cthulhu-rider cthulhu-rider marked this pull request as ready for review October 2, 2024 15:19
if forceIss {
err = stok.Sign(user.NewAutoIDSignerRFC6979(*pk))
} else {
err = stok.SetSignature(neofsecdsa.SignerRFC6979(*pk))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check already attached issuer? warn/err if does not match/missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wouldnt add one more key<->user relation. And error is bad here to me cuz this utility should help, not limit. Dont think warning will be useful too: if other issuer is a problem - user will get his error later anyway, if not - there is nothing to worry bout

@roman-khimov roman-khimov merged commit b528d44 into master Oct 7, 2024
19 of 21 checks passed
@roman-khimov roman-khimov deleted the bugfix/2947-verify-session-signer branch October 7, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants