Skip to content

prevent session id reuse#42123

Merged
capnspacehook merged 2 commits intomasterfrom
capnspacehook/prevent-session-id-reuse
May 29, 2024
Merged

prevent session id reuse#42123
capnspacehook merged 2 commits intomasterfrom
capnspacehook/prevent-session-id-reuse

Conversation

@capnspacehook
Copy link
Copy Markdown
Contributor

@capnspacehook capnspacehook commented May 29, 2024

If a user sets TELEPORT_SESSION to a session ID that isn't running, the sent session ID is ignored and a new one is used to prevent the user controlling the value. When parsing a session ID the parsed result is used to ensure all session IDs will have the same format. CreateSessionTracker is updated to create instead of upsert to ensure SessionTracker resources cannot be overwritten by accident.

Clients often need to know the current session ID, and before when they were in control of it that wasn't an issue. To fix this servers will send the current session ID in a SSH channel request on the channel the SSH session was created on. This should be fully backwards compatible, as when an unknown SSH request type is received clients will just ignore it/reply with false.

The changes to lib/web/terminal/terminal.go were necessary to prevent race conditions now that latency websocket messages and session info websocket messages can be potentially sent at the same time.

Fixes https://github.com/gravitational/teleport-private/issues/918.

changelog: fix session recordings getting overwritten or not uploaded

If a user sets `TELEPORT_SESSION` to a session ID
that isn't running, the sent session ID is ignored
and a new one is used to prevent the user
controlling the value. When parsing a session ID
the parsed result is used to ensure all session
IDs will have the same format.
`CreateSessionTracker` is updated to create
instead of upsert to ensure `SessionTracker`
resources cannot be overwritten by accident.

Clients often need to know the current session ID,
and before when they were in control of it that
wasn't an issue. To fix this servers will send the
current session ID in a SSH channel request on the
channel the SSH session was created on. This
should be fully backwards compatible, as when an
unknown SSH request type is received clients will
just ignore it/reply with false.
@capnspacehook
Copy link
Copy Markdown
Contributor Author

cc @rosstimothy I had to modify the 'lib/web/terminal' package you recently added, just want to confirm the changes are acceptable

@capnspacehook capnspacehook added this pull request to the merge queue May 29, 2024
Merged via the queue into master with commit 5806d33 May 29, 2024
@capnspacehook capnspacehook deleted the capnspacehook/prevent-session-id-reuse branch May 29, 2024 14:20
@public-teleport-github-review-bot
Copy link
Copy Markdown

@capnspacehook See the table below for backport results.

Branch Result
branch/v13 Failed
branch/v14 Failed
branch/v15 Failed
branch/v16 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants