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 warning silenced with equality operator #1199

Closed
JacobEvelyn opened this issue May 8, 2018 · 2 comments · Fixed by #1200
Closed

Command injection warning silenced with equality operator #1199

JacobEvelyn opened this issue May 8, 2018 · 2 comments · Fixed by #1200

Comments

@JacobEvelyn
Copy link
Contributor

Background

Brakeman version: 4.2.1
Rails version: 5.1.6
Ruby version: 2.3.4

Issue

I expect this code to produce a command injection warning in brakeman:

def dangerous(foo)
  `echo #{foo}` == "1"
end

but the == "1" appears to prevent brakeman from spotting the vulnerability.

@JacobEvelyn
Copy link
Contributor Author

And, relatedly, brakeman does not warn about this either:

def dangerous(foo)
  !system("echo #{foo}")
end

@presidentbeef
Copy link
Owner

Thanks, Jake.

The first one appears to already be fixed on master.

The second one is an easy fix.

presidentbeef added a commit that referenced this issue May 9, 2018
presidentbeef added a commit that referenced this issue May 9, 2018
Repository owner locked and limited conversation to collaborators Jul 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants