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

prevent whitespace splitting #4577

Closed
wants to merge 1 commit into from
Closed

prevent whitespace splitting #4577

wants to merge 1 commit into from

Conversation

daschr
Copy link
Contributor

@daschr daschr commented Apr 1, 2023

Hi!

After an upgrade to v3.0.6 I get the following errors while deploying with the ssh hook:

/root/.acme.sh/acme.sh: Zeile 2411: -T: Kommando nicht gefunden.
/root/.acme.sh/acme.sh: Zeile 2411: -q: Kommando nicht gefunden.

Lokking at the saved deploy parameters

SAVED_DEPLOY_SSH_CMD='ssh -T'
SAVED_DEPLOY_SSH_SCP_CMD='scp -q'

I see that the eval at https://github.com/acmesh-official/acme.sh/blob/master/acme.sh#L2411 (or https://github.com/acmesh-official/acme.sh/blob/dev/acme.sh#L2415) is splitting at whitespaces.

To prevent that, one should use eval $_rac_key=\$_saved

@Neilpang Neilpang closed this Apr 2, 2023
Neilpang pushed a commit that referenced this pull request Apr 2, 2023
@daschr
Copy link
Contributor Author

daschr commented Apr 2, 2023

Unfortunally, your code is still (again) vulnerable to escaping. F.e.:

$ val="ls \" echo pwned \""
$ # your solution
$ eval cmd=\"$val\"
pwned
$ # solution using \$
$ eval cmd=\$val
$ echo $cmd
ls " echo pwned "

This is the reason why I escaped the $. Since the shell won't evaluate _saved before the execution of eval.

@Neilpang Neilpang reopened this Apr 2, 2023
@Neilpang
Copy link
Member

Neilpang commented Apr 2, 2023

sorry, please make a new pr, I will merge it.

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.

None yet

2 participants