-
Notifications
You must be signed in to change notification settings - Fork 938
Possible exploit? unescaped shell meta characters #445
Comments
Hello, By the way, I tested this issue on my host with version |
Hi @shibumi, If it matters I'm also using zsh |
Hmm. I cannot reproduce it. Neither on Strange. |
Did some more research and it turns out that the problem seems to be oh-my-zsh. |
Also doesn't work for me on
but does not execute. Using I'd like to understand why it seems to be executing for @sethdeckard but no one else, just to be sure it's not a vulnerability in P9k. Any thoughts? |
As said, try it with OMZ (e.g. in the VM). Then it will execute. ;) |
I cannot reproduce this on current master at least with So most likely something in OMZ being vulnerable. |
@bhilburn may it be that you disabled OMZs |
@dritter I do have the OMZ git plugin enabled but I just tried disabling it and it didn't make a difference. |
Hmm. If I switch to another OMZ theme, it seems not vulnerable. So it might our problem after all... |
Okay, I still can't replicate this, and following this thread I can't sort out what the variable is that triggers the issue. It doesn't sound like it's specific to ZSH The interplay between OMZ and P9k, here, could be making things complex. It appears that the exploit only works if OMZ is being used in conjunction with P9k, but only specific versions of OMZ (again, I'm using OMZ and can't trigger it). @dritter - Which version of ZSH / OMZ are you using when you see it trigger? |
I can reproduce it with
Also no plugins enabled and i've tested it with a couple of other themes and only powerlevel9k was vulnerable |
This is an open call for anyone knowledgeable about exploit analysis and ZSH who can help! This is a long shot, but I wonder if @robbyrussell knows of any OMZ devs who might be able to take a peek at this. |
If I had to guess, only people who have prompt_subst set as an option somewhere outside this theme are seeing this issue. It doesn't appear if you use nopromptsubst. |
@belak fixed this one in #486! Thanks so much for everyone's time in testing this and sharing configs, and thanks to @sethdeckard for originally reporting this! I greatly appreciate everyone's contributions to getting this resolved. |
I just recently switched to using this theme and happened to read about this exploit: https://github.com/njhartwell/pw3nage
I tested it on powerlevel9k and confirmed that it is vulnerable due to not escaping meta chars where they are displayed in the prompt (in this case the branch name of the git repo).
Steps to reproduce:
The shell script included in the repo will execute due to the branch name
$(./pw3n)
The text was updated successfully, but these errors were encountered: