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

Command injection in Thor::Actions#get #514

Closed
ecneladis opened this issue Jan 8, 2016 · 19 comments
Closed

Command injection in Thor::Actions#get #514

ecneladis opened this issue Jan 8, 2016 · 19 comments

Comments

@ecneladis
Copy link

Open-uri's open used in Thor::Actions#get allows executing system commands [1].

Documentation does not warn that source parameter is vulnerable to malicious input.

Example:

get "|uname -a > cmd_exec_test;\nhttps://gist.github.com", "/tmp/test_123"

[1] http://sakurity.com/blog/2015/02/28/openuri.html

@ecneladis ecneladis changed the title Code execution in Thor::Actions#get Command injection in Thor::Actions#get Jan 10, 2017
@hoffoo
Copy link

hoffoo commented Jul 5, 2018

can someone look into this? It is now published and failing in bundle-audit https://nvd.nist.gov/vuln/detail/CVE-2016-10545

Name: thor
Version: 0.20.0
Advisory: CVE-2016-10545
Criticality: Unknown
URL: https://github.com/erikhuda/thor/issues/514
Title: Command injection in Thor Gem
Solution: remove or disable this gem until a patch is available!

Vulnerabilities found!```

@pherris
Copy link

pherris commented Jul 5, 2018

To ignore this warning until a patch is available: bundle-audit check --ignore CVE-2016-10545

@xymbol
Copy link

xymbol commented Jul 5, 2018

Is someone working on this? How can we help? /cc @rafaelfranca

@rafaelfranca
Copy link
Member

O_0. Who asked for that CVE without discussion this with the project maintainers?

@xymbol
Copy link

xymbol commented Jul 5, 2018

@rafaelfranca I don't know, IIRC it was recorded as reported by MITRE.

Just reviewed the code and the specs. I understand the vulnerability around open but don't see how a public exploit would work in this case. I don't recall user input in well-behaved apps ever being passed onto Thor actions.

@galori It's not trivial to disable if, say, you're using bundler-audit's task.

Maybe the original submitter can chime in? /cc @ecneladis

@rafaelfranca
Copy link
Member

@reedloden do you know who submitted that CVE? MITRE says it came from HackerOne

@xymbol
Copy link

xymbol commented Jul 5, 2018

According to specs, seamless file and url access are by design. In this case, getting open out of the way would not reduce any risk.

@rafaelfranca
Copy link
Member

Yes, this is by design. Thor is a system tool that unlikely will receive user input. Saying thor is vulnerable for command injection is the same thing than saying bash is vulnerable for command injection.

EricDurante added a commit to psu-libraries/researcher-metadata that referenced this issue Jul 5, 2018
No “patch” is available, and it’s unclear whether or not this is a
legitimate vulnerability:  rails/thor#514
ghiculescu added a commit to ghiculescu/ruby-advisory-db that referenced this issue Jul 5, 2018
According to rails/thor#514 nobody thinks this is actually a vulnerability. It seems unlikely to ever get "patched".
@ghiculescu
Copy link
Member

rubysec/ruby-advisory-db#341 - I've proposed that ruby-advisory-db remove this as the consensus here seems to be that this isn't going to get changed in Thor.

@bosoxbill
Copy link

Seems like we could solve the CVE complaint with a documentation-only patch, no?

@rafaelfranca
Copy link
Member

@bosoxbill that is reasonable to me. Feel free to open a PR, I'll merge.

@bosoxbill
Copy link

Pull is here: #611

nebolsin added a commit to mobius-network/mobius-client-ruby that referenced this issue Jul 5, 2018
The consensus is that it's not an exploitable vulnerability and
will not be fixed in Thor (except for documentation part):

rails/thor#514
nebolsin added a commit to mobius-network/mobius-client-ruby that referenced this issue Jul 5, 2018
The consensus is that it's not an exploitable vulnerability and
will not be fixed in Thor (except for documentation part):

rails/thor#514
nebolsin added a commit to mobius-network/mobius-client-ruby that referenced this issue Jul 5, 2018
The consensus is that it's not an exploitable vulnerability and
will not be fixed in Thor (except for documentation part):

rails/thor#514
reedloden pushed a commit to rubysec/ruby-advisory-db that referenced this issue Jul 5, 2018
Upstream does not consider this a vulnerability, as per rails/thor#514
@reedloden
Copy link

Hey folks -- sorry for delayed response.

First of all, based on this discussion, I've gone ahead and removed this issue from ruby-advisory-db, and I will have the CVE marked as REJECT.

This came about because the reporter of this issue had submitted a report to RubySec a while ago to get it added to the database, and it had never been processed. I went through all submissions, and while I did confirm that this issue was still valid in the current master branch, the actual potential for this is low based on how this gem is utilized, as discussed in this thread.

It would have been helpful if this particular issue had not been left open for over two years. Makes it difficult for me to know how upstream would consider the report, and I generally then err on the side of caution of considering it valid.

Anyway, sorry for any problems here.

nebolsin added a commit to mobius-network/mobius-client-ruby that referenced this issue Jul 5, 2018
The consensus is that it's not an exploitable vulnerability and
will not be fixed in Thor (except for documentation part):

rails/thor#514
@rafaelfranca
Copy link
Member

Thanks for the context. This issue was open between the change in maintainers so I missed it totally, sorry.

I'll close the issue but also document on get that passing user inputs can lead to command execution.

@rafaelfranca
Copy link
Member

And also for deal with rejecting the CVE.

@xymbol
Copy link

xymbol commented Jul 5, 2018

@rafaelfranca If help is needed to do a triage or validate pull-requests, please let me know.

@jimconner
Copy link

Just thought I'd let you know that even though you've already merged the documentation patch to address the CVE, it appears that yesterday thor has been added to the list of vulnerabilities that Snyk reports on. I just got a notification in my email from them https://snyk.io/vuln/SNYK-RUBY-THOR-22041 - From the remediation section in there I'm guessing that bumping the release to 0.21 might keep their scanning engine happy.

@reedloden
Copy link

@jimconner Snyk should note that the CVE was rejected. I don't think the thor project needs to do anything here.

@karenyavine
Copy link

Hey all,

I'm Karen, a Security Analyst @ snyk.io.
Thanks for bringing this to our attention! We've removed the vulnerability advisory from our database.

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

No branches or pull requests

10 participants