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

Quote user supplied inputs provided to scripts to avoid RCE #39644

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

jentfoo
Copy link
Contributor

@jentfoo jentfoo commented Mar 20, 2024

This change introduces the func utils.UnixShellQuote which will quote any inputs which could potentially allow execution or script escape. This is utilized for http endpoints which produce scripts, as it's currently possible for a malicious actor to create links which can result in code execution on the victim running the resulting script.

fixes https://github.com/gravitational/security-findings/issues/77
fixes https://github.com/gravitational/security-findings/issues/86

changelog: Fix for possible phishing links which could result in code execution with install and join scripts

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

lib/web/join_tokens.go Outdated Show resolved Hide resolved
lib/web/apiserver.go Show resolved Hide resolved
jentfoo added 3 commits March 25, 2024 16:07
This change introduces the func `utils.UnixShellQuote` which will quote any inputs which could potentially allow execution or script escape.
This is utilized to ensure that scripts produced from a potential Phishing link could not contain code execution which may expose a user.
…rameters are extracted

This will increase safety moving forward, but it requires a more conservative quoting strategy.
@jentfoo jentfoo force-pushed the jent/script_param_rce_fix branch from 2cb2697 to 6b49943 Compare March 25, 2024 23:06
@jentfoo jentfoo added this pull request to the merge queue Mar 26, 2024
Merged via the queue into master with commit b099293 Mar 26, 2024
35 checks passed
@jentfoo jentfoo deleted the jent/script_param_rce_fix branch March 26, 2024 15:04
@public-teleport-github-review-bot

@jentfoo See the table below for backport results.

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

jentfoo added a commit that referenced this pull request Mar 26, 2024
* Quote user supplied inputs provided to scripts to avoid RCE

This change introduces the func `utils.UnixShellQuote` which will quote any inputs which could potentially allow execution or script escape.
This is utilized to ensure that scripts produced from a potential Phishing link could not contain code execution which may expose a user.

* awsAccessGraphOIDCSync: Ensure role parameter is quoted correctly

* join_tokens: Move shell quote to `getJoinScript` rather than where parameters are extracted

This will increase safety moving forward, but it requires a more conservative quoting strategy.
jentfoo added a commit that referenced this pull request Mar 26, 2024
* Quote user supplied inputs provided to scripts to avoid RCE

This change introduces the func `utils.UnixShellQuote` which will quote any inputs which could potentially allow execution or script escape.
This is utilized to ensure that scripts produced from a potential Phishing link could not contain code execution which may expose a user.

* awsAccessGraphOIDCSync: Ensure role parameter is quoted correctly

* join_tokens: Move shell quote to `getJoinScript` rather than where parameters are extracted

This will increase safety moving forward, but it requires a more conservative quoting strategy.
github-merge-queue bot pushed a commit that referenced this pull request Mar 26, 2024
…39839)

* Quote user supplied inputs provided to scripts to avoid RCE

This change introduces the func `utils.UnixShellQuote` which will quote any inputs which could potentially allow execution or script escape.
This is utilized to ensure that scripts produced from a potential Phishing link could not contain code execution which may expose a user.

* awsAccessGraphOIDCSync: Ensure role parameter is quoted correctly

* join_tokens: Move shell quote to `getJoinScript` rather than where parameters are extracted

This will increase safety moving forward, but it requires a more conservative quoting strategy.
github-merge-queue bot pushed a commit that referenced this pull request Mar 26, 2024
…39838)

* Quote user supplied inputs provided to scripts to avoid RCE

This change introduces the func `utils.UnixShellQuote` which will quote any inputs which could potentially allow execution or script escape.
This is utilized to ensure that scripts produced from a potential Phishing link could not contain code execution which may expose a user.

* awsAccessGraphOIDCSync: Ensure role parameter is quoted correctly

* join_tokens: Move shell quote to `getJoinScript` rather than where parameters are extracted

This will increase safety moving forward, but it requires a more conservative quoting strategy.
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.

3 participants